From 05cc23a144afca9705aa7af2e77c16ad986a96ac Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Fri, 6 May 2022 21:35:26 -0700 Subject: [PATCH] remove file accidently included in rebase --- server/src/routes/users.ts | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 server/src/routes/users.ts diff --git a/server/src/routes/users.ts b/server/src/routes/users.ts deleted file mode 100644 index a2737437..00000000 --- a/server/src/routes/users.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Router } from "express" -import jwt, { UserJwtRequest } from "@lib/middleware/is-signed-in" -import { User } from "@lib/models/User" - -export const users = Router() - -users.get("/self", jwt, async (req: UserJwtRequest, res, next) => { - const error = () => - res.status(401).json({ - message: "Unauthorized" - }) - - try { - if (!req.user) { - return error() - } - - const user = await User.findByPk(req.user?.id, { - attributes: { - exclude: ["password"] - } - }) - if (!user) { - return error() - } - - res.json(user) - } catch (error) { - next(error) - } -})