summary refs log tree commit diff
path: root/api/src/routes/users/@me/index.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-01 23:34:55 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-01 23:34:55 +0200
commit295159fc4a7d32ffa7686ff7df510d098a1794f9 (patch)
tree51dd0493766f0eda1551dd44f546e8189aafa182 /api/src/routes/users/@me/index.ts
parent:sparkles: generate open api schema based on body and db entities (diff)
downloadserver-295159fc4a7d32ffa7686ff7df510d098a1794f9.tar.xz
:bug: fix entity types and projection
Diffstat (limited to 'api/src/routes/users/@me/index.ts')
-rw-r--r--api/src/routes/users/@me/index.ts25
1 files changed, 2 insertions, 23 deletions
diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts
index d5a5723c..68649215 100644
--- a/api/src/routes/users/@me/index.ts
+++ b/api/src/routes/users/@me/index.ts
@@ -1,5 +1,5 @@
 import { Router, Request, Response } from "express";
-import { User } from "@fosscord/util";
+import { User, PrivateUserProjection } from "@fosscord/util";
 import { UserModifySchema } from "../../../schema/User";
 import { check } from "../../../util/instanceOf";
 import { handleFile } from "../../../util/cdn";
@@ -7,30 +7,9 @@ import { handleFile } from "../../../util/cdn";
 const router: Router = Router();
 
 router.get("/", async (req: Request, res: Response) => {
-	res.json(await User.getPublicUser(req.user_id));
+	res.json(await User.getPublicUser(req.user_id, { select: PrivateUserProjection }));
 });
 
-const UserUpdateProjection = [
-	"accent_color",
-	"avatar",
-	"banner",
-	"bio",
-	"bot",
-	"discriminator",
-	"email",
-	"flags",
-	"id",
-	"locale",
-	"mfa_enabled",
-	"nsfw_alllowed",
-	"phone",
-	"public_flags",
-	"purchased_flags",
-	// "token", // this isn't saved in the db and needs to be set manually
-	"username",
-	"verified"
-];
-
 router.patch("/", check(UserModifySchema), async (req: Request, res: Response) => {
 	const body = req.body as UserModifySchema;