summary refs log tree commit diff
path: root/api/src/routes/users/@me
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-18 11:53:03 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-18 11:53:03 +0200
commit9d0dcae5621d999100c8d850e373cf96f018b32b (patch)
treee667f0fc3c35865b5c8a402a3c0cff9078818451 /api/src/routes/users/@me
parentfix #199 (diff)
downloadserver-9d0dcae5621d999100c8d850e373cf96f018b32b.tar.xz
:ambulance: user settings route
Diffstat (limited to 'api/src/routes/users/@me')
-rw-r--r--api/src/routes/users/@me/settings.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/api/src/routes/users/@me/settings.ts b/api/src/routes/users/@me/settings.ts
index cca9b3ab..5664fc2f 100644
--- a/api/src/routes/users/@me/settings.ts
+++ b/api/src/routes/users/@me/settings.ts
@@ -1,9 +1,15 @@
 import { Router, Response, Request } from "express";
+import { UserModel, UserSettings } from "@fosscord/util";
+import { check } from "../../../util/instanceOf";
+import { UserSettingsSchema } from "../../../schema/User";
 
 const router = Router();
 
-router.patch("/", (req: Request, res: Response) => {
-	// TODO:
+router.patch("/", check(UserSettingsSchema), async (req: Request, res: Response) => {
+	const body = req.body as UserSettings;
+
+	await UserModel.updateOne({ id: req.user_id }, body).exec();
+
 	res.sendStatus(204);
 });