Scheduling infrastructure for absolutely everyone.
Fix issues in multiple endpoints (#679)
Chris S13486d9988a1
diff --git a/pages/api/auth/signup.ts b/pages/api/auth/signup.tsindex c8afa8137ca..c0d8ddcf685 100644--- a/pages/api/auth/signup.ts+++ b/pages/api/auth/signup.ts@@ -34,13 +34,6 @@ export default async function handler(req, res) {email: email,},],- AND: [- {- emailVerified: {- not: null,- },- },- ],},});diff --git a/pages/api/teams/[team]/membership.ts b/pages/api/teams/[team]/membership.tsindex 300e06de4bd..be713f9185c 100644--- a/pages/api/teams/[team]/membership.ts+++ b/pages/api/teams/[team]/membership.ts@@ -37,6 +37,15 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)in: memberships.map((membership) => membership.userId),},},+ select: {+ id: true,+ username: true,+ name: true,+ email: true,+ bio: true,+ avatar: true,+ timeZone: true,+ },});members = members.map((member) => {diff --git a/pages/api/user/[id].ts b/pages/api/user/[id].tsindex d1598dd7457..9ec73ea720c 100644--- a/pages/api/user/[id].ts+++ b/pages/api/user/[id].ts@@ -1,6 +1,7 @@import type { NextApiRequest, NextApiResponse } from "next";import prisma from "@lib/prisma";import { getSession } from "@lib/auth";+import { pick } from "lodash";export default async function handler(req: NextApiRequest, res: NextApiResponse) {const session = await getSession({ req: req });@@ -34,13 +35,41 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)}if (req.method === "PATCH") {- const data = req.body.data;const updatedUser = await prisma.user.update({where: {id: authenticatedUser.id,},data: {- ...data,+ ...pick(req.body, [+ "username",+ "name",+ "avatar",+ "timeZone",+ "weekStart",+ "hideBranding",+ "theme",+ "completedOnboarding",+ ]),+ bio: req.body.description,+ },+ select: {+ id: true,+ username: true,+ name: true,+ email: true,+ emailVerified: true,+ bio: true,+ avatar: true,+ timeZone: true,+ weekStart: true,+ startTime: true,+ endTime: true,+ bufferTime: true,+ hideBranding: true,+ theme: true,+ createdDate: true,+ plan: true,+ completedOnboarding: true,},});return res.status(200).json({ message: "User Updated", data: updatedUser });diff --git a/pages/api/user/profile.ts b/pages/api/user/profile.tsindex 43562cc743e..040ef33ff30 100644--- a/pages/api/user/profile.ts+++ b/pages/api/user/profile.ts@@ -1,6 +1,7 @@import type { NextApiRequest, NextApiResponse } from "next";import prisma from "@lib/prisma";import { getSession } from "@lib/auth";+import { pick } from "lodash";export default async function handler(req: NextApiRequest, res: NextApiResponse) {const session = await getSession({ req: req });@@ -10,17 +11,23 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)return;}- const description = req.body.description;- delete req.body.description;-try {await prisma.user.update({where: {id: session.user.id,},data: {- ...req.body,- bio: description,+ ...pick(req.body, [+ "username",+ "name",+ "avatar",+ "timeZone",+ "weekStart",+ "hideBranding",+ "theme",+ "completedOnboarding",+ ]),+ bio: req.body.description,},});} catch (e) {