summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/routes/api/v8/users/@me/guilds.ts6
-rw-r--r--src/routes/api/v8/users/@me/index.ts15
2 files changed, 16 insertions, 5 deletions
diff --git a/src/routes/api/v8/users/@me/guilds.ts b/src/routes/api/v8/users/@me/guilds.ts
index 0021d911..6c3b0925 100644
--- a/src/routes/api/v8/users/@me/guilds.ts
+++ b/src/routes/api/v8/users/@me/guilds.ts
@@ -7,11 +7,7 @@ import { getPublicUser } from "../../../../../util/User";
 const router: Router = Router();
 
 router.get("/", async (req: Request, res: Response) => {
-	const user = await UserModel.findOne(
-		{ id: req.userid },
-		"guilds username discriminator id public_flags avatar"
-	).exec();
-
+	const user = await UserModel.findOne({ id: req.userid }, { guilds: true }).exec();
 	if (!user) throw new HTTPError("User not found", 404);
 
 	var guildIDs = user.guilds || [];
diff --git a/src/routes/api/v8/users/@me/index.ts b/src/routes/api/v8/users/@me/index.ts
new file mode 100644
index 00000000..4307ef76
--- /dev/null
+++ b/src/routes/api/v8/users/@me/index.ts
@@ -0,0 +1,15 @@
+import { Router, Request, Response } from "express";
+import { UserModel } from "fosscord-server-util";
+import { HTTPError } from "lambert-server";
+
+const router: Router = Router();
+
+router.get("/", async (req: Request, res: Response) => {
+	// TODO: user projection
+	const user = await UserModel.findOne({ id: req.userid }).exec();
+	if (!user) throw new HTTPError("User not found", 404);
+
+	res.json(user);
+});
+
+export default router;