Enhance deletion logic in Fleet and Schedules services to prevent deletion of records with active dependencies; update Seats and Stations pages to improve UI and remove unused fields.

This commit is contained in:
Stephanos A
2026-06-16 19:30:09 +03:00
parent eb60fc340d
commit ad83c87e2f
5 changed files with 156 additions and 45 deletions

View File

@@ -545,8 +545,13 @@ export class SchedulesService {
});
}
if (dto.coaches && dto.coaches.length > 0) {
await this.assignCoaches(id, dto.coaches);
if (dto.coaches !== undefined) {
if (dto.coaches.length > 0) {
await this.assignCoaches(id, dto.coaches);
} else {
// Remove all coach assignments when empty array is sent
await this.prisma.coachAssignment.deleteMany({ where: { scheduleId: id } });
}
}
return this.getSchedule(id);