docs: Phase 2 accounts & roles — roadmap, README, session log

This commit is contained in:
Bas van Rossem
2026-06-17 18:04:19 +02:00
parent 7d200eb8fc
commit 3d8524c827
5 changed files with 903 additions and 39 deletions

View File

@@ -35,10 +35,16 @@ const REFERENCE_ACTIVITIES: { name: string; insoleTypes: string[] }[] = [
async function seedDevUsers(): Promise<void> {
if (process.env.NODE_ENV === 'production') return;
// better-auth's admin plugin types `role` as its built-in set ('user' | 'admin'); our custom
// 'worker' role is valid at runtime but not in that static type, so narrow createUser locally
// (same workaround as test/helpers.ts).
const createUser = auth.api.createUser as (args: {
body: { email: string; password: string; name: string; role: 'worker' | 'admin' };
}) => Promise<unknown>;
for (const acc of DEV_ACCOUNTS) {
const existing = await db.select().from(user).where(eq(user.email, acc.email));
if (existing.length > 0) continue;
await auth.api.createUser({
await createUser({
body: { email: acc.email, password: acc.password, name: acc.name, role: acc.role },
});
console.log(`Seeded dev ${acc.role}: ${acc.email} / ${acc.password}`);