Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1x 1x 1x 11x 11x 11x 11x 5x 6x 2x | import {RequestHandler} from 'express';
import {BadRequestError} from '@errors';
import {CarService} from '@models';
export const deleteCarController: RequestHandler = async (req, res, _next) => {
// Check parameter
const groupId = Number.parseInt(req.params.groupId, 10);
const carId = Number.parseInt(req.params.carId, 10);
const user = req.user;
if (isNaN(groupId) || isNaN(carId) || user === undefined) {
throw new BadRequestError('Parameters are missing');
}
await CarService.delete(user, groupId, carId);
res.status(204).send();
};
|