-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
224 lines (206 loc) · 4.73 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
import { type DefaultSession } from "next-auth"
import { ParsedUrlQuery } from 'querystring'
declare module 'next-auth' {
interface Session {
user: {
_id: string
trustLevel: number
verified: boolean
kerb: string
name: string
classOf: number
affiliation: string
} & DefaultSession["user"]
}
}
declare global {
namespace NodeJS {
interface ProcessEnv {
MONGODB_CONNECTION_URI: string
MIT_OIDC_WELLKNOWN: string
MIT_OIDC_CLIENT_ID: string
MIT_OIDC_CLIENT_SECRET: string
MIT_OIDC_AUTHORIZATION_ENDPOINT: string
MIT_OIDC_ISSUER: string
NEXTAUTH_SECRET: string
MIT_API_CLIENT_ID: string
MIT_API_CLIENT_SECRET: string
AUTH_TRUST_HOST: boolean
ELASTIC_SEARCH_URI: string
}
}
}
export enum LetterGrade {
A = 'A',
B = 'B',
C = 'C',
D = 'D',
F = 'F',
DR = 'DR'
}
export enum IdentityFlags {
FirstGeneration = 'First Gen',
LowIncome = 'Low Income',
BIL = 'BIL',
International = 'International'
}
export enum TimeRange {
'0-2 hours' = '0-2 hours',
'3-5 hours' = '3-5 hours',
'6-8 hours' = '6-8 hours',
'9-11 hours' = '9-11 hours',
'12-14 hours' = '12-14 hours',
'15-17 hours' = '15-17 hours',
'18-20 hours' = '18-20 hours',
'21-23 hours' = '21-23 hours',
'24-26 hours' = '24-26 hours',
'37-40 hours' = '37-40 hours',
'Unknown' = 'Unknown'
}
export enum SupportStatus {
Maintainer = 'Maintainer',
Supporter = 'Supporter'
}
export interface IClass {
_id?: string
subjectNumber: string
aliases?: string[]
subjectTitle: string
instructors: string[]
term: string
academicYear: number
display?: boolean
description: string
department: string
crossListedDepartments: string[]
units: string
reviewable: boolean
offered: boolean
createdAt?: Date
updatedAt?: Date
}
export interface IUser {
_id: string
sub: string
name: string
kerb: string
email: string
classOf?: number
year: string
verified: boolean
affiliation: string
banned: boolean
trustLevel: number
classesTaken: IClass[]
flags: IdentityFlags[]
referredBy: IUser,
avatar: string,
supportStatus: SupportStatus,
createdAt: Date,
updatedAt: Date
}
export interface IClassReview {
_id?: string
class: IClass
author: IUser
approved: boolean
overallRating: number
firstYear: boolean
retaking: boolean
droppedClass: boolean
hoursPerWeek: TimeRange
recommendationLevel: number
classComments: string
backgroundComments: string
display: boolean
createdAt: Date
updatedAt: Date
numericGrade: number
letterGrade: LetterGrade
methodOfGradeCalculation: string
verified: boolean,
partial: boolean
}
export interface IClassGrade {
_id?: string
class: IClass
author: IUser
numericGrade: number
letterGrade: LetterGrade
methodOfGradeCalculation: string
verified: boolean
}
export enum AuditLogType {
DeleteClass = 'DeleteClass',
FetchDepartment = 'FetchDepartment',
SubmitContent = 'SubmitContent',
ApproveContent = 'ApproveContent',
RemoveContent = 'Removecontent',
ReportContent = 'ReportContent',
AddReview = 'AddReview',
EditReview = 'EditReview',
HideReview = 'HideReview',
JoinPlatform = 'JoinPlatform',
VerifyPlatform = 'VerifyPlatform'
}
export interface IAuditLog {
_id?: string
actor: IUser
type: AuditLogType
description: string
createdAt: Date
updatedAt: Date
}
export interface IContentSubmission {
_id?: string
class: IClass
author: IUser
approved: boolean
contentURL: string
contentTitle: string
type: string
createdAt: Date
updatedAt: Date
}
export interface APIClass {
termCode: string
subjectId: string
academicYear: string
title: string
cluster: string
prerequisites: string
units: string
optional: string
description: string
offered: boolean
instructors: string
}
export interface IParams extends ParsedUrlQuery {
id: string
}
export interface IKarma {
_id?: string
actor: IUser
amount: number
description: string
createdAt: Date
updatedAt: Date
}
export interface IReport {
_id?: string
reporter: IUser
contentSubmission: IContentSubmission
classReview: IClassReview
reason: string
resolved: boolean
outcome: string
createdAt: Date
updatedAt: Date
}
export interface IFAQ {
_id?: string
question: string
answer: string
createdAt: Date
updatedAt: Date
}