diff --git a/README.md b/README.md index 5a90897..9992524 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,8 @@ Requirements: ```sh bun dev ``` +5. (Optional, for logging into the admin panel locally) Seed a test user with Telegram already linked and the `owner` role: + ```sh + bun run seed:user + ``` + The script sends a sign-in OTP to `test@example.com` and prints a link to a temporary inbox where you can read the code — paste it when prompted. Without this step, logging into admin with `test@example.com` lands on the "Link your Telegram account" onboarding page, since that account has no `telegramId` associated yet. Re-run with `--force` to recreate the test user from scratch. diff --git a/scripts/seed-user.ts b/scripts/seed-user.ts index 16f560a..950a7c6 100644 --- a/scripts/seed-user.ts +++ b/scripts/seed-user.ts @@ -17,6 +17,7 @@ const force = argv.includes("--force") const existing = await DB.select().from(SCHEMA.AUTH.user).where(eq(SCHEMA.AUTH.user.email, testUser.email)).limit(1) if (existing.length === 1) { if (force) { + await DB.delete(SCHEMA.TG.link).where(eq(SCHEMA.TG.link.userId, existing[0].id)) await DB.delete(SCHEMA.AUTH.user).where(eq(SCHEMA.AUTH.user.email, testUser.email)) console.warn("SEED: test user deleted for recreation by using --force flag") } else {