mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 02:58:11 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user