The Telegram bot phase ended in Plan 3 — the operator now signs in via username + password. Migration 0011 drops the legacy column + its unique index. seed.ts no longer reads SEED_OPERATOR_TELEGRAM_ID; docker-compose.base.yml swaps the env to SEED_OPERATOR_USERNAME (default 'admin'); .env.development follows. Settings page shows 'Username' instead of 'Operator ID'. Auth-and-prod-hardening plan doc updated to drop the synthetic telegram_user_id from the create-user CLI script and createUserAction insert. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
665 B
TypeScript
26 lines
665 B
TypeScript
import { createClient, operators } from "./index.js";
|
|
|
|
const databaseUrl = process.env.DATABASE_URL;
|
|
const username = process.env.SEED_OPERATOR_USERNAME ?? "admin";
|
|
const operatorName = process.env.SEED_OPERATOR_NAME ?? "Operator";
|
|
|
|
if (!databaseUrl) {
|
|
console.error("DATABASE_URL not set");
|
|
process.exit(1);
|
|
}
|
|
|
|
const { db, pool } = createClient(databaseUrl);
|
|
|
|
await db
|
|
.insert(operators)
|
|
.values({
|
|
username,
|
|
displayName: operatorName,
|
|
role: "admin",
|
|
defaultTimezone: "Asia/Kuala_Lumpur",
|
|
})
|
|
.onConflictDoNothing();
|
|
|
|
console.log(`Seeded operator '${username}'. Set a password via scripts/set-password.sh ${username}`);
|
|
await pool.end();
|