Production checklists, issue fixes

This commit is contained in:
Stephanos A
2026-07-01 15:04:38 +03:00
parent 0015f645cf
commit 103117d88b
20 changed files with 100 additions and 200 deletions

View File

@@ -317,7 +317,10 @@ export class FleetService {
}
getTrains() {
return this.prisma.train.findMany({ include: { schedules: { take: 5, orderBy: { departureAt: 'desc' } } } });
return this.prisma.train.findMany({
where: { isActive: true },
include: { schedules: { take: 5, orderBy: { departureAt: 'desc' } } },
});
}
createTrain(dto: CreateTrainDto) {
@@ -462,6 +465,7 @@ export class FleetService {
return this.prisma.coach.update({
where: { id },
data: {
number: dto.number,
arrangement: dto.arrangement,
capacity: dto.capacity,
status: dto.status,
@@ -540,6 +544,7 @@ export class FleetService {
]);
if (!schedule) throw new NotFoundException('Schedule not found');
if (!coach) throw new NotFoundException('Coach not found');
if (coach.status !== 'ACTIVE') throw new BadRequestException('Coach is not active');
return this.prisma.coachAssignment.create({ data: dto });
}