tirbofish/kitgit · commit
a0369aaad4cae6ed4c7b72e61de6bbaa2c929b1c
feat: add in-app notifications for watched repos
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; @@ -234,6 +234,19 @@ pub struct CommitDay { pub count: i32, } +#[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 653 lines. Show full diff