repair: update is read in notification error

This commit is contained in:
2026-01-05 10:08:53 +07:00
parent 3eb403c557
commit adaa9fda9a
3 changed files with 81 additions and 36 deletions

View File

@@ -25,7 +25,6 @@ class NotificationErrorController {
res.status(response.statusCode).json(response);
}
static async getById(req, res) {
const { id } = req.params;
@@ -50,7 +49,10 @@ class NotificationErrorController {
const results = await NotificationErrorService.createNotificationError(
value
);
const response = await setResponse(results, "Notification created successfully");
const response = await setResponse(
results,
"Notification created successfully"
);
return res.status(response.statusCode).json(response);
}
@@ -58,34 +60,35 @@ class NotificationErrorController {
static async update(req, res) {
const { id } = req.params;
const { error, value } = checkValidate(updateNotificationSchema, req)
const userId = req.user.user_id;
if (error) {
return res.status(400).json(setResponse(error, 'Validation failed', 400));
}
value.userId = req.user.user_id
const results = await NotificationErrorService.updateNotificationError(id, value);
const response = await setResponse(results, 'Notification Error User updated successfully')
const results = await NotificationErrorService.updateNotificationError(
id,
userId
);
const response = await setResponse(
results,
"Notification Error updated successfully"
);
res.status(response.statusCode).json(response);
}
static async resend(req, res) {
static async resend(req, res) {
try {
const { id } = req.params;
const results = await NotificationErrorService.resendNotification(id);
const response = await setResponse(
results,
results.message,
);
const response = await setResponse(results, results.message);
res.status(response.statusCode).json(response);
} catch (error) {
const response = setResponse(null, error.message, error.statusCode || 500);
const response = setResponse(
null,
error.message,
error.statusCode || 500
);
res.status(response.statusCode).json(response);
}
}