Merge remote-tracking branch 'origin/dev' into feat/indieningen-kunnen-posten-en-bekijken-#194
# Conflicts: # frontend/src/queries/groups.ts # frontend/src/queries/submissions.ts
This commit is contained in:
		
						commit
						ce5c0ea629
					
				
					 14 changed files with 152 additions and 66 deletions
				
			
		|  | @ -1,6 +1,6 @@ | ||||||
| import { Request, Response } from 'express'; | import { Request, Response } from 'express'; | ||||||
| import { requireFields } from './error-helper'; | import { requireFields } from './error-helper.js'; | ||||||
| import { createInvitation, deleteInvitation, getAllInvitations, getInvitation, updateInvitation } from '../services/teacher-invitations'; | import { createInvitation, deleteInvitation, getAllInvitations, getInvitation, updateInvitation } from '../services/teacher-invitations.js'; | ||||||
| import { TeacherInvitationData } from '@dwengo-1/common/interfaces/teacher-invitation'; | import { TeacherInvitationData } from '@dwengo-1/common/interfaces/teacher-invitation'; | ||||||
| 
 | 
 | ||||||
| export async function getAllInvitationsHandler(req: Request, res: Response): Promise<void> { | export async function getAllInvitationsHandler(req: Request, res: Response): Promise<void> { | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ import { getGroupRepository } from '../data/repositories.js'; | ||||||
| import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; | import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; | ||||||
| import { Class } from '../entities/classes/class.entity.js'; | import { Class } from '../entities/classes/class.entity.js'; | ||||||
| import { StudentDTO } from '@dwengo-1/common/interfaces/student'; | import { StudentDTO } from '@dwengo-1/common/interfaces/student'; | ||||||
| import { mapToClassDTO } from './class'; | import { mapToClassDTO } from './class.js'; | ||||||
| 
 | 
 | ||||||
| export function mapToGroup(groupDto: GroupDTO, clazz: Class): Group { | export function mapToGroup(groupDto: GroupDTO, clazz: Class): Group { | ||||||
|     const assignmentDto = groupDto.assignment as AssignmentDTO; |     const assignmentDto = groupDto.assignment as AssignmentDTO; | ||||||
|  |  | ||||||
|  | @ -2,9 +2,9 @@ import { Submission } from '../entities/assignments/submission.entity.js'; | ||||||
| import { mapToGroupDTOId } from './group.js'; | import { mapToGroupDTOId } from './group.js'; | ||||||
| import { mapToStudentDTO } from './student.js'; | import { mapToStudentDTO } from './student.js'; | ||||||
| import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | ||||||
| import { getSubmissionRepository } from '../data/repositories'; | import { getSubmissionRepository } from '../data/repositories.js'; | ||||||
| import { Student } from '../entities/users/student.entity'; | import { Student } from '../entities/users/student.entity.js'; | ||||||
| import { Group } from '../entities/assignments/group.entity'; | import { Group } from '../entities/assignments/group.entity.js'; | ||||||
| 
 | 
 | ||||||
| export function mapToSubmissionDTO(submission: Submission): SubmissionDTO { | export function mapToSubmissionDTO(submission: Submission): SubmissionDTO { | ||||||
|     return { |     return { | ||||||
|  |  | ||||||
|  | @ -1,9 +1,9 @@ | ||||||
| import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity.js'; | import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity.js'; | ||||||
| import { mapToUserDTO } from './user.js'; | import { mapToUserDTO } from './user.js'; | ||||||
| import { TeacherInvitationDTO } from '@dwengo-1/common/interfaces/teacher-invitation'; | import { TeacherInvitationDTO } from '@dwengo-1/common/interfaces/teacher-invitation'; | ||||||
| import { getTeacherInvitationRepository } from '../data/repositories'; | import { getTeacherInvitationRepository } from '../data/repositories.js'; | ||||||
| import { Teacher } from '../entities/users/teacher.entity'; | import { Teacher } from '../entities/users/teacher.entity.js'; | ||||||
| import { Class } from '../entities/classes/class.entity'; | import { Class } from '../entities/classes/class.entity.js'; | ||||||
| import { ClassStatus } from '@dwengo-1/common/util/class-join-request'; | import { ClassStatus } from '@dwengo-1/common/util/class-join-request'; | ||||||
| 
 | 
 | ||||||
| export function mapToTeacherInvitationDTO(invitation: TeacherInvitation): TeacherInvitationDTO { | export function mapToTeacherInvitationDTO(invitation: TeacherInvitation): TeacherInvitationDTO { | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ import { | ||||||
|     getAllInvitationsHandler, |     getAllInvitationsHandler, | ||||||
|     getInvitationHandler, |     getInvitationHandler, | ||||||
|     updateInvitationHandler, |     updateInvitationHandler, | ||||||
| } from '../controllers/teacher-invitations'; | } from '../controllers/teacher-invitations.js'; | ||||||
| 
 | 
 | ||||||
| const router = express.Router({ mergeParams: true }); | const router = express.Router({ mergeParams: true }); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ import { AnswerDTO, AnswerId } from '@dwengo-1/common/interfaces/answer'; | ||||||
| import { mapToAssignment } from '../interfaces/assignment.js'; | import { mapToAssignment } from '../interfaces/assignment.js'; | ||||||
| import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; | import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; | ||||||
| import { fetchStudent } from './students.js'; | import { fetchStudent } from './students.js'; | ||||||
| import { NotFoundException } from '../exceptions/not-found-exception'; | import { NotFoundException } from '../exceptions/not-found-exception.js'; | ||||||
| import { FALLBACK_VERSION_NUM } from '../config.js'; | import { FALLBACK_VERSION_NUM } from '../config.js'; | ||||||
| 
 | 
 | ||||||
| export async function getQuestionsAboutLearningObjectInAssignment( | export async function getQuestionsAboutLearningObjectInAssignment( | ||||||
|  |  | ||||||
|  | @ -1,11 +1,11 @@ | ||||||
| import { fetchTeacher } from './teachers'; | import { fetchTeacher } from './teachers.js'; | ||||||
| import { getTeacherInvitationRepository } from '../data/repositories'; | import { getTeacherInvitationRepository } from '../data/repositories.js'; | ||||||
| import { mapToInvitation, mapToTeacherInvitationDTO } from '../interfaces/teacher-invitation'; | import { mapToInvitation, mapToTeacherInvitationDTO } from '../interfaces/teacher-invitation.js'; | ||||||
| import { addClassTeacher, fetchClass } from './classes'; | import { addClassTeacher, fetchClass } from './classes.js'; | ||||||
| import { TeacherInvitationData, TeacherInvitationDTO } from '@dwengo-1/common/interfaces/teacher-invitation'; | import { TeacherInvitationData, TeacherInvitationDTO } from '@dwengo-1/common/interfaces/teacher-invitation'; | ||||||
| import { ConflictException } from '../exceptions/conflict-exception'; | import { ConflictException } from '../exceptions/conflict-exception.js'; | ||||||
| import { NotFoundException } from '../exceptions/not-found-exception'; | import { NotFoundException } from '../exceptions/not-found-exception.js'; | ||||||
| import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity'; | import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity.js'; | ||||||
| import { ClassStatus } from '@dwengo-1/common/util/class-join-request'; | import { ClassStatus } from '@dwengo-1/common/util/class-join-request'; | ||||||
| 
 | 
 | ||||||
| export async function getAllInvitations(username: string, sent: boolean): Promise<TeacherInvitationDTO[]> { | export async function getAllInvitations(username: string, sent: boolean): Promise<TeacherInvitationDTO[]> { | ||||||
|  |  | ||||||
|  | @ -21,7 +21,14 @@ const vueConfig = defineConfigWithVueTs( | ||||||
| 
 | 
 | ||||||
|     { |     { | ||||||
|         name: "app/files-to-ignore", |         name: "app/files-to-ignore", | ||||||
|         ignores: ["**/dist/**", "**/dist-ssr/**", "**/coverage/**", "prettier.config.js"], |         ignores: [ | ||||||
|  |             "**/dist/**", | ||||||
|  |             "**/dist-ssr/**", | ||||||
|  |             "**/coverage/**", | ||||||
|  |             "prettier.config.js", | ||||||
|  |             "**/test-results/**", | ||||||
|  |             "**/playwright-report/**", | ||||||
|  |         ], | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     pluginVue.configs["flat/essential"], |     pluginVue.configs["flat/essential"], | ||||||
|  |  | ||||||
|  | @ -80,13 +80,14 @@ | ||||||
|             > |             > | ||||||
|                 {{ t("classes") }} |                 {{ t("classes") }} | ||||||
|             </v-btn> |             </v-btn> | ||||||
|             <v-btn |             <!-- TODO Re-enable this button when the discussion page is ready --> | ||||||
|                 class="menu_item" |             <!--            <v-btn--> | ||||||
|                 variant="text" |             <!--                class="menu_item"--> | ||||||
|                 to="/user/discussion" |             <!--                variant="text"--> | ||||||
|             > |             <!--                to="/user/discussion"--> | ||||||
|                 {{ t("discussions") }} |             <!--            >--> | ||||||
|             </v-btn> |             <!--                {{ t("discussions") }}--> | ||||||
|  |             <!--            </v-btn>--> | ||||||
|             <v-menu open-on-hover> |             <v-menu open-on-hover> | ||||||
|                 <template v-slot:activator="{ props }"> |                 <template v-slot:activator="{ props }"> | ||||||
|                     <v-btn |                     <v-btn | ||||||
|  |  | ||||||
|  | @ -15,16 +15,35 @@ import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment"; | ||||||
| import type { QueryClient } from "@tanstack/react-query"; | import type { QueryClient } from "@tanstack/react-query"; | ||||||
| import { invalidateAllSubmissionKeys } from "./submissions"; | import { invalidateAllSubmissionKeys } from "./submissions"; | ||||||
| 
 | 
 | ||||||
| function assignmentsQueryKey(classid: string, full: boolean) { | type AssignmentsQueryKey = ["assignments", string, boolean]; | ||||||
|  | 
 | ||||||
|  | function assignmentsQueryKey(classid: string, full: boolean): AssignmentsQueryKey { | ||||||
|     return ["assignments", classid, full]; |     return ["assignments", classid, full]; | ||||||
| } | } | ||||||
| function assignmentQueryKey(classid: string, assignmentNumber: number) { | 
 | ||||||
|  | type AssignmentQueryKey = ["assignment", string, number]; | ||||||
|  | 
 | ||||||
|  | function assignmentQueryKey(classid: string, assignmentNumber: number): AssignmentQueryKey { | ||||||
|     return ["assignment", classid, assignmentNumber]; |     return ["assignment", classid, assignmentNumber]; | ||||||
| } | } | ||||||
| function assignmentSubmissionsQueryKey(classid: string, assignmentNumber: number, full: boolean) { | 
 | ||||||
|  | type AssignmentSubmissionsQueryKey = ["assignment-submissions", string, number, boolean]; | ||||||
|  | 
 | ||||||
|  | function assignmentSubmissionsQueryKey( | ||||||
|  |     classid: string, | ||||||
|  |     assignmentNumber: number, | ||||||
|  |     full: boolean, | ||||||
|  | ): AssignmentSubmissionsQueryKey { | ||||||
|     return ["assignment-submissions", classid, assignmentNumber, full]; |     return ["assignment-submissions", classid, assignmentNumber, full]; | ||||||
| } | } | ||||||
| function assignmentQuestionsQueryKey(classid: string, assignmentNumber: number, full: boolean) { | 
 | ||||||
|  | type AssignmentQuestionsQueryKey = ["assignment-questions", string, number, boolean]; | ||||||
|  | 
 | ||||||
|  | function assignmentQuestionsQueryKey( | ||||||
|  |     classid: string, | ||||||
|  |     assignmentNumber: number, | ||||||
|  |     full: boolean, | ||||||
|  | ): AssignmentQuestionsQueryKey { | ||||||
|     return ["assignment-questions", classid, assignmentNumber, full]; |     return ["assignment-questions", classid, assignmentNumber, full]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -32,13 +51,15 @@ export async function invalidateAllAssignmentKeys( | ||||||
|     queryClient: QueryClient, |     queryClient: QueryClient, | ||||||
|     classid?: string, |     classid?: string, | ||||||
|     assignmentNumber?: number, |     assignmentNumber?: number, | ||||||
| ) { | ): Promise<void> { | ||||||
|     const keys = ["assignment", "assignment-submissions", "assignment-questions"]; |     const keys = ["assignment", "assignment-submissions", "assignment-questions"]; | ||||||
| 
 | 
 | ||||||
|     for (const key of keys) { |     await Promise.all( | ||||||
|         const queryKey = [key, classid, assignmentNumber].filter((arg) => arg !== undefined); |         keys.map(async (key) => { | ||||||
|         await queryClient.invalidateQueries({ queryKey: queryKey }); |             const queryKey = [key, classid, assignmentNumber].filter((arg) => arg !== undefined); | ||||||
|     } |             return queryClient.invalidateQueries({ queryKey: queryKey }); | ||||||
|  |         }), | ||||||
|  |     ); | ||||||
| 
 | 
 | ||||||
|     await queryClient.invalidateQueries({ queryKey: ["assignments", classid].filter((arg) => arg !== undefined) }); |     await queryClient.invalidateQueries({ queryKey: ["assignments", classid].filter((arg) => arg !== undefined) }); | ||||||
| } | } | ||||||
|  | @ -50,12 +71,20 @@ function checkEnabled( | ||||||
| ): boolean { | ): boolean { | ||||||
|     return Boolean(classid) && !isNaN(Number(groupNumber)) && !isNaN(Number(assignmentNumber)); |     return Boolean(classid) && !isNaN(Number(groupNumber)) && !isNaN(Number(assignmentNumber)); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | interface Values { | ||||||
|  |     cid: string | undefined; | ||||||
|  |     an: number | undefined; | ||||||
|  |     gn: number | undefined; | ||||||
|  |     f: boolean; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function toValues( | function toValues( | ||||||
|     classid: MaybeRefOrGetter<string | undefined>, |     classid: MaybeRefOrGetter<string | undefined>, | ||||||
|     assignmentNumber: MaybeRefOrGetter<number | undefined>, |     assignmentNumber: MaybeRefOrGetter<number | undefined>, | ||||||
|     groupNumber: MaybeRefOrGetter<number | undefined>, |     groupNumber: MaybeRefOrGetter<number | undefined>, | ||||||
|     full: MaybeRefOrGetter<boolean>, |     full: MaybeRefOrGetter<boolean>, | ||||||
| ) { | ): Values { | ||||||
|     return { cid: toValue(classid), an: toValue(assignmentNumber), gn: toValue(groupNumber), f: toValue(full) }; |     return { cid: toValue(classid), an: toValue(assignmentNumber), gn: toValue(groupNumber), f: toValue(full) }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -17,32 +17,51 @@ import { invalidateAllSubmissionKeys } from "./submissions"; | ||||||
| const classController = new ClassController(); | const classController = new ClassController(); | ||||||
| 
 | 
 | ||||||
| /* Query cache keys */ | /* Query cache keys */ | ||||||
| function classesQueryKey(full: boolean) { | type ClassesQueryKey = ["classes", boolean]; | ||||||
|  | 
 | ||||||
|  | function classesQueryKey(full: boolean): ClassesQueryKey { | ||||||
|     return ["classes", full]; |     return ["classes", full]; | ||||||
| } | } | ||||||
| function classQueryKey(classid: string) { | 
 | ||||||
|  | type ClassQueryKey = ["class", string]; | ||||||
|  | 
 | ||||||
|  | function classQueryKey(classid: string): ClassQueryKey { | ||||||
|     return ["class", classid]; |     return ["class", classid]; | ||||||
| } | } | ||||||
| function classStudentsKey(classid: string, full: boolean) { | 
 | ||||||
|  | type ClassStudentsKey = ["class-students", string, boolean]; | ||||||
|  | 
 | ||||||
|  | function classStudentsKey(classid: string, full: boolean): ClassStudentsKey { | ||||||
|     return ["class-students", classid, full]; |     return ["class-students", classid, full]; | ||||||
| } | } | ||||||
| function classTeachersKey(classid: string, full: boolean) { | 
 | ||||||
|  | type ClassTeachersKey = ["class-teachers", string, boolean]; | ||||||
|  | 
 | ||||||
|  | function classTeachersKey(classid: string, full: boolean): ClassTeachersKey { | ||||||
|     return ["class-teachers", classid, full]; |     return ["class-teachers", classid, full]; | ||||||
| } | } | ||||||
| function classTeacherInvitationsKey(classid: string, full: boolean) { | 
 | ||||||
|  | type ClassTeacherInvitationsKey = ["class-teacher-invitations", string, boolean]; | ||||||
|  | 
 | ||||||
|  | function classTeacherInvitationsKey(classid: string, full: boolean): ClassTeacherInvitationsKey { | ||||||
|     return ["class-teacher-invitations", classid, full]; |     return ["class-teacher-invitations", classid, full]; | ||||||
| } | } | ||||||
| function classAssignmentsKey(classid: string, full: boolean) { | 
 | ||||||
|  | type ClassAssignmentsKey = ["class-assignments", string, boolean]; | ||||||
|  | 
 | ||||||
|  | function classAssignmentsKey(classid: string, full: boolean): ClassAssignmentsKey { | ||||||
|     return ["class-assignments", classid, full]; |     return ["class-assignments", classid, full]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function invalidateAllClassKeys(queryClient: QueryClient, classid?: string) { | export async function invalidateAllClassKeys(queryClient: QueryClient, classid?: string): Promise<void> { | ||||||
|     const keys = ["class", "class-students", "class-teachers", "class-teacher-invitations", "class-assignments"]; |     const keys = ["class", "class-students", "class-teachers", "class-teacher-invitations", "class-assignments"]; | ||||||
| 
 | 
 | ||||||
|     for (const key of keys) { |     await Promise.all( | ||||||
|         const queryKey = [key, classid].filter((arg) => arg !== undefined); |         keys.map(async (key) => { | ||||||
|         await queryClient.invalidateQueries({ queryKey: queryKey }); |             const queryKey = [key, classid].filter((arg) => arg !== undefined); | ||||||
|     } |             return queryClient.invalidateQueries({ queryKey: queryKey }); | ||||||
|  |         }), | ||||||
|  |     ); | ||||||
| 
 | 
 | ||||||
|     await queryClient.invalidateQueries({ queryKey: ["classes"] }); |     await queryClient.invalidateQueries({ queryKey: ["classes"] }); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -5,24 +5,45 @@ import type { GroupDTO } from "@dwengo-1/common/interfaces/group"; | ||||||
| import { | import { | ||||||
|     QueryClient, |     QueryClient, | ||||||
|     useMutation, |     useMutation, | ||||||
|  |     type UseMutationReturnType, | ||||||
|     useQuery, |     useQuery, | ||||||
|     useQueryClient, |     useQueryClient, | ||||||
|     type UseMutationReturnType, |  | ||||||
|     type UseQueryReturnType, |     type UseQueryReturnType, | ||||||
| } from "@tanstack/vue-query"; | } from "@tanstack/vue-query"; | ||||||
| import { computed, toValue, type MaybeRefOrGetter } from "vue"; | import { computed, toValue, type MaybeRefOrGetter } from "vue"; | ||||||
| import { invalidateAllSubmissionKeys } from "./submissions"; | import { invalidateAllSubmissionKeys } from "./submissions"; | ||||||
| 
 | 
 | ||||||
| export function groupsQueryKey(classid: string, assignmentNumber: number, full: boolean) { | type GroupsQueryKey = ["groups", string, number, boolean]; | ||||||
|  | 
 | ||||||
|  | export function groupsQueryKey(classid: string, assignmentNumber: number, full: boolean): GroupsQueryKey { | ||||||
|     return ["groups", classid, assignmentNumber, full]; |     return ["groups", classid, assignmentNumber, full]; | ||||||
| } | } | ||||||
| function groupQueryKey(classid: string, assignmentNumber: number, groupNumber: number) { | 
 | ||||||
|  | type GroupQueryKey = ["group", string, number, number]; | ||||||
|  | 
 | ||||||
|  | function groupQueryKey(classid: string, assignmentNumber: number, groupNumber: number): GroupQueryKey { | ||||||
|     return ["group", classid, assignmentNumber, groupNumber]; |     return ["group", classid, assignmentNumber, groupNumber]; | ||||||
| } | } | ||||||
| function groupSubmissionsQueryKey(classid: string, assignmentNumber: number, groupNumber: number, full: boolean) { | 
 | ||||||
|  | type GroupSubmissionsQueryKey = ["group-submissions", string, number, number, boolean]; | ||||||
|  | 
 | ||||||
|  | function groupSubmissionsQueryKey( | ||||||
|  |     classid: string, | ||||||
|  |     assignmentNumber: number, | ||||||
|  |     groupNumber: number, | ||||||
|  |     full: boolean, | ||||||
|  | ): GroupSubmissionsQueryKey { | ||||||
|     return ["group-submissions", classid, assignmentNumber, groupNumber, full]; |     return ["group-submissions", classid, assignmentNumber, groupNumber, full]; | ||||||
| } | } | ||||||
| function groupQuestionsQueryKey(classid: string, assignmentNumber: number, groupNumber: number, full: boolean) { | 
 | ||||||
|  | type GroupQuestionsQueryKey = ["group-questions", string, number, number, boolean]; | ||||||
|  | 
 | ||||||
|  | function groupQuestionsQueryKey( | ||||||
|  |     classid: string, | ||||||
|  |     assignmentNumber: number, | ||||||
|  |     groupNumber: number, | ||||||
|  |     full: boolean, | ||||||
|  | ): GroupQuestionsQueryKey { | ||||||
|     return ["group-questions", classid, assignmentNumber, groupNumber, full]; |     return ["group-questions", classid, assignmentNumber, groupNumber, full]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -31,13 +52,14 @@ export async function invalidateAllGroupKeys( | ||||||
|     classid?: string, |     classid?: string, | ||||||
|     assignmentNumber?: number, |     assignmentNumber?: number, | ||||||
|     groupNumber?: number, |     groupNumber?: number, | ||||||
| ) { | ): Promise<void> { | ||||||
|     const keys = ["group", "group-submissions", "group-questions"]; |     const keys = ["group", "group-submissions", "group-questions"]; | ||||||
| 
 |     await Promise.all( | ||||||
|     for (const key of keys) { |         keys.map(async (key) => { | ||||||
|         const queryKey = [key, classid, assignmentNumber, groupNumber].filter((arg) => arg !== undefined); |             const queryKey = [key, classid, assignmentNumber, groupNumber].filter((arg) => arg !== undefined); | ||||||
|         await queryClient.invalidateQueries({ queryKey: queryKey }); |             return queryClient.invalidateQueries({ queryKey: queryKey }); | ||||||
|     } |         }), | ||||||
|  |     ); | ||||||
| 
 | 
 | ||||||
|     await queryClient.invalidateQueries({ |     await queryClient.invalidateQueries({ | ||||||
|         queryKey: ["groups", classid, assignmentNumber].filter((arg) => arg !== undefined), |         queryKey: ["groups", classid, assignmentNumber].filter((arg) => arg !== undefined), | ||||||
|  | @ -51,12 +73,20 @@ function checkEnabled( | ||||||
| ): boolean { | ): boolean { | ||||||
|     return Boolean(classid) && !isNaN(Number(groupNumber)) && !isNaN(Number(assignmentNumber)); |     return Boolean(classid) && !isNaN(Number(groupNumber)) && !isNaN(Number(assignmentNumber)); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | interface Values { | ||||||
|  |     cid: string | undefined; | ||||||
|  |     an: number | undefined; | ||||||
|  |     gn: number | undefined; | ||||||
|  |     f: boolean; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function toValues( | function toValues( | ||||||
|     classid: MaybeRefOrGetter<string | undefined>, |     classid: MaybeRefOrGetter<string | undefined>, | ||||||
|     assignmentNumber: MaybeRefOrGetter<number | undefined>, |     assignmentNumber: MaybeRefOrGetter<number | undefined>, | ||||||
|     groupNumber: MaybeRefOrGetter<number | undefined>, |     groupNumber: MaybeRefOrGetter<number | undefined>, | ||||||
|     full: MaybeRefOrGetter<boolean>, |     full: MaybeRefOrGetter<boolean>, | ||||||
| ) { | ): Values { | ||||||
|     return { cid: toValue(classid), an: toValue(assignmentNumber), gn: toValue(groupNumber), f: toValue(full) }; |     return { cid: toValue(classid), an: toValue(assignmentNumber), gn: toValue(groupNumber), f: toValue(full) }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -36,7 +36,7 @@ export async function invalidateAllSubmissionKeys( | ||||||
|     assignmentNumber?: number, |     assignmentNumber?: number, | ||||||
|     groupNumber?: number, |     groupNumber?: number, | ||||||
|     submissionNumber?: number, |     submissionNumber?: number, | ||||||
| ) { | ): Promise<void> { | ||||||
|     const keys = ["submission"]; |     const keys = ["submission"]; | ||||||
| 
 | 
 | ||||||
|     for (const key of keys) { |     for (const key of keys) { | ||||||
|  |  | ||||||
|  | @ -7,7 +7,6 @@ import CreateClass from "@/views/classes/CreateClass.vue"; | ||||||
| import CreateAssignment from "@/views/assignments/CreateAssignment.vue"; | import CreateAssignment from "@/views/assignments/CreateAssignment.vue"; | ||||||
| import CreateDiscussion from "@/views/discussions/CreateDiscussion.vue"; | import CreateDiscussion from "@/views/discussions/CreateDiscussion.vue"; | ||||||
| import CallbackPage from "@/views/CallbackPage.vue"; | import CallbackPage from "@/views/CallbackPage.vue"; | ||||||
| import UserDiscussions from "@/views/discussions/UserDiscussions.vue"; |  | ||||||
| import UserClasses from "@/views/classes/UserClasses.vue"; | import UserClasses from "@/views/classes/UserClasses.vue"; | ||||||
| import UserAssignments from "@/views/classes/UserAssignments.vue"; | import UserAssignments from "@/views/classes/UserAssignments.vue"; | ||||||
| import authState from "@/services/auth/auth-service.ts"; | import authState from "@/services/auth/auth-service.ts"; | ||||||
|  | @ -57,11 +56,12 @@ const router = createRouter({ | ||||||
|                     name: "UserClasses", |                     name: "UserClasses", | ||||||
|                     component: UserClasses, |                     component: UserClasses, | ||||||
|                 }, |                 }, | ||||||
|                 { |                 // TODO Re-enable this route when the discussion page is ready
 | ||||||
|                     path: "discussion", |                 // {
 | ||||||
|                     name: "UserDiscussions", |                 //     Path: "discussion",
 | ||||||
|                     component: UserDiscussions, |                 //     Name: "UserDiscussions",
 | ||||||
|                 }, |                 //     Component: UserDiscussions,
 | ||||||
|  |                 // },
 | ||||||
|             ], |             ], | ||||||
|         }, |         }, | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Gerald Schmittinger
						Gerald Schmittinger