file based auth

This commit is contained in:
2026-02-23 09:58:08 +00:00
parent 0bea406dcd
commit 2779fe22c6
40 changed files with 456 additions and 1010 deletions
+6 -5
View File
@@ -1,5 +1,5 @@
import type { Handler } from 'hono';
import { officerdb, eq, Users } from 'officerdb';
import { updateUser } from 'officerdb';
import * as errors from '@@/custom-errors';
export const updateUserHandler: Handler = async function (ctx) {
@@ -8,10 +8,11 @@ export const updateUserHandler: Handler = async function (ctx) {
if (typeof name !== 'string') throw errors.BAD_REQUEST('Name is required');
await officerdb
.update(Users)
.set({ name, username: typeof username === 'string' ? username : undefined, avatar: avatar ?? null })
.where(eq(Users.id, reqUser.id));
await updateUser(reqUser.id, {
name,
username: typeof username === 'string' ? username : undefined,
avatar: avatar ?? null,
});
return ctx.json({ ok: true });
};