Address some comments and fix issues

This commit is contained in:
Stephan
2022-06-09 16:23:54 +02:00
committed by La_Felx
parent 3a995c6b03
commit 68cf5bf573
2 changed files with 3 additions and 5 deletions
+1 -3
View File
@@ -20,8 +20,6 @@ const InitialParticipant = z.object({
groupPid: z.string().min(1).uuid(), groupPid: z.string().min(1).uuid(),
}); });
const ParticipantBody = InitialParticipant.extend({ teamPid: z.string().uuid() });
const basicParticipant = { const basicParticipant = {
pid: true, pid: true,
firstName: true, firstName: true,
@@ -133,7 +131,7 @@ export const getParticipantForRole = async (req: Request<{ rolePid: string }>, r
export const createParticipant = async (req: Request<{ teamPid: string }>, res: Response) => { export const createParticipant = async (req: Request<{ teamPid: string }>, res: Response) => {
const { teamPid } = req.params; const { teamPid } = req.params;
const result = ParticipantBody.safeParse(req.body); const result = InitialParticipant.safeParse(req.body);
if (result.success === false) { if (result.success === false) {
return res.status(400).json( return res.status(400).json(
+2 -2
View File
@@ -22,7 +22,7 @@ router.get(
); );
teamRouter.get( teamRouter.get(
"/:pid/particpants", "/:teamPid/particpants",
requireConfiguredAuthentication({ type: { admin: true, teamleader: true }, optional: false }), requireConfiguredAuthentication({ type: { admin: true, teamleader: true }, optional: false }),
getAllParticipantsParams getAllParticipantsParams
); );
@@ -35,7 +35,7 @@ roleRouter.get(
teamRouter.post<"/:teamPid/participants/", { teamPid: string }>( teamRouter.post<"/:teamPid/participants/", { teamPid: string }>(
"/:teamPid/participants/", "/:teamPid/participants/",
requireConfiguredAuthentication({ optional: true, type: { admin: true, teamleader: true } }), requireConfiguredAuthentication({ optional: false, type: { admin: true, teamleader: true } }),
createParticipant createParticipant
); );