···11pub mod models;
22pub mod queries;
33+pub mod webhooks;
3445pub use models::{AuthSession, AuthState, StatusFromDb};
56pub use queries::{get_frequent_emojis, get_user_preferences, save_user_preferences};
77+pub use webhooks::{
88+ Webhook, create_webhook, delete_webhook, get_user_webhooks, rotate_webhook_secret,
99+ update_webhook,
1010+};
611712use async_sqlite::Pool;
813···5459 accent_color TEXT DEFAULT '#1DA1F2',
5560 updated_at INTEGER NOT NULL
5661 )",
6262+ [],
6363+ )
6464+ .unwrap();
6565+6666+ // webhooks
6767+ conn.execute(
6868+ "CREATE TABLE IF NOT EXISTS webhooks (
6969+ id INTEGER PRIMARY KEY AUTOINCREMENT,
7070+ did TEXT NOT NULL,
7171+ url TEXT NOT NULL,
7272+ secret TEXT NOT NULL,
7373+ events TEXT DEFAULT '*',
7474+ active BOOLEAN DEFAULT TRUE,
7575+ created_at INTEGER NOT NULL,
7676+ updated_at INTEGER NOT NULL
7777+ )",
7878+ [],
7979+ )
8080+ .unwrap();
8181+8282+ // index for fast lookups by did
8383+ conn.execute(
8484+ "CREATE INDEX IF NOT EXISTS idx_webhooks_did ON webhooks(did)",
5785 [],
5886 )
5987 .unwrap();