feat: DB-driven whitelist with is_admin, auto-register on /start, admin commands (/adduser /removeuser /users)

This commit is contained in:
2026-06-16 19:24:51 +02:00
parent 7c9db4d705
commit 89a00c3295
3 changed files with 166 additions and 58 deletions
+5 -1
View File
@@ -1,8 +1,12 @@
-- ============================================================
-- post-boot — runs after all migrations have been applied.
-- Grants INSERT/UPDATE to authenticator on user-facing tables.
-- (Run after 01-init.sql so tables exist.)
-- Seeds initial admin user (telegram_id 298181113).
-- ============================================================
GRANT INSERT, UPDATE ON search_queries TO authenticator;
GRANT INSERT, UPDATE ON notifications TO authenticator;
INSERT INTO users (telegram_id, username, first_name, is_admin, is_active)
VALUES (298181113, NULL, 'Admin', true, true)
ON CONFLICT (telegram_id) DO NOTHING;