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:
parent
43a38ba46c
commit
f93e348841
24
src/routes/users/#id/profile.ts
Normal file
24
src/routes/users/#id/profile.ts
Normal 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;
|
24
src/routes/users/@me/profile.ts
Normal file
24
src/routes/users/@me/profile.ts
Normal 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;
|
Loading…
Reference in New Issue
Block a user