Linkando van com usuário

This commit is contained in:
Matheus Albino Brunhara
2022-06-20 05:40:56 -05:00
parent 04de75faf6
commit 2f55141bdf
13 changed files with 287 additions and 1159 deletions

View File

@@ -5,15 +5,15 @@ import AppError from '../errors/AppError';
import Van from '../models/Van';
class FindVanService {
public async execute(id_van: string): Promise<Van> {
public async execute(plate: string): Promise<Van> {
const vansRepository = getRepository(Van);
const van = await vansRepository.findOne({
where: { id_van }
where: { plate }
});
if (!van) {
throw new AppError('Van does not exist.');
throw new AppError('A van informada não existe.');
};
return van;