|  | @@ -15,15 +15,12 @@ exports.addUserPublic = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |      pt_id: 'string',
 | 
	
		
			
				|  |  |      // nama: 'string',
 | 
	
		
			
				|  |  |      // email: 'email',
 | 
	
		
			
				|  |  | -    no_hp: 'string',
 | 
	
		
			
				|  |  | +    // no_hp: 'string',
 | 
	
		
			
				|  |  |      // alamat: 'string',
 | 
	
		
			
				|  |  |      is_private: { type: 'string', enum: ['true', 'false'] },
 | 
	
		
			
				|  |  |    })
 | 
	
		
			
				|  |  |    if (!isValid) return
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const no_hp2 =
 | 
	
		
			
				|  |  | -    no_hp.substring(0, 1) === '0' ? '62' + no_hp.substring(1) : no_hp
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |    const pt = await axios.get(
 | 
	
		
			
				|  |  |      `https://api.kemdikbud.go.id:8243/pddikti/1.2/pt/${pt_id}`
 | 
	
		
			
				|  |  |    )
 | 
	
	
		
			
				|  | @@ -38,7 +35,12 @@ exports.addUserPublic = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |      foto_id = await addDokumen(foto)
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const no_verifikasi = Math.floor(Math.random() * 1000000)
 | 
	
		
			
				|  |  | +  let no_hp2 = null
 | 
	
		
			
				|  |  | +  let no_verifikasi = null
 | 
	
		
			
				|  |  | +  if (no_hp) {
 | 
	
		
			
				|  |  | +    no_hp2 = no_hp.substring(0, 1) === '0' ? '62' + no_hp.substring(1) : no_hp
 | 
	
		
			
				|  |  | +    no_verifikasi = Math.floor(Math.random() * 1000000)
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    let level = 1
 | 
	
		
			
				|  |  |    if (
 | 
	
	
		
			
				|  | @@ -66,15 +68,18 @@ exports.addUserPublic = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |      verified: false,
 | 
	
		
			
				|  |  |    })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const notif = await notifWA2(
 | 
	
		
			
				|  |  | -    TEMPLATE_VERIFIKASI,
 | 
	
		
			
				|  |  | -    { nama: nama || 'rahasia', no_hp: no_hp2 },
 | 
	
		
			
				|  |  | -    [
 | 
	
		
			
				|  |  | -      { key: '1', value: 'pt', value_text: pt[0].nama },
 | 
	
		
			
				|  |  | -      { key: '3', value: 'no_verifikasi', value_text: no_verifikasi },
 | 
	
		
			
				|  |  | -      { key: '2', value: 'no_laporan', value_text: no_laporan },
 | 
	
		
			
				|  |  | -    ]
 | 
	
		
			
				|  |  | -  )
 | 
	
		
			
				|  |  | +  let notif = null
 | 
	
		
			
				|  |  | +  if (no_hp) {
 | 
	
		
			
				|  |  | +    notif = await notifWA2(
 | 
	
		
			
				|  |  | +      TEMPLATE_VERIFIKASI,
 | 
	
		
			
				|  |  | +      { nama: nama || 'rahasia', no_hp: no_hp2 },
 | 
	
		
			
				|  |  | +      [
 | 
	
		
			
				|  |  | +        { key: '1', value: 'pt', value_text: pt[0].nama },
 | 
	
		
			
				|  |  | +        { key: '3', value: 'no_verifikasi', value_text: no_verifikasi },
 | 
	
		
			
				|  |  | +        { key: '2', value: 'no_laporan', value_text: no_laporan },
 | 
	
		
			
				|  |  | +      ]
 | 
	
		
			
				|  |  | +    )
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    const accessToken = jwt.sign(
 | 
	
		
			
				|  |  |      {
 | 
	
	
		
			
				|  | @@ -90,11 +95,11 @@ exports.addUserPublic = handleError(async (req, res) => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    data = {
 | 
	
		
			
				|  |  |      token: `Bearer ${accessToken}`,
 | 
	
		
			
				|  |  | -    no_hp_aktif: notif[0].status == 'success' ? true : false,
 | 
	
		
			
				|  |  | +    no_hp_aktif: no_hp && notif[0].status == 'success' ? true : false,
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    return response.success(res, {
 | 
	
		
			
				|  |  | -    data: data,
 | 
	
		
			
				|  |  | +    data,
 | 
	
		
			
				|  |  |      message: 'Berhasil menambah user',
 | 
	
		
			
				|  |  |    })
 | 
	
		
			
				|  |  |  })
 |