Scheduling infrastructure for absolutely everyone.
Formatting
zomars07b011424f8a
diff --git a/pages/api/users/[userId]/_delete.ts b/pages/api/users/[userId]/_delete.tsindex 9d512985ebd..46ab08e5f91 100644--- a/pages/api/users/[userId]/_delete.ts+++ b/pages/api/users/[userId]/_delete.ts@@ -33,8 +33,7 @@ export async function deleteHandler(req: NextApiRequest) {const { prisma, isAdmin } = req;const query = schemaQueryUserId.parse(req.query);// 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" });+ if (!isAdmin && query.userId !== req.userId) throw new HttpError({ statusCode: 403, message: "Forbidden" });const user = await prisma.user.findUnique({ where: { id: query.userId } });if (!user) throw new HttpError({ statusCode: 404, message: "User not found" });diff --git a/pages/api/users/[userId]/_get.ts b/pages/api/users/[userId]/_get.tsindex ba9c8f61b5a..360103560be 100644--- a/pages/api/users/[userId]/_get.ts+++ b/pages/api/users/[userId]/_get.ts@@ -35,8 +35,7 @@ export async function getHandler(req: NextApiRequest) {const query = schemaQueryUserId.parse(req.query);// 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" });+ if (!isAdmin && query.userId !== req.userId) throw new HttpError({ statusCode: 403, message: "Forbidden" });const data = await prisma.user.findUnique({ where: { id: query.userId } });const user = schemaUserReadPublic.parse(data);return { user };diff --git a/pages/api/users/[userId]/_patch.ts b/pages/api/users/[userId]/_patch.tsindex aca10a89bb1..9af08bb210f 100644--- a/pages/api/users/[userId]/_patch.ts+++ b/pages/api/users/[userId]/_patch.ts@@ -55,8 +55,7 @@ export async function patchHandler(req: NextApiRequest) {const { prisma, isAdmin } = req;const query = schemaQueryUserId.parse(req.query);// 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" });+ if (!isAdmin && query.userId !== req.userId) throw new HttpError({ statusCode: 403, message: "Forbidden" });const body = schemaUserEditBodyParams.parse(req.body);const userSchedules = await prisma.schedule.findMany({