| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 | 
							- const sanksiModel = require('../model/sanksi.model')
 
- const dokumenModel = require('../model/dokumen.model')
 
- const handleError = require('../utils/handleError')
 
- const response = require('../utils/responseHandler')
 
- exports.pengajuan = handleError(async (req, res) => {
 
-   const [keberatan, banding] = await Promise.all([
 
-     (() =>
 
-       sanksiModel.find({
 
-         ['pengajuan.keberatan']: { $ne: null, $exists: true },
 
-         is_pengajuan_keberatan: { $eq: null, $exists: false },
 
-       }))(),
 
-     (() =>
 
-       sanksiModel.find({
 
-         ['jawaban.keberatan']: { $ne: null, $exists: true },
 
-         ['pengajuan.banding']: { $ne: null, $exists: true },
 
-         is_pengajuan_banding: { $eq: null, $exists: false },
 
-       }))()
 
-   ])
 
-   await Promise.all([
 
-     ...keberatan.map(async (e) => {
 
-       await sanksiModel.findOneAndUpdate({ _id: e._id }, { is_pengajuan_keberatan: true })
 
-     }),
 
-     ...banding.map(async (e) => {
 
-       await sanksiModel.findOneAndUpdate({ _id: e._id }, { is_pengajuan_banding: true })
 
-     })
 
-   ])
 
-   return response.success(res, {
 
-     message: 'Berhasil migrasi pengajuan',
 
-   })
 
- })
 
- exports.dokumen = handleError(async (req, res) => {
 
-   const dokumen = await dokumenModel.find({ path: /api.sidali.sixsenz.net/ })
 
-   if (dokumen?.length) await Promise.all(dokumen.map(async e => {
 
-     const path = e.path.split('/').slice(3).join('/')
 
-     await dokumenModel.findOneAndUpdate({
 
-       _id: e._id
 
-     }, {
 
-       path: `${process.env.BASE_URL}/${path}`
 
-     })
 
-   }))
 
-   return response.success(res, {
 
-     message: 'Berhasil migrasi dokumen',
 
-   })
 
- })
 
 
  |