feat: teacher's assignments full stack geimplementeerd
This commit is contained in:
parent
509dd6bfab
commit
c03669eda7
5 changed files with 49 additions and 0 deletions
|
@ -13,6 +13,7 @@ import type { JoinRequestResponse, JoinRequestsResponse, StudentsResponse } from
|
|||
import type { QuestionsResponse } from "@/controllers/questions.ts";
|
||||
import type { TeacherDTO } from "@dwengo-1/common/interfaces/teacher";
|
||||
import { studentJoinRequestQueryKey, studentJoinRequestsQueryKey } from "@/queries/students.ts";
|
||||
import type { AssignmentResponse, AssignmentsResponse } from "@/controllers/assignments";
|
||||
|
||||
const teacherController = new TeacherController();
|
||||
|
||||
|
@ -29,6 +30,10 @@ function teacherClassesQueryKey(username: string, full: boolean): [string, strin
|
|||
return ["teacher-classes", username, full];
|
||||
}
|
||||
|
||||
function teacherAssignmentsQueryKey(username: string, full: boolean): [string, string, boolean] {
|
||||
return ["teacher-assignments", username, full];
|
||||
}
|
||||
|
||||
function teacherStudentsQueryKey(username: string, full: boolean): [string, string, boolean] {
|
||||
return ["teacher-students", username, full];
|
||||
}
|
||||
|
@ -69,6 +74,17 @@ export function useTeacherClassesQuery(
|
|||
});
|
||||
}
|
||||
|
||||
export function useTeacherAssignmentsQuery(
|
||||
username: MaybeRefOrGetter<string | undefined>,
|
||||
full: MaybeRefOrGetter<boolean> = false,
|
||||
): UseQueryReturnType<AssignmentsResponse, Error> {
|
||||
return useQuery({
|
||||
queryKey: computed(() => teacherAssignmentsQueryKey(toValue(username)!, toValue(full))),
|
||||
queryFn: async () => teacherController.getAssignments(toValue(username)!, toValue(full)),
|
||||
enabled: () => Boolean(toValue(username)),
|
||||
});
|
||||
}
|
||||
|
||||
export function useTeacherStudentsQuery(
|
||||
username: MaybeRefOrGetter<string | undefined>,
|
||||
full: MaybeRefOrGetter<boolean> = false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue