diff options
Diffstat (limited to 'src/models/Lab.ts')
| -rw-r--r-- | src/models/Lab.ts | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/models/Lab.ts b/src/models/Lab.ts index 8636f74..d23cffb 100644 --- a/src/models/Lab.ts +++ b/src/models/Lab.ts @@ -1,4 +1,16 @@ -import type EventInfo from "./EventInfo"; +import EventInfo from "./EventInfo"; + +interface LabSerializeInfo { + course: number, + section: number, + event: { + days: string, + start: number, + end: number + }, + building: string, + room: string +} export default class Lab { id: number; @@ -24,6 +36,10 @@ export default class Lab { this.room = room; } + static fromJSON({course, section, event, building, room}: LabSerializeInfo) { + return new Lab(course, section, EventInfo.fromJSON(event), building, room); + } + get time() { return this.event.info; } |
