remove file accidently included in rebase
This commit is contained in:
parent
13040ab8cc
commit
05cc23a144
1 changed files with 0 additions and 31 deletions
|
@ -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)
|
||||
}
|
||||
})
|
Loading…
Reference in a new issue