mirror of
https://github.com/detleph/server.git
synced 2026-09-07 16:06:18 +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(),
|
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(
|
||||||
|
|||||||
@@ -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
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user