fixed members login and permissions issues

This commit is contained in:
2026-02-23 00:57:34 +00:00
parent ed0debfeac
commit 97da2e2736
42 changed files with 574 additions and 113 deletions
+2 -2
View File
@@ -3,14 +3,14 @@ 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 { name, username, 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 })
.set({ name, username: typeof username === 'string' ? username : undefined, avatar: avatar ?? null })
.where(eq(Users.id, reqUser.id));
return ctx.json({ ok: true });