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'