Untitled
unknown
javascript
2 years ago
800 B
10
Indexable
else if (result.length > 0) {
const inspection_date = new Date();
const expired_date = new Date(inspection_date);
expired_date.setMonth(expired_date.getMonth() + 6);
connection.query(
`UPDATE inspections
SET inspection_date = ? , expired_date = ?
WHERE car_id = (SELECT car_id FROM cars WHERE number_plate = ?)`,
[inspection_date, expired_date, number_plate],
(updateErr, updateResult, updateFields) => {
if (updateErr) {
return res.status(500).json({
status: "Failed",
error: updateErr,
});
}
return res.status(200).json({
status: "Success",
message: "Inspection updated successfully",
data: updateResult,
});
}
);
}Editor is loading...
Leave a Comment