hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiBd962efeBurak Boduroğlu4 months ago146 commits
| 1 | export type { Page, PageParams } from "./page"; |
| 2 | |
| 3 | export type Role = "student" | "teacher" | "manager" | "admin"; |
| 4 | export type UserTheme = "light" | "dark"; |
| 5 | export type UserLanguage = "tr" | "en"; |
| 6 | export type CourseKind = "course" | "study" | string; |
| 7 | export type CoreAttendanceStatus = "present" | "absent" | "late" | "excused"; |
| 8 | export type AttendanceStatus = CoreAttendanceStatus | string; |
| 9 | export type KnownExamKind = "homework" | "quiz" | "midterm" | "final" | "project" | "oral"; |
| 10 | export type ExamKind = KnownExamKind | string; |
| 11 | export type ExamMode = "sync" | "async" | "open"; |
| 12 | export type QuestionKind = "choice" | "text"; |
| 13 | export type AttemptStatus = "in_progress" | "submitted" | "expired"; |
| 14 | |
| 15 | export type User = { |
| 16 | id: string; |
| 17 | username: string; |
| 18 | role: Role; |
| 19 | name: string | null; |
| 20 | surname: string | null; |
| 21 | email: string | null; |
| 22 | phone: string | null; |
| 23 | birth_date: string | null; |
| 24 | theme: UserTheme | null; |
| 25 | language: UserLanguage | null; |
| 26 | }; |
| 27 | |
| 28 | export type ProfileUpdate = { |
| 29 | name?: string | null; |
| 30 | surname?: string | null; |
| 31 | email?: string | null; |
| 32 | phone?: string | null; |
| 33 | birth_date?: string | null; |
| 34 | }; |
| 35 | |
| 36 | export type PersonRef = { |
| 37 | id: string; |
| 38 | username: string; |
| 39 | display_name: string | null; |
| 40 | }; |
| 41 | |
| 42 | export type Note = { |
| 43 | id: string; |
| 44 | title: string; |
| 45 | content: string; |
| 46 | }; |
| 47 | |
| 48 | export type NoteFile = { |
| 49 | id: string; |
| 50 | name: string; |
| 51 | content_type: string; |
| 52 | size: number; |
| 53 | }; |
| 54 | |
| 55 | export type EventAudience = |
| 56 | | { kind: "school" } |
| 57 | | { kind: "role"; role: Role } |
| 58 | | { kind: "course"; course: string } |
| 59 | | { kind: "registration"; capacity?: number | null }; |
| 60 | |
| 61 | export type Event = { |
| 62 | id: string; |
| 63 | creator: string; |
| 64 | title: string; |
| 65 | description: string; |
| 66 | audience: EventAudience; |
| 67 | starts_at: number | null; |
| 68 | ends_at: number | null; |
| 69 | }; |
| 70 | |
| 71 | export type Attendance = { |
| 72 | id: string; |
| 73 | event: string; |
| 74 | user: PersonRef; |
| 75 | status: AttendanceStatus; |
| 76 | marked_by: PersonRef; |
| 77 | }; |
| 78 | |
| 79 | export type Course = { |
| 80 | id: string; |
| 81 | creator: string; |
| 82 | title: string; |
| 83 | description: string; |
| 84 | kind: CourseKind; |
| 85 | /** Academic term id from API (`CourseResponse.term`). */ |
| 86 | term?: string | null; |
| 87 | }; |
| 88 | |
| 89 | export type Term = { |
| 90 | id: string; |
| 91 | name: string; |
| 92 | starts_at: number; |
| 93 | ends_at: number; |
| 94 | }; |
| 95 | |
| 96 | export type Enrollment = { |
| 97 | id: string; |
| 98 | course: string; |
| 99 | user: PersonRef; |
| 100 | enrolled_by: PersonRef; |
| 101 | }; |
| 102 | |
| 103 | export type CourseSession = { |
| 104 | id: string; |
| 105 | course: string; |
| 106 | teacher: PersonRef; |
| 107 | topic: string; |
| 108 | starts_at: number; |
| 109 | ends_at: number | null; |
| 110 | }; |
| 111 | |
| 112 | export type SessionAttendance = { |
| 113 | id: string; |
| 114 | session: string; |
| 115 | course: string; |
| 116 | user: PersonRef; |
| 117 | status: AttendanceStatus; |
| 118 | marked_by: PersonRef; |
| 119 | }; |
| 120 | |
| 121 | export type Exam = { |
| 122 | id: string; |
| 123 | creator: string; |
| 124 | course: string; |
| 125 | title: string; |
| 126 | description: string; |
| 127 | kind: ExamKind | string; |
| 128 | weight?: number | null; |
| 129 | kind_weight?: number | null; |
| 130 | type_weight?: number | null; |
| 131 | exam_type_weight?: number | null; |
| 132 | mode: ExamMode | string | null; |
| 133 | starts_at: number | null; |
| 134 | ends_at: number | null; |
| 135 | duration_ms: number | null; |
| 136 | max_attempts?: number | null; |
| 137 | allow_rejoin?: boolean | null; |
| 138 | }; |
| 139 | |
| 140 | export type ExamResult = { |
| 141 | id: string; |
| 142 | exam: string; |
| 143 | user: PersonRef; |
| 144 | mark: number; |
| 145 | graded_by: PersonRef; |
| 146 | }; |
| 147 | |
| 148 | export type ExamQuestion = { |
| 149 | id: string; |
| 150 | exam: string; |
| 151 | text: string; |
| 152 | kind: QuestionKind; |
| 153 | points: number; |
| 154 | choices: string[] | null; |
| 155 | correct: number | null; |
| 156 | }; |
| 157 | |
| 158 | export type ExamAttempt = { |
| 159 | id?: string; |
| 160 | exam?: string; |
| 161 | user?: PersonRef; |
| 162 | status: AttemptStatus; |
| 163 | attempt?: number; |
| 164 | attempts_used?: number; |
| 165 | max_attempts?: number; |
| 166 | deadline: number | null; |
| 167 | remaining_ms: number | null; |
| 168 | left_at?: number | null; |
| 169 | mark: number | null; |
| 170 | answered: number; |
| 171 | question_count: number; |
| 172 | now: number; |
| 173 | }; |
| 174 | |
| 175 | export type AttemptAnswer = { |
| 176 | selected?: number | null; |
| 177 | text?: string | null; |
| 178 | updated_at?: number; |
| 179 | }; |
| 180 | |
| 181 | export type AttemptQuestion = { |
| 182 | id: string; |
| 183 | exam: string; |
| 184 | text: string; |
| 185 | kind: QuestionKind; |
| 186 | points: number; |
| 187 | choices: string[] | null; |
| 188 | answer: AttemptAnswer | null; |
| 189 | }; |
| 190 | |
| 191 | export type MarkEntry = { |
| 192 | exam: string; |
| 193 | title: string; |
| 194 | kind: string; |
| 195 | weight?: number | null; |
| 196 | kind_weight?: number | null; |
| 197 | type_weight?: number | null; |
| 198 | exam_type_weight?: number | null; |
| 199 | mark: number; |
| 200 | grade?: string | null; |
| 201 | graded_by: string; |
| 202 | }; |
| 203 | |
| 204 | export type CourseMarks = { |
| 205 | course: Course; |
| 206 | results: MarkEntry[]; |
| 207 | average: number | null; |
| 208 | average_grade?: string | null; |
| 209 | }; |
| 210 | |
| 211 | export type AttendanceCounts = { |
| 212 | present: number; |
| 213 | absent: number; |
| 214 | late: number; |
| 215 | excused: number; |
| 216 | custom: Record<string, number>; |
| 217 | total: number; |
| 218 | rate: number | null; |
| 219 | }; |
| 220 | |
| 221 | export type CourseAttendance = { |
| 222 | course: Course; |
| 223 | counts: AttendanceCounts; |
| 224 | }; |
| 225 | |
| 226 | export type AttendanceReport = { |
| 227 | user: string; |
| 228 | events: AttendanceCounts; |
| 229 | sessions: AttendanceCounts; |
| 230 | courses: CourseAttendance[]; |
| 231 | }; |
| 232 | |
| 233 | export type WorkEntry = { |
| 234 | id: string; |
| 235 | user: string; |
| 236 | check_in: number; |
| 237 | check_out: number | null; |
| 238 | duration_ms: number | null; |
| 239 | }; |
| 240 | |
| 241 | export type MarksReport = { |
| 242 | user: string; |
| 243 | courses: CourseMarks[]; |
| 244 | overall_average: number | null; |
| 245 | overall_grade?: string | null; |
| 246 | }; |
| 247 | |
| 248 | export type ExamStatistics = { |
| 249 | graded: number; |
| 250 | average: number | null; |
| 251 | min: number | null; |
| 252 | max: number | null; |
| 253 | }; |
| 254 | |
| 255 | export type GradedAnswer = { |
| 256 | question_id: string; |
| 257 | text: string; |
| 258 | kind: QuestionKind; |
| 259 | points: number; |
| 260 | choices: string[] | null; |
| 261 | correct: number | null; |
| 262 | selected: number | null; |
| 263 | text_answer: string | null; |
| 264 | is_correct: boolean | null; |
| 265 | auto_score: { earned: number; possible: number }; |
| 266 | }; |
| 267 | |
| 268 | export type StudentAnswerSheet = { |
| 269 | user: PersonRef; |
| 270 | answers: GradedAnswer[]; |
| 271 | auto_score: { earned: number; possible: number }; |
| 272 | }; |
| 273 | |
| 274 | export type LiveRosterEntry = { |
| 275 | user: PersonRef; |
| 276 | status: AttemptStatus | "not_started" | "absent"; |
| 277 | attempt?: number | null; |
| 278 | attempts_used?: number | null; |
| 279 | max_attempts?: number | null; |
| 280 | deadline: number | null; |
| 281 | remaining_ms: number | null; |
| 282 | left_at?: number | null; |
| 283 | mark: number | null; |
| 284 | answered: number; |
| 285 | started_at?: number | null; |
| 286 | finished_at?: number | null; |
| 287 | last_activity: number | null; |
| 288 | }; |
| 289 | |
| 290 | export type LiveMonitor = { |
| 291 | exam: Exam; |
| 292 | now: number; |
| 293 | question_count: number; |
| 294 | students: LiveRosterEntry[]; |
| 295 | counts: { |
| 296 | enrolled?: number; |
| 297 | not_started: number; |
| 298 | absent?: number; |
| 299 | in_progress: number; |
| 300 | submitted: number; |
| 301 | expired: number; |
| 302 | graded?: number; |
| 303 | }; |
| 304 | }; |
| 305 | |
| 306 | export type ExamKindSetting = { |
| 307 | name: string; |
| 308 | weight: number; |
| 309 | }; |
| 310 | |
| 311 | export type GradeBand = { |
| 312 | min: number; |
| 313 | label: string; |
| 314 | }; |
| 315 | |
| 316 | export type SchoolSettings = { |
| 317 | exam_kinds: ExamKindSetting[]; |
| 318 | attendance_statuses: string[]; |
| 319 | grade_bands: GradeBand[]; |
| 320 | max_file_bytes: number; |
| 321 | }; |
| 322 | |
| 323 | export const EXAM_KINDS: KnownExamKind[] = [ |
| 324 | "homework", |
| 325 | "quiz", |
| 326 | "midterm", |
| 327 | "final", |
| 328 | "project", |
| 329 | "oral", |
| 330 | ]; |
| 331 | |
| 332 | export const EXAM_MODES: ExamMode[] = ["sync", "async", "open"]; |
| 333 | |
| 334 | export const QUESTION_KINDS: QuestionKind[] = ["choice", "text"]; |