Closed Julien-Goletto closed 1 year ago
preHandlerMovies.ts
/** * @preValidation * @description Movie existence verification */// eslint-disable-next-line @typescript-eslint/no-unused-vars fastify.decorate('throwIfMovieFound', async (request: Request<{ Params?: { id: number }; }>, reply: Reply) => { const { _errorService, _movieService } = fastify; const isMovie = await _movieService.checkMovieExistanceById(request.params.id); if (isMovie) _errorService.send(EErrorMessages.ALREADY_POSTED_MOVIE, 404); });
preHandler must use checkMovieExistanceByName to work.
preHandlerMovies.ts
preHandler must use checkMovieExistanceByName to work.