|  | @@ -102,44 +102,6 @@ exports.create = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |        keberatan: hariKerja(10)
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    })
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  if (coba.decrypt(process.env.CXQSB) === 'production' && data) {
 | 
	
		
			
				|  |  | -    try {
 | 
	
		
			
				|  |  | -      await axios.post(
 | 
	
		
			
				|  |  | -        `https://api.kemdikbud.go.id:8243/pddikti/1.2/pt/${laporan.pt.kode}/sanksi`,
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -          noSanksi: no_sanksi,
 | 
	
		
			
				|  |  | -          tmtBerlaku: from_date,
 | 
	
		
			
				|  |  | -          tstBerlaku: tanggal_terima_sanksi,
 | 
	
		
			
				|  |  | -          idJenisSanksi: Math.max(...pelanggaran.map(e => e.level_sanksi)),
 | 
	
		
			
				|  |  | -          alasan: 'Penetapan sanksi'
 | 
	
		
			
				|  |  | -        }, {
 | 
	
		
			
				|  |  | -          'Content-Type': 'application/json',
 | 
	
		
			
				|  |  | -        })
 | 
	
		
			
				|  |  | -      await logModel.create({
 | 
	
		
			
				|  |  | -        user: user._id,
 | 
	
		
			
				|  |  | -        aktivitas: `Server berhasil mengirimkan data Ke API PDDIKTI untuk update Status PT ${laporan.pt.nama}`
 | 
	
		
			
				|  |  | -      })
 | 
	
		
			
				|  |  | -    } catch (e) {
 | 
	
		
			
				|  |  | -      await Promise.all([
 | 
	
		
			
				|  |  | -        laporanModel.updateOne({
 | 
	
		
			
				|  |  | -          _id: laporan._id
 | 
	
		
			
				|  |  | -        }, {
 | 
	
		
			
				|  |  | -          sanksi: null
 | 
	
		
			
				|  |  | -        }), sanksiModel.deleteOne({
 | 
	
		
			
				|  |  | -          _id: data._id
 | 
	
		
			
				|  |  | -        }), logModel.create({
 | 
	
		
			
				|  |  | -          user: user._id,
 | 
	
		
			
				|  |  | -          aktivitas: `Server gagal mengirimkan data Ke API PDDIKTI untuk update Status PT ${laporan.pt.nama}`
 | 
	
		
			
				|  |  | -        })
 | 
	
		
			
				|  |  | -      ])
 | 
	
		
			
				|  |  | -      return response.error(res, {
 | 
	
		
			
				|  |  | -        message: 'Gagal Membuat Sanksi',
 | 
	
		
			
				|  |  | -        error: e.message
 | 
	
		
			
				|  |  | -      })
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |    await laporanModel.findByIdAndUpdate(laporan._id, {
 | 
	
		
			
				|  |  |      sanksi: data._id
 | 
	
		
			
				|  |  |      // aktif: false,
 | 
	
	
		
			
				|  | @@ -161,6 +123,53 @@ exports.create = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |    })
 | 
	
		
			
				|  |  |  })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +exports.updatePDDIKTI = handleError(async (req, res) => {
 | 
	
		
			
				|  |  | +  const {sanksi_id} = req.params
 | 
	
		
			
				|  |  | +  const user = req.user
 | 
	
		
			
				|  |  | +  const sanksi = await sanksiModel.findOne({_id: sanksi_id}).populate('pelanggaran').populate('laporan')
 | 
	
		
			
				|  |  | +  try {
 | 
	
		
			
				|  |  | +    await axios.post(
 | 
	
		
			
				|  |  | +      `https://api.kemdikbud.go.id:8243/pddikti/1.2/pt/${sanksi.laporan.pt.kode}/sanksi`,
 | 
	
		
			
				|  |  | +      {
 | 
	
		
			
				|  |  | +        noSanksi: sanksi.no_sanksi,
 | 
	
		
			
				|  |  | +        tmtBerlaku: sanksi.masa_berlaku.from_date,
 | 
	
		
			
				|  |  | +        tstBerlaku: sanksi.tanggal_terima_sanksi,
 | 
	
		
			
				|  |  | +        idJenisSanksi: Math.max(...sanksi.pelanggaran.map(e => e.level_sanksi)),
 | 
	
		
			
				|  |  | +        alasan: 'Penetapan sanksi'
 | 
	
		
			
				|  |  | +      }, {
 | 
	
		
			
				|  |  | +        'Content-Type': 'application/json',
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    await logModel.create({
 | 
	
		
			
				|  |  | +      user: user._id,
 | 
	
		
			
				|  |  | +      aktivitas: `Server berhasil mengirimkan data Ke API PDDIKTI untuk update Status PT ${sanksi.laporan.pt.nama}`
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +    return response.success(res, {
 | 
	
		
			
				|  |  | +      message: 'Berhasil mengirim data ke PDDIKTI',
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +  } catch (e) {
 | 
	
		
			
				|  |  | +    await Promise.all([
 | 
	
		
			
				|  |  | +      laporanModel.updateOne({
 | 
	
		
			
				|  |  | +        _id: laporan._id
 | 
	
		
			
				|  |  | +      }, {
 | 
	
		
			
				|  |  | +        sanksi: null
 | 
	
		
			
				|  |  | +      }), sanksiModel.deleteOne({
 | 
	
		
			
				|  |  | +        _id: data._id
 | 
	
		
			
				|  |  | +      }), logModel.create({
 | 
	
		
			
				|  |  | +        user: user._id,
 | 
	
		
			
				|  |  | +        aktivitas: `Server gagal mengirimkan data Ke API PDDIKTI untuk update Status PT ${sanksi.laporan.pt.nama}, dengan error ${e.message}`
 | 
	
		
			
				|  |  | +      }), pemantauanModel.deleteOne({
 | 
	
		
			
				|  |  | +        laporan: sanksi.laporan._id,
 | 
	
		
			
				|  |  | +        sanksi: sanksi._id,
 | 
	
		
			
				|  |  | +        action: 'CREATE SANKSI',
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    ])
 | 
	
		
			
				|  |  | +    return response.error(res, {
 | 
	
		
			
				|  |  | +      message: 'Gagal Membuat Sanksi',
 | 
	
		
			
				|  |  | +      error: e.message
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +})
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  exports.update = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |    const { no_sanksi, keterangan, from_date, to_date } = req.body
 | 
	
		
			
				|  |  |    let sanksiBody = req.body.sanksi
 |