fix: lint
This commit is contained in:
parent
17dc9649c5
commit
a824cdff94
6 changed files with 5 additions and 11 deletions
|
@ -1,5 +1,4 @@
|
||||||
import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity.js';
|
import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity.js';
|
||||||
import { mapToClassDTO } from './class.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";
|
||||||
|
|
|
@ -50,7 +50,7 @@ async function fetchInvitation(sender: Teacher, receiver: Teacher, cls: Class):
|
||||||
return invite;
|
return invite;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteInvitationFor(usernameSender: string, usernameReceiver: string, classId: string, accepted: boolean) {
|
export async function deleteInvitationFor(usernameSender: string, usernameReceiver: string, classId: string, accepted: boolean): Promise<TeacherInvitationDTO> {
|
||||||
const teacherInvitationRepository = getTeacherInvitationRepository();
|
const teacherInvitationRepository = getTeacherInvitationRepository();
|
||||||
const sender = await fetchTeacher(usernameSender);
|
const sender = await fetchTeacher(usernameSender);
|
||||||
const receiver = await fetchTeacher(usernameReceiver);
|
const receiver = await fetchTeacher(usernameReceiver);
|
||||||
|
|
|
@ -42,9 +42,6 @@ export async function setupTestApp(): Promise<void> {
|
||||||
const answers = makeTestAnswers(em, teachers, questions);
|
const answers = makeTestAnswers(em, teachers, questions);
|
||||||
const submissions = makeTestSubmissions(em, students, groups);
|
const submissions = makeTestSubmissions(em, students, groups);
|
||||||
|
|
||||||
console.log("classes", classes);
|
|
||||||
console.log("invitations", teacherInvitations);
|
|
||||||
|
|
||||||
await em.persistAndFlush([
|
await em.persistAndFlush([
|
||||||
...students,
|
...students,
|
||||||
...teachers,
|
...teachers,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { UserDTO } from './user';
|
import { UserDTO } from './user';
|
||||||
import { ClassDTO } from './class';
|
|
||||||
|
|
||||||
export interface TeacherInvitationDTO {
|
export interface TeacherInvitationDTO {
|
||||||
sender: string | UserDTO;
|
sender: string | UserDTO;
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { BaseController } from "./base-controller";
|
||||||
import type { ClassDTO } from "@dwengo-1/common/interfaces/class";
|
import type { ClassDTO } from "@dwengo-1/common/interfaces/class";
|
||||||
import type { StudentsResponse } from "./students";
|
import type { StudentsResponse } from "./students";
|
||||||
import type { AssignmentsResponse } from "./assignments";
|
import type { AssignmentsResponse } from "./assignments";
|
||||||
import type { TeacherInvitationDTO } from "@dwengo-1/common/interfaces/teacher-invitation";
|
|
||||||
import type { TeachersResponse } from "@/controllers/teachers.ts";
|
import type { TeachersResponse } from "@/controllers/teachers.ts";
|
||||||
import type {TeacherInvitationsResponse} from "@/controllers/teacher-invitations.ts";
|
import type {TeacherInvitationsResponse} from "@/controllers/teacher-invitations.ts";
|
||||||
|
|
||||||
|
|
|
@ -17,23 +17,23 @@ import type {TeacherDTO} from "@dwengo-1/common/dist/interfaces/teacher.ts";
|
||||||
const controller = new TeacherInvitationController();
|
const controller = new TeacherInvitationController();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
all the invitations the teacher send
|
All the invitations the teacher send
|
||||||
**/
|
**/
|
||||||
export function useTeacherInvitationsByQuery(username: MaybeRefOrGetter<string | undefined>
|
export function useTeacherInvitationsByQuery(username: MaybeRefOrGetter<string | undefined>
|
||||||
): UseQueryReturnType<TeacherInvitationsResponse, Error> {
|
): UseQueryReturnType<TeacherInvitationsResponse, Error> {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryFn: computed(() => controller.getAll(toValue(username), true)),
|
queryFn: computed(async () => controller.getAll(toValue(username), true)),
|
||||||
enabled: () => Boolean(toValue(username)),
|
enabled: () => Boolean(toValue(username)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
all the pending invitations send to this teacher
|
All the pending invitations send to this teacher
|
||||||
*/
|
*/
|
||||||
export function useTeacherInvitationsForQuery(username: MaybeRefOrGetter<string | undefined>
|
export function useTeacherInvitationsForQuery(username: MaybeRefOrGetter<string | undefined>
|
||||||
): UseQueryReturnType<TeacherInvitationsResponse, Error> {
|
): UseQueryReturnType<TeacherInvitationsResponse, Error> {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryFn: computed(() => controller.getAll(toValue(username), false)),
|
queryFn: computed(async () => controller.getAll(toValue(username), false)),
|
||||||
enabled: () => Boolean(toValue(username)),
|
enabled: () => Boolean(toValue(username)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue