Adding all the tests and fixes to the passengers app

This commit is contained in:
Muluhabt
2026-07-21 13:45:49 +03:00
parent 8ce2d2d874
commit f2ae9c883f
3316 changed files with 15548 additions and 37 deletions

View File

@@ -103,6 +103,8 @@ export class SchedulesService {
const dep = parseEthiopianTime(dto.departureAt);
const arr = parseEthiopianTime(dto.arrivalAt);
if (arr <= dep) throw new BadRequestException('arrivalAt must be after departureAt');
// M-4: a new schedule cannot depart in the past — the backoffice form does not enforce this.
if (dep.getTime() < Date.now()) throw new BadRequestException('departureAt must be in the future');
const [train, route] = await Promise.all([
this.prisma.train.findUnique({ where: { id: dto.trainId } }),