small fixes

This commit is contained in:
Laurin
2022-05-29 01:35:57 +02:00
parent b1a0e8be7c
commit cb50e5ac2e
+10 -7
View File
@@ -7,7 +7,6 @@ import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
import NotFoundError from "../Middleware/error/NotFoundError"; import NotFoundError from "../Middleware/error/NotFoundError";
//TODO: add TeamleaderAuthentification //TODO: add TeamleaderAuthentification
// discuss wether
const ParticipantBody = z.object({ const ParticipantBody = z.object({
firstName: z.string(), firstName: z.string(),
@@ -16,10 +15,8 @@ const ParticipantBody = z.object({
job: z.enum(["TEAMLEADER", "MEMBER"]), job: z.enum(["TEAMLEADER", "MEMBER"]),
}); });
const updateParticipantBody = ParticipantBody.pick({ const updateParticipantBody = ParticipantBody.omit({
firstName: true, job: true,
lastName: true,
groupId: true,
}).partial(); }).partial();
const returnedParticipant = { const returnedParticipant = {
@@ -27,8 +24,14 @@ const returnedParticipant = {
firstName: true, firstName: true,
lastName: true, lastName: true,
relevance: true, relevance: true,
team: { select: { pid: true, } }, team: { select: {
group: { select: { pid: true, } }, pid: true,
name: true,
} },
group: { select: {
pid: true,
name: true,
} },
} as const; } as const;
export const createParticipant = async (req: Request<{ pid: string}>, res: Response) => { export const createParticipant = async (req: Request<{ pid: string}>, res: Response) => {