repair: notification_log
This commit is contained in:
@@ -55,7 +55,18 @@ class NotificationErrorLogController {
|
||||
return res.status(400).json(setResponse(error, 'Validation failed', 400));
|
||||
}
|
||||
|
||||
value.created_by = req.user.user_id;
|
||||
let createdBy, contactPhone;
|
||||
|
||||
if (!isNaN(req.user.userId) && Number(req.user.userId) > 0) {
|
||||
createdBy = Number(req.user.userId);
|
||||
contactPhone = value.contact_phone || null;
|
||||
} else {
|
||||
createdBy = null;
|
||||
contactPhone = req.user.userId;
|
||||
}
|
||||
|
||||
value.created_by = createdBy;
|
||||
value.contact_phone = contactPhone;
|
||||
|
||||
const results = await NotificationErrorLogService.createNotificationErrorLog(value);
|
||||
const response = await setResponse(results, 'Notification Error Log created successfully')
|
||||
|
||||
@@ -46,7 +46,7 @@ class NotificationErrorLogService {
|
||||
|
||||
const store = {
|
||||
notification_error_id: data.notification_error_id,
|
||||
contact_id: data.contact_id,
|
||||
contact_phone: data.contact_phone,
|
||||
notification_error_log_description: data.notification_error_log_description,
|
||||
created_by: data.created_by
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ const Joi = require("joi");
|
||||
|
||||
const insertNotificationErrorLogSchema = Joi.object({
|
||||
notification_error_id: Joi.number().integer().required(),
|
||||
contact_id: Joi.number().integer().required(),
|
||||
contact_phone: Joi.string().optional(),
|
||||
notification_error_log_description: Joi.string().required()
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user