migration to postgres

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 17:42:59 +00:00
co-authored by Claude Opus 4.6
parent 7f04ecd644
commit 500a70910e
54 changed files with 4016 additions and 264 deletions
+4 -4
View File
@@ -15,7 +15,7 @@ usersRouter.get('/', async (ctx) => {
const user = ctx.get('user');
if (user.role !== 'Super Admin') throw errors.FORBIDDEN();
const users = getUsers();
const users = await getUsers();
const sanitized = users.map(({ password, ...rest }) => rest);
return ctx.json(sanitized);
@@ -39,7 +39,7 @@ usersRouter.post('/invite', async (ctx) => {
? (role as (typeof USER_ROLES)[number])
: ('Member' as const);
const existing = getUserByEmail(email);
const existing = await getUserByEmail(email);
if (existing) throw errors.CONFLICT('A user with this email already exists');
const dbUser = await createUser({
@@ -71,7 +71,7 @@ usersRouter.post('/:id/resend-invite', async (ctx) => {
const id = Number(ctx.req.param('id'));
if (!id || isNaN(id)) throw errors.BAD_REQUEST('Invalid user ID');
const target = getUserById(id);
const target = await getUserById(id);
if (!target) throw errors.NOT_FOUND('User not found');
if (target.status !== 'Invited') throw errors.BAD_REQUEST('User is not in Invited status');
@@ -98,7 +98,7 @@ usersRouter.delete('/:id', async (ctx) => {
if (!id || isNaN(id)) throw errors.BAD_REQUEST('Invalid user ID');
if (id === reqUser.id) throw errors.BAD_REQUEST('Cannot delete yourself');
const target = getUserById(id);
const target = await getUserById(id);
if (!target) throw errors.NOT_FOUND('User not found');
await deleteUser(id);