add user config routes

This commit is contained in:
2025-07-24 12:17:30 +05:30
parent 05abf66d66
commit ee31f3ae20
7 changed files with 119 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import { FastifyReply, FastifyRequest } from "fastify";
import { getConfig, updateConfig } from "./userConfig.service";
import { UpdateUserConfigInput } from "./userConfig.schema";
export async function getConfigHandler(req: FastifyRequest, res: FastifyReply) {
try {
const config = await getConfig(req.user);
return res.code(200).send(config);
} catch (err) {
return err;
}
}
export async function updateConfigHandler(
req: FastifyRequest,
res: FastifyReply
) {
const input = req.body as UpdateUserConfigInput;
console.log(input);
try {
const updatedConfig = await updateConfig(input, req.user);
return res.code(200).send(updatedConfig);
} catch (err) {
return err;
}
}