From 327f4e27b6d595ef4d7636b85b24f2a966a249ed Mon Sep 17 00:00:00 2001 From: Roy Scheeren Date: Thu, 25 Jan 2024 11:59:51 +0100 Subject: [PATCH] refactor(envited.ascs.digital): remove obsolete endpoint Signed-off-by: Roy Scheeren --- .../app/api/user/[id]/route.ts | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 apps/envited.ascs.digital/app/api/user/[id]/route.ts diff --git a/apps/envited.ascs.digital/app/api/user/[id]/route.ts b/apps/envited.ascs.digital/app/api/user/[id]/route.ts deleted file mode 100644 index c29ae423..00000000 --- a/apps/envited.ascs.digital/app/api/user/[id]/route.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { isNil } from 'ramda' - -import { getServerSession } from '../../../../common/auth/session' -import { db } from '../../../../common/database/queries' -import { badRequest, internalServerError, ok, unauthorized } from '../../../../common/utils' -import { isOwnUser, userIsIssuedByLoggedInUser } from '../../utils' - -export async function GET(request: Request, { params: { id } }: { params: { id: string } }) { - try { - const session = await getServerSession() - - if (isNil(session)) { - return unauthorized() - } - - const connection = await db() - const [user] = await connection.getUserById(id) - - if (!userIsIssuedByLoggedInUser(user)(session) && !isOwnUser(user)(session)) { - return badRequest() - } - - return ok(user) - } catch (error) { - console.log('error', error) - - return internalServerError() - } -} - -export const dynamic = 'force-dynamic'