Skip to content

Commit

Permalink
Fields Param
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Jul 23, 2024
1 parent 07cea0e commit f181f06
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/api/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,37 @@ export type User = Model<
}
>

export type TeacherUser = User & {
export type TeacherUser<Fields = User> = Fields & {
teacher: Teacher
student: undefined
}

export type SchoolTeacherUser = TeacherUser & {
export type SchoolTeacherUser<Fields = User> = Fields & {
teacher: SchoolTeacher
student: undefined
}

export type AdminSchoolTeacherUser = SchoolTeacherUser & {
export type AdminSchoolTeacherUser<Fields = User> = Fields & {
teacher: AdminSchoolTeacher
student: undefined
}

export type NonAdminSchoolTeacherUser = SchoolTeacherUser & {
export type NonAdminSchoolTeacherUser<Fields = User> = Fields & {
teacher: NonAdminSchoolTeacher
student: undefined
}

export type NonSchoolTeacherUser = TeacherUser & {
export type NonSchoolTeacherUser<Fields = User> = Fields & {
teacher: NonSchoolTeacher
student: undefined
}

export type StudentUser = User & {
export type StudentUser<Fields = User> = Fields & {
teacher: undefined
student: Student
}

export type IndependentUser = User & {
export type IndependentUser<Fields = User> = Fields & {
teacher: undefined
student: undefined
}
Expand All @@ -66,19 +70,21 @@ export type Teacher = Model<
}
>

export type SchoolTeacher = Teacher & {
export type SchoolTeacher<Fields = Teacher> = Fields & {
school: number
}

export type AdminSchoolTeacher = SchoolTeacher & {
export type AdminSchoolTeacher<Fields = Teacher> = Fields & {
school: number
is_admin: true
}

export type NonAdminSchoolTeacher = SchoolTeacher & {
export type NonAdminSchoolTeacher<Fields = Teacher> = Fields & {
school: number
is_admin: false
}

export type NonSchoolTeacher = Teacher & {
export type NonSchoolTeacher<Fields = Teacher> = Fields & {
school: undefined
}

Expand Down

0 comments on commit f181f06

Please sign in to comment.