diff options
Diffstat (limited to 'api/src/routes/users/@me/settings.ts')
-rw-r--r-- | api/src/routes/users/@me/settings.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/api/src/routes/users/@me/settings.ts b/api/src/routes/users/@me/settings.ts index b22b72fb..50a00cac 100644 --- a/api/src/routes/users/@me/settings.ts +++ b/api/src/routes/users/@me/settings.ts @@ -6,6 +6,14 @@ const router = Router(); export interface UserSettingsSchema extends Partial<UserSettings> {} +router.get("/", route({}), async (req: Request, res: Response) => { + const user = await User.findOneOrFail( + { id: req.user_id }, + { relations: ["settings"] } + ) + return res.json(user.settings); +}); + router.patch("/", route({ body: "UserSettingsSchema" }), async (req: Request, res: Response) => { const body = req.body as UserSettings; if (body.locale === "en") body.locale = "en-US"; // fix discord client crash on unkown locale |