Remove bootstrap-admin endpoint
This commit is contained in:
@@ -415,23 +415,4 @@ export const hammerRoutes = new Elysia({ prefix: '/hammer' })
|
||||
}),
|
||||
})
|
||||
|
||||
// Bootstrap: promote a user to admin (one-time setup helper)
|
||||
.post('/bootstrap-admin', async ({ body, set }) => {
|
||||
const user = await db.query.users.findFirst({
|
||||
where: eq(users.email, body.email),
|
||||
});
|
||||
if (!user) {
|
||||
set.status = 404;
|
||||
throw new Error('User not found');
|
||||
}
|
||||
const [updated] = await db
|
||||
.update(users)
|
||||
.set({ role: 'admin' })
|
||||
.where(eq(users.email, body.email))
|
||||
.returning();
|
||||
return { success: true, user: { id: updated.id, name: updated.name, email: updated.email, role: updated.role } };
|
||||
}, {
|
||||
body: t.Object({
|
||||
email: t.String({ format: 'email' }),
|
||||
}),
|
||||
});
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user