style: fix linting issues met Prettier
This commit is contained in:
parent
a824cdff94
commit
783c91b2e3
11 changed files with 112 additions and 93 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { Request, Response } from 'express';
|
import { Request, Response } from 'express';
|
||||||
import {requireFields} from "./error-helper";
|
import { requireFields } from './error-helper';
|
||||||
import {createInvitation, deleteInvitationFor, getAllInvitations} from "../services/teacher-invitations";
|
import { createInvitation, deleteInvitationFor, getAllInvitations } from '../services/teacher-invitations';
|
||||||
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> {
|
||||||
const username = req.params.username;
|
const username = req.params.username;
|
||||||
|
|
|
@ -25,6 +25,6 @@ export class TeacherInvitationRepository extends DwengoEntityRepository<TeacherI
|
||||||
sender: sender,
|
sender: sender,
|
||||||
receiver: receiver,
|
receiver: receiver,
|
||||||
class: clazz,
|
class: clazz,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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';
|
||||||
import {Teacher} from "../entities/users/teacher.entity";
|
import { Teacher } from '../entities/users/teacher.entity';
|
||||||
import {Class} from "../entities/classes/class.entity";
|
import { Class } from '../entities/classes/class.entity';
|
||||||
|
|
||||||
export function mapToTeacherInvitationDTO(invitation: TeacherInvitation): TeacherInvitationDTO {
|
export function mapToTeacherInvitationDTO(invitation: TeacherInvitation): TeacherInvitationDTO {
|
||||||
return {
|
return {
|
||||||
|
@ -23,6 +23,8 @@ export function mapToTeacherInvitationDTOIds(invitation: TeacherInvitation): Tea
|
||||||
|
|
||||||
export function mapToInvitation(sender: Teacher, receiver: Teacher, cls: Class): TeacherInvitation {
|
export function mapToInvitation(sender: Teacher, receiver: Teacher, cls: Class): TeacherInvitation {
|
||||||
return getTeacherInvitationRepository().create({
|
return getTeacherInvitationRepository().create({
|
||||||
sender, receiver, class: cls
|
sender,
|
||||||
|
receiver,
|
||||||
|
class: cls,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
import express from "express";
|
import express from 'express';
|
||||||
import {
|
import { createInvitationHandler, deleteInvitationForHandler, getAllInvitationsHandler } from '../controllers/teacher-invitations';
|
||||||
createInvitationHandler,
|
|
||||||
deleteInvitationForHandler,
|
|
||||||
getAllInvitationsHandler
|
|
||||||
} from "../controllers/teacher-invitations";
|
|
||||||
|
|
||||||
const router = express.Router({ mergeParams: true });
|
const router = express.Router({ mergeParams: true });
|
||||||
|
|
||||||
|
@ -13,5 +9,4 @@ router.post('/', createInvitationHandler);
|
||||||
|
|
||||||
router.delete('/:sender/:receiver/:classId', deleteInvitationForHandler);
|
router.delete('/:sender/:receiver/:classId', deleteInvitationForHandler);
|
||||||
|
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import {fetchTeacher} from "./teachers";
|
import { fetchTeacher } from './teachers';
|
||||||
import {getTeacherInvitationRepository} from "../data/repositories";
|
import { getTeacherInvitationRepository } from '../data/repositories';
|
||||||
import {mapToInvitation, mapToTeacherInvitationDTO} from "../interfaces/teacher-invitation";
|
import { mapToInvitation, mapToTeacherInvitationDTO } from '../interfaces/teacher-invitation';
|
||||||
import {addClassTeacher, fetchClass} from "./classes";
|
import { addClassTeacher, fetchClass } from './classes';
|
||||||
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';
|
||||||
import {Teacher} from "../entities/users/teacher.entity";
|
import { Teacher } from '../entities/users/teacher.entity';
|
||||||
import {Class} from "../entities/classes/class.entity";
|
import { Class } from '../entities/classes/class.entity';
|
||||||
import {NotFoundException} from "../exceptions/not-found-exception";
|
import { NotFoundException } from '../exceptions/not-found-exception';
|
||||||
import {TeacherInvitation} from "../entities/classes/teacher-invitation.entity";
|
import { TeacherInvitation } from '../entities/classes/teacher-invitation.entity';
|
||||||
|
|
||||||
export async function getAllInvitations(username: string, by: boolean): Promise<TeacherInvitationDTO[]> {
|
export async function getAllInvitations(username: string, by: boolean): Promise<TeacherInvitationDTO[]> {
|
||||||
const teacher = await fetchTeacher(username);
|
const teacher = await fetchTeacher(username);
|
||||||
|
@ -29,12 +29,12 @@ export async function createInvitation(data: TeacherInvitationData): Promise<Tea
|
||||||
|
|
||||||
const cls = await fetchClass(data.class);
|
const cls = await fetchClass(data.class);
|
||||||
|
|
||||||
if (!cls.teachers.contains(sender)){
|
if (!cls.teachers.contains(sender)) {
|
||||||
throw new ConflictException("The teacher sending the invite is not part of the class");
|
throw new ConflictException('The teacher sending the invite is not part of the class');
|
||||||
}
|
}
|
||||||
|
|
||||||
const newInvitation = mapToInvitation(sender, receiver, cls);
|
const newInvitation = mapToInvitation(sender, receiver, cls);
|
||||||
await teacherInvitationRepository.save(newInvitation, {preventOverwrite: true});
|
await teacherInvitationRepository.save(newInvitation, { preventOverwrite: true });
|
||||||
|
|
||||||
return mapToTeacherInvitationDTO(newInvitation);
|
return mapToTeacherInvitationDTO(newInvitation);
|
||||||
}
|
}
|
||||||
|
@ -43,14 +43,19 @@ async function fetchInvitation(sender: Teacher, receiver: Teacher, cls: Class):
|
||||||
const teacherInvitationRepository = getTeacherInvitationRepository();
|
const teacherInvitationRepository = getTeacherInvitationRepository();
|
||||||
const invite = await teacherInvitationRepository.findBy(cls, sender, receiver);
|
const invite = await teacherInvitationRepository.findBy(cls, sender, receiver);
|
||||||
|
|
||||||
if (!invite){
|
if (!invite) {
|
||||||
throw new NotFoundException("Teacher invite not found");
|
throw new NotFoundException('Teacher invite not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
return invite;
|
return invite;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deleteInvitationFor(usernameSender: string, usernameReceiver: string, classId: string, accepted: boolean): Promise<TeacherInvitationDTO> {
|
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);
|
||||||
|
@ -60,12 +65,9 @@ export async function deleteInvitationFor(usernameSender: string, usernameReceiv
|
||||||
const invitation = await fetchInvitation(sender, receiver, cls);
|
const invitation = await fetchInvitation(sender, receiver, cls);
|
||||||
await teacherInvitationRepository.deleteBy(cls, sender, receiver);
|
await teacherInvitationRepository.deleteBy(cls, sender, receiver);
|
||||||
|
|
||||||
if (accepted){
|
if (accepted) {
|
||||||
await addClassTeacher(classId, usernameReceiver);
|
await addClassTeacher(classId, usernameReceiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapToTeacherInvitationDTO(invitation);
|
return mapToTeacherInvitationDTO(invitation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
import { beforeAll, beforeEach, describe, expect, it, Mock, vi } from 'vitest';
|
import { beforeAll, beforeEach, describe, expect, it, Mock, vi } from 'vitest';
|
||||||
import { Request, Response } from 'express';
|
import { Request, Response } from 'express';
|
||||||
import { setupTestApp } from '../setup-tests.js';
|
import { setupTestApp } from '../setup-tests.js';
|
||||||
import {
|
import { createInvitationHandler, deleteInvitationForHandler, getAllInvitationsHandler } from '../../src/controllers/teacher-invitations';
|
||||||
createInvitationHandler,
|
import { TeacherInvitationData } from '@dwengo-1/common/interfaces/teacher-invitation';
|
||||||
deleteInvitationForHandler,
|
import { getClassHandler } from '../../src/controllers/classes';
|
||||||
getAllInvitationsHandler
|
|
||||||
} from "../../src/controllers/teacher-invitations";
|
|
||||||
import {TeacherInvitationData} from "@dwengo-1/common/interfaces/teacher-invitation";
|
|
||||||
import {getClassHandler} from "../../src/controllers/classes";
|
|
||||||
|
|
||||||
describe('Teacher controllers', () => {
|
describe('Teacher controllers', () => {
|
||||||
let req: Partial<Request>;
|
let req: Partial<Request>;
|
||||||
|
@ -27,22 +23,22 @@ describe('Teacher controllers', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Get teacher invitations by', async () => {
|
it('Get teacher invitations by', async () => {
|
||||||
req = {params: {username: 'LimpBizkit'}, query: {by: 'true' }};
|
req = { params: { username: 'LimpBizkit' }, query: { by: 'true' } };
|
||||||
|
|
||||||
await getAllInvitationsHandler(req as Request, res as Response);
|
await getAllInvitationsHandler(req as Request, res as Response);
|
||||||
|
|
||||||
expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({invitations: expect.anything()}));
|
expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({ invitations: expect.anything() }));
|
||||||
|
|
||||||
const result = jsonMock.mock.lastCall?.[0];
|
const result = jsonMock.mock.lastCall?.[0];
|
||||||
expect(result.invitations).to.have.length.greaterThan(0);
|
expect(result.invitations).to.have.length.greaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Get teacher invitations for', async () => {
|
it('Get teacher invitations for', async () => {
|
||||||
req = {params: {username: 'FooFighters'}, query: {by: 'false' }};
|
req = { params: { username: 'FooFighters' }, query: { by: 'false' } };
|
||||||
|
|
||||||
await getAllInvitationsHandler(req as Request, res as Response);
|
await getAllInvitationsHandler(req as Request, res as Response);
|
||||||
|
|
||||||
expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({invitations: expect.anything()}));
|
expect(jsonMock).toHaveBeenCalledWith(expect.objectContaining({ invitations: expect.anything() }));
|
||||||
|
|
||||||
const result = jsonMock.mock.lastCall?.[0];
|
const result = jsonMock.mock.lastCall?.[0];
|
||||||
expect(result.invitations).to.have.length.greaterThan(0);
|
expect(result.invitations).to.have.length.greaterThan(0);
|
||||||
|
@ -50,8 +46,9 @@ describe('Teacher controllers', () => {
|
||||||
|
|
||||||
it('Create and delete invitation', async () => {
|
it('Create and delete invitation', async () => {
|
||||||
const body = {
|
const body = {
|
||||||
sender: 'LimpBizkit', receiver: 'testleerkracht1',
|
sender: 'LimpBizkit',
|
||||||
class: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89'
|
receiver: 'testleerkracht1',
|
||||||
|
class: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89',
|
||||||
} as TeacherInvitationData;
|
} as TeacherInvitationData;
|
||||||
req = { body };
|
req = { body };
|
||||||
|
|
||||||
|
@ -59,9 +56,11 @@ describe('Teacher controllers', () => {
|
||||||
|
|
||||||
req = {
|
req = {
|
||||||
params: {
|
params: {
|
||||||
sender: 'LimpBizkit', receiver: 'testleerkracht1',
|
sender: 'LimpBizkit',
|
||||||
classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89'
|
receiver: 'testleerkracht1',
|
||||||
}, body: { accepted: 'false' }
|
classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89',
|
||||||
|
},
|
||||||
|
body: { accepted: 'false' },
|
||||||
};
|
};
|
||||||
|
|
||||||
await deleteInvitationForHandler(req as Request, res as Response);
|
await deleteInvitationForHandler(req as Request, res as Response);
|
||||||
|
@ -69,8 +68,9 @@ describe('Teacher controllers', () => {
|
||||||
|
|
||||||
it('Create and accept invitation', async () => {
|
it('Create and accept invitation', async () => {
|
||||||
const body = {
|
const body = {
|
||||||
sender: 'LimpBizkit', receiver: 'testleerkracht1',
|
sender: 'LimpBizkit',
|
||||||
class: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89'
|
receiver: 'testleerkracht1',
|
||||||
|
class: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89',
|
||||||
} as TeacherInvitationData;
|
} as TeacherInvitationData;
|
||||||
req = { body };
|
req = { body };
|
||||||
|
|
||||||
|
@ -78,16 +78,20 @@ describe('Teacher controllers', () => {
|
||||||
|
|
||||||
req = {
|
req = {
|
||||||
params: {
|
params: {
|
||||||
sender: 'LimpBizkit', receiver: 'testleerkracht1',
|
sender: 'LimpBizkit',
|
||||||
classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89'
|
receiver: 'testleerkracht1',
|
||||||
}, body: { accepted: 'true' }
|
classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89',
|
||||||
|
},
|
||||||
|
body: { accepted: 'true' },
|
||||||
};
|
};
|
||||||
|
|
||||||
await deleteInvitationForHandler(req as Request, res as Response);
|
await deleteInvitationForHandler(req as Request, res as Response);
|
||||||
|
|
||||||
req = {params: {
|
req = {
|
||||||
id: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89'
|
params: {
|
||||||
}};
|
id: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
await getClassHandler(req as Request, res as Response);
|
await getClassHandler(req as Request, res as Response);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { makeTestAttachments } from './test_assets/content/attachments.testdata.
|
||||||
import { makeTestQuestions } from './test_assets/questions/questions.testdata.js';
|
import { makeTestQuestions } from './test_assets/questions/questions.testdata.js';
|
||||||
import { makeTestAnswers } from './test_assets/questions/answers.testdata.js';
|
import { makeTestAnswers } from './test_assets/questions/answers.testdata.js';
|
||||||
import { makeTestSubmissions } from './test_assets/assignments/submission.testdata.js';
|
import { makeTestSubmissions } from './test_assets/assignments/submission.testdata.js';
|
||||||
import {Collection} from "@mikro-orm/core";
|
import { Collection } from '@mikro-orm/core';
|
||||||
|
|
||||||
export async function setupTestApp(): Promise<void> {
|
export async function setupTestApp(): Promise<void> {
|
||||||
dotenv.config({ path: '.env.test' });
|
dotenv.config({ path: '.env.test' });
|
||||||
|
|
|
@ -3,7 +3,7 @@ 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 { 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";
|
||||||
|
|
||||||
export interface ClassesResponse {
|
export interface ClassesResponse {
|
||||||
classes: ClassDTO[] | string[];
|
classes: ClassDTO[] | string[];
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import {BaseController} from "@/controllers/base-controller.ts";
|
import { BaseController } from "@/controllers/base-controller.ts";
|
||||||
import type {TeacherInvitationData, TeacherInvitationDTO} from "@dwengo-1/common/interfaces/teacher-invitation";
|
import type { TeacherInvitationData, TeacherInvitationDTO } from "@dwengo-1/common/interfaces/teacher-invitation";
|
||||||
|
|
||||||
export interface TeacherInvitationsResponse {
|
export interface TeacherInvitationsResponse {
|
||||||
invitations: TeacherInvitationDTO[]
|
invitations: TeacherInvitationDTO[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TeacherInvitationResponse {
|
export interface TeacherInvitationResponse {
|
||||||
invitation: TeacherInvitationDTO
|
invitation: TeacherInvitationDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TeacherInvitationController extends BaseController {
|
export class TeacherInvitationController extends BaseController {
|
||||||
|
|
|
@ -1,65 +1,80 @@
|
||||||
import {
|
import { useMutation, useQuery, type UseMutationReturnType, type UseQueryReturnType } from "@tanstack/vue-query";
|
||||||
useMutation,
|
|
||||||
useQuery,
|
|
||||||
type UseMutationReturnType,
|
|
||||||
type UseQueryReturnType,
|
|
||||||
} from "@tanstack/vue-query";
|
|
||||||
import { computed, toValue } from "vue";
|
import { computed, toValue } from "vue";
|
||||||
import type { MaybeRefOrGetter } from "vue";
|
import type { MaybeRefOrGetter } from "vue";
|
||||||
import {
|
import {
|
||||||
TeacherInvitationController,
|
TeacherInvitationController,
|
||||||
type TeacherInvitationResponse,
|
type TeacherInvitationResponse,
|
||||||
type TeacherInvitationsResponse
|
type TeacherInvitationsResponse,
|
||||||
} from "@/controllers/teacher-invitations.ts";
|
} from "@/controllers/teacher-invitations.ts";
|
||||||
import type {TeacherInvitationData} from "@dwengo-1/common/dist/interfaces/teacher-invitation.ts";
|
import type { TeacherInvitationData } from "@dwengo-1/common/dist/interfaces/teacher-invitation.ts";
|
||||||
import type {TeacherDTO} from "@dwengo-1/common/dist/interfaces/teacher.ts";
|
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(async () => 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(async () => controller.getAll(toValue(username), false)),
|
queryFn: computed(async () => controller.getAll(toValue(username), false)),
|
||||||
enabled: () => Boolean(toValue(username)),
|
enabled: () => Boolean(toValue(username)),
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useCreateTeacherInvitationMutation(): UseMutationReturnType<TeacherInvitationResponse, Error, TeacherDTO, unknown>{
|
export function useCreateTeacherInvitationMutation(): UseMutationReturnType<
|
||||||
|
TeacherInvitationResponse,
|
||||||
|
Error,
|
||||||
|
TeacherDTO,
|
||||||
|
unknown
|
||||||
|
> {
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async (data: TeacherInvitationData) => controller.create(data)
|
mutationFn: async (data: TeacherInvitationData) => controller.create(data),
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useAcceptTeacherInvitationMutation(): UseMutationReturnType<TeacherInvitationResponse, Error, TeacherDTO, unknown> {
|
export function useAcceptTeacherInvitationMutation(): UseMutationReturnType<
|
||||||
|
TeacherInvitationResponse,
|
||||||
|
Error,
|
||||||
|
TeacherDTO,
|
||||||
|
unknown
|
||||||
|
> {
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async (data: TeacherInvitationData) => controller.respond(data, true)
|
mutationFn: async (data: TeacherInvitationData) => controller.respond(data, true),
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useDeclineTeacherInvitationMutation(): UseMutationReturnType<TeacherInvitationResponse, Error, TeacherDTO, unknown> {
|
export function useDeclineTeacherInvitationMutation(): UseMutationReturnType<
|
||||||
|
TeacherInvitationResponse,
|
||||||
|
Error,
|
||||||
|
TeacherDTO,
|
||||||
|
unknown
|
||||||
|
> {
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async (data: TeacherInvitationData) => controller.respond(data, false)
|
mutationFn: async (data: TeacherInvitationData) => controller.respond(data, false),
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useDeleteTeacherInvitationMutation(): UseMutationReturnType<TeacherInvitationResponse, Error, TeacherDTO, unknown> {
|
export function useDeleteTeacherInvitationMutation(): UseMutationReturnType<
|
||||||
|
TeacherInvitationResponse,
|
||||||
|
Error,
|
||||||
|
TeacherDTO,
|
||||||
|
unknown
|
||||||
|
> {
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: async (data: TeacherInvitationData) => controller.respond(data, false)
|
mutationFn: async (data: TeacherInvitationData) => controller.respond(data, false),
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,8 @@
|
||||||
:key="i.classId"
|
:key="i.classId"
|
||||||
>
|
>
|
||||||
<td>
|
<td>
|
||||||
{{ i.classId }} <!-- TODO fetch display name via classId because db only returns classId field -->
|
{{ i.classId }}
|
||||||
|
<!-- TODO fetch display name via classId because db only returns classId field -->
|
||||||
</td>
|
</td>
|
||||||
<td>{{ (i.sender as TeacherDTO).firstName + " " + (i.sender as TeacherDTO).lastName }}</td>
|
<td>{{ (i.sender as TeacherDTO).firstName + " " + (i.sender as TeacherDTO).lastName }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue