From 4cf5485939e488aaebb405586969cdaf5a42968a Mon Sep 17 00:00:00 2001 From: Prannaya Date: Sun, 9 Apr 2023 19:29:19 +0800 Subject: [PATCH] I hate user types --- frontend/src/types/admin.ts | 11 ++++++++++ frontend/src/types/user.ts | 42 +++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/frontend/src/types/admin.ts b/frontend/src/types/admin.ts index a6f93fc..8f93317 100644 --- a/frontend/src/types/admin.ts +++ b/frontend/src/types/admin.ts @@ -1,3 +1,8 @@ +export class GeneralInstitute { + instId!: string + name!: string +} + export class Institute { instId!: string name!: string @@ -7,3 +12,9 @@ export class Institute { isPublisher!: boolean isSchool!: boolean } + +export class Job extends Institute { + dept!: string + role!: string + officeAddr!: string +} diff --git a/frontend/src/types/user.ts b/frontend/src/types/user.ts index b9959a8..f660f72 100644 --- a/frontend/src/types/user.ts +++ b/frontend/src/types/user.ts @@ -1,3 +1,4 @@ +import { Institute, Job } from "./admin" export class User { email!: string name!: string @@ -7,6 +8,11 @@ export class User { export class Student extends User { nush_sid!: string gradYear!: number + about!: string +} + +export class Coauthor extends Student { + count!: number } export class Teacher extends User { @@ -14,3 +20,39 @@ export class Teacher extends User { isAdmin!: boolean isMentor!: boolean } + + + +export class ExternalTeacher { + email!: string + name!: string + schId!: string +} + +export class ExternalStudent { + email!: string + name!: string + emergencyEmail!: string + teacherName!: string + schId!: string +} + +export class ResearchMentor { + email!: string + name!: string + jobs!: Job[] +} + +export function dummyUser(): User { + return {email: "", name: "", pfp: ''} +} +export function dummyStudent(): Student { + return {email: "", name: "", pfp: '', about: '', nush_sid: "", gradYear: (new Date()).getFullYear()} +} +export function dummyTeacher(): Teacher { + return {email: "", name: "", pfp: '', deptId: "", isAdmin: false, isMentor: false} +} + +export function dummyMentor(): ResearchMentor { + return {email: "", name: "", jobs: []} +} \ No newline at end of file