style: fix linting issues met ESLint

This commit is contained in:
Lint Action 2025-04-01 16:39:26 +00:00
parent b556516359
commit df8f4043a8
5 changed files with 46 additions and 46 deletions

View file

@ -5,55 +5,55 @@ export class StudentController extends BaseController {
super("student");
}
getAll(full = true) {
async getAll(full = true) {
return this.get<{ students: any[] }>("/", { full });
}
getByUsername(username: string) {
async getByUsername(username: string) {
return this.get<{ student: any }>(`/${username}`);
}
createStudent(data: any) {
async createStudent(data: any) {
return this.post("/", data);
}
deleteStudent(username: string) {
async deleteStudent(username: string) {
return this.delete(`/${username}`);
}
getClasses(username: string, full = true) {
async getClasses(username: string, full = true) {
return this.get<{ classes: any[] }>(`/${username}/classes`, { full });
}
getAssignments(username: string, full = true) {
async getAssignments(username: string, full = true) {
return this.get<{ assignments: any[] }>(`/${username}/assignments`, { full });
}
getGroups(username: string, full = true) {
async getGroups(username: string, full = true) {
return this.get<{ groups: any[] }>(`/${username}/groups`, { full });
}
getSubmissions(username: string) {
async getSubmissions(username: string) {
return this.get<{ submissions: any[] }>(`/${username}/submissions`);
}
getQuestions(username: string, full = true) {
async getQuestions(username: string, full = true) {
return this.get<{ questions: any[] }>(`/${username}/questions`, { full });
}
getJoinRequests(username: string) {
async getJoinRequests(username: string) {
return this.get<{ requests: any[] }>(`/${username}/joinRequests`);
}
getJoinRequest(username: string, classId: string) {
async getJoinRequest(username: string, classId: string) {
return this.get<{ request: any[] }>(`/${username}/joinRequests/${classId}`);
}
createJoinRequest(username: string, classId: string) {
async createJoinRequest(username: string, classId: string) {
return this.post(`/${username}/joinRequests}`, classId);
}
deleteJoinRequest(username: string, classId: string) {
async deleteJoinRequest(username: string, classId: string) {
return this.delete(`/${username}/joinRequests/${classId}`);
}
}

View file

@ -5,39 +5,39 @@ export class TeacherController extends BaseController {
super("teacher");
}
getAll(full = false) {
async getAll(full = false) {
return this.get<{ teachers: any[] }>("/", { full });
}
getByUsername(username: string) {
async getByUsername(username: string) {
return this.get<any>(`/${username}`);
}
createTeacher(data: any) {
async createTeacher(data: any) {
return this.post("/", data);
}
deleteTeacher(username: string) {
async deleteTeacher(username: string) {
return this.delete(`/${username}`);
}
getClasses(username: string, full = false) {
async getClasses(username: string, full = false) {
return this.get<any[]>(`/${username}/classes`, { full });
}
getStudents(username: string, full = false) {
async getStudents(username: string, full = false) {
return this.get<{ students: any[] }>(`/${username}/students`, { full });
}
getQuestions(username: string, full = false) {
async getQuestions(username: string, full = false) {
return this.get<{ questions: any[] }>(`/${username}/questions`, { full });
}
getStudentJoinRequests(username: string, classId: string) {
async getStudentJoinRequests(username: string, classId: string) {
return this.get<{ joinRequests: any[] }>(`/${username}/joinRequests/${classId}`);
}
updateStudentJoinRequest(teacherUsername: string, classId: string, studentUsername: string, accepted: boolean) {
async updateStudentJoinRequest(teacherUsername: string, classId: string, studentUsername: string, accepted: boolean) {
return this.put(`/${teacherUsername}/joinRequests/${classId}/${studentUsername}`, accepted);
}

View file

@ -18,14 +18,14 @@ const STUDENT_JOIN_REQUESTS_QUERY_KEY = (username: string) => ["student-join-req
export function useStudentsQuery(full: MaybeRefOrGetter<boolean> = true) {
return useQuery({
queryKey: computed(() => STUDENTS_QUERY_KEY(toValue(full))),
queryFn: () => studentController.getAll(toValue(full)),
queryFn: async () => studentController.getAll(toValue(full)),
});
}
export function useStudentQuery(username: MaybeRefOrGetter<string | undefined>) {
return useQuery({
queryKey: computed(() => STUDENT_QUERY_KEY(toValue(username)!)),
queryFn: () => studentController.getByUsername(toValue(username)!),
queryFn: async () => studentController.getByUsername(toValue(username)!),
enabled: () => Boolean(toValue(username)),
});
}
@ -36,7 +36,7 @@ export function useStudentClassesQuery(
) {
return useQuery({
queryKey: computed(() => STUDENT_CLASSES_QUERY_KEY(toValue(username)!, toValue(full))),
queryFn: () => studentController.getClasses(toValue(username)!, toValue(full)),
queryFn: async () => studentController.getClasses(toValue(username)!, toValue(full)),
enabled: () => Boolean(toValue(username)),
});
}
@ -47,7 +47,7 @@ export function useStudentAssignmentsQuery(
) {
return useQuery({
queryKey: computed(() => STUDENT_ASSIGNMENTS_QUERY_KEY(toValue(username)!, toValue(full))),
queryFn: () => studentController.getAssignments(toValue(username)!, toValue(full)),
queryFn: async () => studentController.getAssignments(toValue(username)!, toValue(full)),
enabled: () => Boolean(toValue(username)),
});
}
@ -58,7 +58,7 @@ export function useStudentGroupsQuery(
) {
return useQuery({
queryKey: computed(() => STUDENT_GROUPS_QUERY_KEY(toValue(username)!, toValue(full))),
queryFn: () => studentController.getGroups(toValue(username)!, toValue(full)),
queryFn: async () => studentController.getGroups(toValue(username)!, toValue(full)),
enabled: () => Boolean(toValue(username)),
});
}
@ -66,7 +66,7 @@ export function useStudentGroupsQuery(
export function useStudentSubmissionsQuery(username: MaybeRefOrGetter<string | undefined>) {
return useQuery({
queryKey: computed(() => STUDENT_SUBMISSIONS_QUERY_KEY(toValue(username)!)),
queryFn: () => studentController.getSubmissions(toValue(username)!),
queryFn: async () => studentController.getSubmissions(toValue(username)!),
enabled: () => Boolean(toValue(username)),
});
}
@ -77,7 +77,7 @@ export function useStudentQuestionsQuery(
) {
return useQuery({
queryKey: computed(() => STUDENT_QUESTIONS_QUERY_KEY(toValue(username)!, toValue(full))),
queryFn: () => studentController.getQuestions(toValue(username)!, toValue(full)),
queryFn: async () => studentController.getQuestions(toValue(username)!, toValue(full)),
enabled: () => Boolean(toValue(username)),
});
}
@ -86,7 +86,7 @@ export function useCreateStudentMutation() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (data: any) => studentController.createStudent(data),
mutationFn: async (data: any) => studentController.createStudent(data),
onSuccess: () => {
await queryClient.invalidateQueries({ queryKey: ["students"] });
},
@ -103,7 +103,7 @@ export function useDeleteStudentMutation() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (username: string) => studentController.deleteStudent(username),
mutationFn: async (username: string) => studentController.deleteStudent(username),
onSuccess: () => {
await queryClient.invalidateQueries({ queryKey: ["students"] });
},
@ -116,7 +116,7 @@ export function useDeleteStudentMutation() {
export function useStudentJoinRequestsQuery(username: MaybeRefOrGetter<string | undefined>) {
return useQuery({
queryKey: computed(() => STUDENT_JOIN_REQUESTS_QUERY_KEY(toValue(username)!)),
queryFn: () => studentController.getJoinRequests(toValue(username)!),
queryFn: async () => studentController.getJoinRequests(toValue(username)!),
enabled: () => Boolean(toValue(username)),
});
}
@ -127,7 +127,7 @@ export function useStudentJoinRequestQuery(
) {
return useQuery({
queryKey: computed(() => STUDENT_JOIN_REQUESTS_QUERY_KEY(toValue(username)!)),
queryFn: () => studentController.getJoinRequest(toValue(username)!, toValue(classId)!),
queryFn: async () => studentController.getJoinRequest(toValue(username)!, toValue(classId)!),
enabled: () => Boolean(toValue(username)),
});
}
@ -139,7 +139,7 @@ export function useCreateJoinRequestMutation() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({ username, classId }: { username: string; classId: string }) =>
mutationFn: async ({ username, classId }: { username: string; classId: string }) =>
studentController.createJoinRequest(username, classId),
onSuccess: (_, { username }) => {
await queryClient.invalidateQueries({ queryKey: STUDENT_JOIN_REQUESTS_QUERY_KEY(username) });
@ -157,7 +157,7 @@ export function useDeleteJoinRequestMutation() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({ username, classId }: { username: string; classId: string }) =>
mutationFn: async ({ username, classId }: { username: string; classId: string }) =>
studentController.deleteJoinRequest(username, classId),
onSuccess: (_, { username }) => {
await queryClient.invalidateQueries({ queryKey: STUDENT_JOIN_REQUESTS_QUERY_KEY(username) });

View file

@ -16,14 +16,14 @@ const JOIN_REQUESTS_QUERY_KEY = (username: string, classId: string) => ["join-re
export function useTeachersQuery(full: MaybeRefOrGetter<boolean> = false) {
return useQuery({
queryKey: computed(() => TEACHERS_QUERY_KEY(toValue(full))),
queryFn: () => teacherController.getAll(toValue(full)),
queryFn: async () => teacherController.getAll(toValue(full)),
});
}
export function useTeacherQuery(username: MaybeRefOrGetter<string | undefined>) {
return useQuery({
queryKey: computed(() => TEACHER_QUERY_KEY(toValue(username)!)),
queryFn: () => teacherController.getByUsername(toValue(username)!),
queryFn: async () => teacherController.getByUsername(toValue(username)!),
enabled: () => Boolean(toValue(username)),
});
}
@ -34,7 +34,7 @@ export function useTeacherClassesQuery(
) {
return useQuery({
queryKey: computed(() => TEACHER_CLASSES_QUERY_KEY(toValue(username)!, toValue(full))),
queryFn: () => teacherController.getClasses(toValue(username)!, toValue(full)),
queryFn: async () => teacherController.getClasses(toValue(username)!, toValue(full)),
enabled: () => Boolean(toValue(username)),
});
}
@ -45,7 +45,7 @@ export function useTeacherStudentsQuery(
) {
return useQuery({
queryKey: computed(() => TEACHER_STUDENTS_QUERY_KEY(toValue(username)!, toValue(full))),
queryFn: () => teacherController.getStudents(toValue(username)!, toValue(full)),
queryFn: async () => teacherController.getStudents(toValue(username)!, toValue(full)),
enabled: () => Boolean(toValue(username)),
});
}
@ -56,7 +56,7 @@ export function useTeacherQuestionsQuery(
) {
return useQuery({
queryKey: computed(() => TEACHER_QUESTIONS_QUERY_KEY(toValue(username)!, toValue(full))),
queryFn: () => teacherController.getQuestions(toValue(username)!, toValue(full)),
queryFn: async () => teacherController.getQuestions(toValue(username)!, toValue(full)),
enabled: () => Boolean(toValue(username)),
});
}
@ -67,7 +67,7 @@ export function useTeacherJoinRequestsQuery(
) {
return useQuery({
queryKey: computed(() => JOIN_REQUESTS_QUERY_KEY(toValue(username)!, toValue(classId)!)),
queryFn: () => teacherController.getStudentJoinRequests(toValue(username)!, toValue(classId)!),
queryFn: async () => teacherController.getStudentJoinRequests(toValue(username)!, toValue(classId)!),
enabled: () => Boolean(toValue(username)) && Boolean(toValue(classId)),
});
}
@ -76,7 +76,7 @@ export function useCreateTeacherMutation() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (data: any) => teacherController.createTeacher(data),
mutationFn: async (data: any) => teacherController.createTeacher(data),
onSuccess: () => {
await queryClient.invalidateQueries({ queryKey: ["teachers"] });
},
@ -90,7 +90,7 @@ export function useDeleteTeacherMutation() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (username: string) => teacherController.deleteTeacher(username),
mutationFn: async (username: string) => teacherController.deleteTeacher(username),
onSuccess: () => {
await queryClient.invalidateQueries({ queryKey: ["teachers"] });
},
@ -104,7 +104,7 @@ export function useUpdateJoinRequestMutation() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({
mutationFn: async ({
teacherUsername,
classId,
studentUsername,

View file

@ -7,7 +7,7 @@ const themeController = new ThemeController();
export function useThemeQuery(language: MaybeRefOrGetter<string | undefined>) {
return useQuery({
queryKey: ["themes", language],
queryFn: () => {
queryFn: async () => {
const lang = toValue(language);
return themeController.getAll(lang);
},
@ -18,7 +18,7 @@ export function useThemeQuery(language: MaybeRefOrGetter<string | undefined>) {
export function useThemeHruidsQuery(themeKey: MaybeRefOrGetter<string | undefined>) {
return useQuery({
queryKey: ["theme-hruids", themeKey],
queryFn: () => themeController.getHruidsByKey(toValue(themeKey)!),
queryFn: async () => themeController.getHruidsByKey(toValue(themeKey)!),
enabled: Boolean(themeKey),
});
}