Skip to content

Commit

Permalink
I hate user types
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePyProgrammer committed Apr 9, 2023
1 parent 65aed7b commit 4cf5485
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
11 changes: 11 additions & 0 deletions frontend/src/types/admin.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
export class GeneralInstitute {
instId!: string
name!: string
}

export class Institute {
instId!: string
name!: string
Expand All @@ -7,3 +12,9 @@ export class Institute {
isPublisher!: boolean
isSchool!: boolean
}

export class Job extends Institute {
dept!: string
role!: string
officeAddr!: string
}
42 changes: 42 additions & 0 deletions frontend/src/types/user.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Institute, Job } from "./admin"
export class User {
email!: string
name!: string
Expand All @@ -7,10 +8,51 @@ 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 {
deptId!: string
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: []}
}

0 comments on commit 4cf5485

Please sign in to comment.