style(frontend): Linting

This commit is contained in:
Tibo De Peuter 2025-04-17 09:53:03 +02:00
parent bb0a5273dc
commit 12005d197c
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
6 changed files with 168 additions and 95 deletions

View file

@ -17,32 +17,51 @@ import { invalidateAllSubmissionKeys } from "./submissions";
const classController = new ClassController();
/* Query cache keys */
function classesQueryKey(full: boolean) {
type ClassesQueryKey = ["classes", boolean];
function classesQueryKey(full: boolean): ClassesQueryKey {
return ["classes", full];
}
function classQueryKey(classid: string) {
type ClassQueryKey = ["class", string];
function classQueryKey(classid: string): ClassQueryKey {
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];
}
function classTeachersKey(classid: string, full: boolean) {
type ClassTeachersKey = ["class-teachers", string, boolean];
function classTeachersKey(classid: string, full: boolean): ClassTeachersKey {
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];
}
function classAssignmentsKey(classid: string, full: boolean) {
type ClassAssignmentsKey = ["class-assignments", string, boolean];
function classAssignmentsKey(classid: string, full: boolean): ClassAssignmentsKey {
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"];
for (const key of keys) {
const queryKey = [key, classid].filter((arg) => arg !== undefined);
await queryClient.invalidateQueries({ queryKey: queryKey });
}
await Promise.all(
keys.map(async (key) => {
const queryKey = [key, classid].filter((arg) => arg !== undefined);
return queryClient.invalidateQueries({ queryKey: queryKey });
})
);
await queryClient.invalidateQueries({ queryKey: ["classes"] });
}