blob: 4b5438d64eaf4c6aff7863cb8365b16dafc9b2dc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import { zValidator } from "@hono/zod-validator";
import { Hono } from "hono";
import { updateUserSchema } from "@karakeep/shared/types/admin";
import { adminAuthMiddleware } from "../middlewares/auth";
const app = new Hono()
.use(adminAuthMiddleware)
// PUT /admin/users/:userId
.put("/users/:userId", zValidator("json", updateUserSchema), async (c) => {
const userId = c.req.param("userId");
const body = c.req.valid("json");
// Ensure the userId from the URL matches the one in the body
const input = { ...body, userId };
await c.var.api.admin.updateUser(input);
return c.json({ success: true }, 200);
});
export default app;
|