|  | @@ -16,6 +16,8 @@ const autoSaveModel = require('../model/autoSave.model')
 | 
	
		
			
				|  |  |  const { cekSatuDataSanksi, cekSatuDataLaporan } = require('../utils/cekData')
 | 
	
		
			
				|  |  |  const userModel = require('../model/user.model')
 | 
	
		
			
				|  |  |  const { addManyDokumen } = require('../utils/dokumenFunction')
 | 
	
		
			
				|  |  | +const logModel = require('../model/log.model')
 | 
	
		
			
				|  |  | +const kontakModel = require('../model/kontak.model')
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  exports.keberatan = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |    const dataSanksi = await sanksiModel
 | 
	
	
		
			
				|  | @@ -170,7 +172,13 @@ exports.reminderKeberatan = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |    )
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    let message = 'Tidak ada notifikasi yang dikirim'
 | 
	
		
			
				|  |  | -  if (notif.length) message = 'Notifikasi berhasil terkirim'
 | 
	
		
			
				|  |  | +  if (notif.length) {
 | 
	
		
			
				|  |  | +    message = 'Notifikasi berhasil terkirim'
 | 
	
		
			
				|  |  | +    const contacts = await kontakModel.find()
 | 
	
		
			
				|  |  | +    await logModel.create({
 | 
	
		
			
				|  |  | +      aktivitas: `Server berhasil mengirim notif wa kepada ${contacts.map((e) => e.nama).join(', ')} untuk reminder keberatan`
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    return response.success(res, {
 | 
	
		
			
				|  |  |      message,
 | 
	
	
		
			
				|  | @@ -232,7 +240,13 @@ exports.reminderBanding = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |    )
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    let message = 'Tidak ada notifikasi yang dikirim'
 | 
	
		
			
				|  |  | -  if (notif.length) message = 'Notifikasi berhasil terkirim'
 | 
	
		
			
				|  |  | +  if (notif.length) {
 | 
	
		
			
				|  |  | +    message = 'Notifikasi berhasil terkirim'
 | 
	
		
			
				|  |  | +    const contacts = await kontakModel.find()
 | 
	
		
			
				|  |  | +    await logModel.create({
 | 
	
		
			
				|  |  | +      aktivitas: `Server berhasil mengirim notif wa kepada ${contacts.map((e) => e.nama).join(', ')} untuk reminder banding`
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    return response.success(res, {
 | 
	
		
			
				|  |  |      message,
 | 
	
	
		
			
				|  | @@ -439,8 +453,12 @@ exports.berakhirSanksi = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }))
 | 
	
		
			
				|  |  | +  const contacts = await kontakModel.find()
 | 
	
		
			
				|  |  |    let message = 'Notifikasi berhasil terkirim'
 | 
	
		
			
				|  |  |    if (count === 0) message = 'tidak ada notifikasi yg dikirim'
 | 
	
		
			
				|  |  | +  else await logModel.create({
 | 
	
		
			
				|  |  | +    aktivitas: `Server berhasil mengirim notif wa kepada ${contacts.map((e) => e.nama).join(', ')} untuk reminder berakhirnya sanksi`
 | 
	
		
			
				|  |  | +  })
 | 
	
		
			
				|  |  |    return response.success(res, {
 | 
	
		
			
				|  |  |      message,
 | 
	
		
			
				|  |  |    })
 |