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) - } -})