From a23f6cde1c55b358495e9d24d3e3540b1b99cc73 Mon Sep 17 00:00:00 2001 From: Michael Siu Date: Thu, 2 Nov 2023 02:17:44 +1100 Subject: [PATCH] feat: add ClassDTO, add some onDelete behaviour to schema --- server/prisma/schema.prisma | 2 +- server/src/user/dto/timetable.dto.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server/prisma/schema.prisma b/server/prisma/schema.prisma index 73d9e5e6e..439176ced 100644 --- a/server/prisma/schema.prisma +++ b/server/prisma/schema.prisma @@ -35,7 +35,7 @@ model Event { day String start DateTime end DateTime - timetable Timetable? @relation(fields: [timetableId], references: [id]) + timetable Timetable? @relation(fields: [timetableId], references: [id], onDelete: Cascade) timetableId String? } diff --git a/server/src/user/dto/timetable.dto.ts b/server/src/user/dto/timetable.dto.ts index ca1499df2..aac646322 100644 --- a/server/src/user/dto/timetable.dto.ts +++ b/server/src/user/dto/timetable.dto.ts @@ -8,7 +8,6 @@ export class TimetableDto { @IsArray() @IsString({ each: true }) selectedCourses: string[]; - events: EventDto[]; } @@ -22,3 +21,9 @@ export class EventDto { start: Date; end: Date; } + +export class ClassDto { + id: string; + classType: string; + courseName: string; +}