fix: validation in sparepart and device

This commit is contained in:
2026-06-26 16:10:54 +07:00
parent 5112090a35
commit e5a77f2f93
5 changed files with 70 additions and 97 deletions

View File

@@ -155,14 +155,15 @@ const getDeviceReminderMonthlyDb = async (id) => {
return result.recordset;
};
const updateDeviceReminderMonthlyDb = async (deviceId, reminderMonthly) => {
const updateDeviceReminderMonthlyDb = async (deviceId, reminderMonthly, period) => {
const queryText = `
UPDATE m_device
SET reminder_at_monthly = $1,
SET reminder_at_monthly = $1,
period = $2
updated_at = CURRENT_TIMESTAMP
WHERE device_id = $2 AND deleted_at IS NULL
`;
await pool.query(queryText, [reminderMonthly, deviceId]);
await pool.query(queryText, [reminderMonthly, deviceId, period]);
return getDeviceByIdDb(deviceId);
};