Make the first user created an admin
All checks were successful
/ build (push) Successful in 1m31s
/ deploy (push) Successful in 16s

To easily bootstrap of administration of the system make the first
regular user account created into an admin account.
This commit is contained in:
Hornwitser 2025-06-28 01:25:43 +02:00
parent e5e923bc8d
commit 0c5b4c756f

View file

@ -29,10 +29,11 @@ export default defineEventHandler(async (event) => {
});
}
const firstUser = users.every(user => user.type === "anonymous");
user = {
id: await nextUserId(),
updatedAt: new Date().toISOString(),
type: "regular",
type: firstUser ? "admin" : "regular",
name,
};