Untitled

mail@pastecode.io avatar
unknown
javascript
7 months ago
800 B
4
Indexable
Never
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,
						});
					}
				);
			}
Leave a Comment