From 1889ececf8a7e42eddb1370df18b3ecc7cbfc671 Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Thu, 16 Jun 2022 01:27:26 +0200 Subject: [PATCH 1/2] feat: improve deployment docs for api --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 8c39f8457f..ad6c3a78ab 100644 --- a/README.md +++ b/README.md @@ -178,3 +178,20 @@ We make sure of this by not using next in dev, but next build && next start, if See . Here in dev mode OPTIONS method is hardcoded to return only GET and OPTIONS as allowed method. Running in Production mode would cause this file to be not used. This is hot-reloading logic only. To remove this limitation, we need to ensure that on local endpoints are requested by swagger at /api/v1 and not /v1 + + +## Deployment + +We recommend deploying API in vercel. + +There's some settings that you'll need to setup. + +Under Vercel > Your API Deployment > Settings + +In General > Build & Development Settings +BUILD COMMAND: `yarn turbo run build --scope=@calcom/api --include-dependencies --no-deps` +OUTPUT DIRECTORY: `apps/api/.next` + +See `scripts/vercel-deploy.sh` for more info on how the deployment is done. +## Environment variables +Lastly API requires an env var for `DATABASE_URL` \ No newline at end of file From 8b87cde733acef43660e7105e5f67eb4f2d86d20 Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Thu, 16 Jun 2022 01:48:29 +0200 Subject: [PATCH 2/2] fix: _delete missing userId rename --- pages/api/users/[userId]/_delete.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/api/users/[userId]/_delete.ts b/pages/api/users/[userId]/_delete.ts index 3478c44789..c2d8d5db29 100644 --- a/pages/api/users/[userId]/_delete.ts +++ b/pages/api/users/[userId]/_delete.ts @@ -38,7 +38,7 @@ export async function deleteHandler(req: NextApiRequest) { if (!isAdmin && query.userId !== req.userId) throw new HttpError({ statusCode: 401, message: "Unauthorized" }); - const user = await prisma.user.findUnique({ where: { id: query.id } }); + const user = await prisma.user.findUnique({ where: { id: query.userId } }); if (!user) throw new HttpError({ statusCode: 404, message: "User not found" }); await prisma.user.delete({ where: { id: user.id } });