This commit is contained in:
2026-02-16 19:34:35 +00:00
commit 9ab0940ca4
784 changed files with 41710 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
import type { Handler } from 'hono';
import { officerdb, eq, Users } from 'officerdb';
import * as errors from '@@/custom-errors';
export const updateUserHandler: Handler = async function (ctx) {
const { name, avatar } = ctx.get('body');
const reqUser = ctx.get('user');
if (typeof name !== 'string') throw errors.BAD_REQUEST('Name is required');
await officerdb
.update(Users)
.set({ name, avatar: avatar ?? null })
.where(eq(Users.id, reqUser.id));
return ctx.json({ ok: true });
};