mirror of
https://github.com/detleph/server.git
synced 2026-09-04 08:36:06 +02:00
Address some comments and fix issues
This commit is contained in:
@@ -20,8 +20,6 @@ const InitialParticipant = z.object({
|
||||
groupPid: z.string().min(1).uuid(),
|
||||
});
|
||||
|
||||
const ParticipantBody = InitialParticipant.extend({ teamPid: z.string().uuid() });
|
||||
|
||||
const basicParticipant = {
|
||||
pid: 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) => {
|
||||
const { teamPid } = req.params;
|
||||
|
||||
const result = ParticipantBody.safeParse(req.body);
|
||||
const result = InitialParticipant.safeParse(req.body);
|
||||
|
||||
if (result.success === false) {
|
||||
return res.status(400).json(
|
||||
|
||||
@@ -22,7 +22,7 @@ router.get(
|
||||
);
|
||||
|
||||
teamRouter.get(
|
||||
"/:pid/particpants",
|
||||
"/:teamPid/particpants",
|
||||
requireConfiguredAuthentication({ type: { admin: true, teamleader: true }, optional: false }),
|
||||
getAllParticipantsParams
|
||||
);
|
||||
@@ -35,7 +35,7 @@ roleRouter.get(
|
||||
|
||||
teamRouter.post<"/:teamPid/participants/", { teamPid: string }>(
|
||||
"/:teamPid/participants/",
|
||||
requireConfiguredAuthentication({ optional: true, type: { admin: true, teamleader: true } }),
|
||||
requireConfiguredAuthentication({ optional: false, type: { admin: true, teamleader: true } }),
|
||||
createParticipant
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user