1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

[Route] GET /users/:id

get current user
This commit is contained in:
Intevel ツ 2021-05-04 11:45:12 +02:00
parent d8beabe53a
commit ab6c35f128

View File

@ -1,6 +1,7 @@
import { Router, Request, Response } from "express";
import { UserModel } from "@fosscord/server-util";
import { HTTPError } from "lambert-server";
import { getPublicUser } from "../../../util/User";
const router: Router = Router();
@ -9,7 +10,9 @@ router.get("/", async (req: Request, res: Response) => {
const user = await UserModel.findOne({ id: req.user_id }).exec();
if (!user) throw new HTTPError("User not found", 404);
res.json(user);
var publicUser = await getPublicUser(user.id);
res.json(publicUser);
});
export default router;