tirbofish/kitgit · commit
a64ae95c13394f4a54d2fe5295d59a1063a43fa6
merge: feat/notifications into integrate/all-features
Type: SSH
SSH Key Fingerprint:
Verified
SgQHY4vUORbJC3ZtdixCl62ek/4QGh/iG2FRSyjfGPc
@@ -0,0 +1,20 @@ +-- In-app notifications for watched repos and thread participants + +CREATE TABLE IF NOT EXISTS notifications ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, + kind TEXT NOT NULL, + title TEXT NOT NULL, + body TEXT NOT NULL DEFAULT '', + href TEXT NOT NULL DEFAULT '', + repo_id UUID REFERENCES repositories(id) ON DELETE SET NULL, + read_at TIMESTAMPTZ, + created_at TIMESTAMPTZ NOT NULL DEFAULT now() +); + +CREATE INDEX IF NOT EXISTS notifications_user_id_created_at_idx + ON notifications (user_id, created_at DESC); + +CREATE INDEX IF NOT EXISTS notifications_user_id_unread_idx + ON notifications (user_id) + WHERE read_at IS NULL; @@ -295,6 +295,19 @@ pub struct WebhookDelivery { pub created_at: DateTime<Utc>, } +#[derive(Debug, Clone, FromRow, Serialize)] +pub struct Notification { + pub id: Uuid, + pub user_id: Uuid, + pub kind: String, + pub title: String, + pub body: String, + pub href: String, + pub repo_id: Option<Uuid>, + pub read_at: Option<DateTime<Utc>>, + pub created_at: DateTime<Utc>, +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum Access {
Large diffs are not rendered by default. Showing the first 50 of 635 lines. Show full diff