aboutsummaryrefslogtreecommitdiff
path: root/src/models/Lab.ts
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2021-09-05 22:56:45 -0500
committerFurkan Sahin <furkan-dev@proton.me>2021-09-05 22:56:45 -0500
commitfea56ae09cd612003e1bafd2459556b67a5950e9 (patch)
treea195fab20351891e6a65f68d77b88bf8c9671e75 /src/models/Lab.ts
parentd0975a6e7ee57de4debda94e823011d813fbf4a1 (diff)
Add import/export functionality
Diffstat (limited to 'src/models/Lab.ts')
-rw-r--r--src/models/Lab.ts18
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;
}