1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-07 11:22:35 +01:00

Added the profile route

This commit is contained in:
BuildTools 2021-08-05 19:18:14 +03:00
parent 43a38ba46c
commit f93e348841
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,24 @@
import { Router, Request, Response } from "express";
import { getPublicUser } from "../../../util/User";
const router: Router = Router();
router.get("/", async (req: Request, res: Response) => {
const user = await getPublicUser(req.params.id, { user_data: true })
res.json({
connected_accounts: user.user_data.connected_accounts,
premium_guild_since: null, // TODO
premium_since: null, // TODO
user: {
username: user.username,
discriminator: user.discriminator,
id: user.id,
public_flags: user.public_flags,
avatar: user.avatar,
bio: req.user_bot ? null : user.bio,
}
});
});
export default router;

View File

@ -0,0 +1,24 @@
import { Router, Request, Response } from "express";
import { getPublicUser } from "../../../util/User";
const router: Router = Router();
router.get("/", async (req: Request, res: Response) => {
const user = await getPublicUser(req.user_id, { user_data: true })
res.json({
connected_accounts: user.user_data.connected_accounts,
premium_guild_since: null, // TODO
premium_since: null, // TODO
user: {
username: user.username,
discriminator: user.discriminator,
id: user.id,
public_flags: user.public_flags,
avatar: user.avatar,
bio: user.bio,
}
});
});
export default router;