user: Add email and username, remove bufferTime,startTime,endTime (#202)
Co-authored-by: zomars <[email protected]>
This commit is contained in:
1 parent
0f5017010f
commit
51bc3d93c1
3 files changed
+23
-11
No files matched your search
@@ -59,7 +59,7 @@ export async function patchHandler(req: NextApiRequest) {
|
||||
// Here we only check for ownership of the user if the user is not admin, otherwise we let ADMIN's edit any user
|
||||
if (!isAdmin && query.userId !== req.userId) throw new HttpError({ statusCode: 403, message: "Forbidden" });
|
||||
|
||||
const body = schemaUserEditBodyParams.parse(req.body);
|
||||
const body = await schemaUserEditBodyParams.parseAsync(req.body);
|
||||
const userSchedules = await prisma.schedule.findMany({
|
||||
where: { userId: query.userId },
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ async function postHandler(req: NextApiRequest) {
|
||||
const { prisma, isAdmin } = req;
|
||||
// If user is not ADMIN, return unauthorized.
|
||||
if (!isAdmin) throw new HttpError({ statusCode: 401, message: "You are not authorized" });
|
||||
const data = schemaUserCreateBodyParams.parse(req.body);
|
||||
const data = await schemaUserCreateBodyParams.parseAsync(req.body);
|
||||
const user = await prisma.user.create({ data });
|
||||
req.statusCode = 201;
|
||||
return { user };
|
||||
|
||||
Reference in new issue
Block a user