Enhance DTOs and services to support sequence and operational status for coaches and stations

This commit is contained in:
Stephanos A
2026-06-16 16:25:33 +03:00
parent a61130cd51
commit 421e30dc6c
7 changed files with 85 additions and 20 deletions

View File

@@ -298,6 +298,7 @@ export class FleetService {
arrangement: dto.arrangement,
capacity: dto.capacity,
status: dto.status,
sequence: dto.sequence,
},
include: { coachType: true },
});
@@ -306,6 +307,10 @@ export class FleetService {
async deleteCoach(id: string) {
const coach = await this.prisma.coach.findUnique({ where: { id } });
if (!coach) throw new NotFoundException('Coach not found');
// Delete related seats first
await this.prisma.seat.deleteMany({ where: { coachId: id } });
return this.prisma.coach.delete({ where: { id } });
}