Skip to content

Commit 7e83e14

Browse files
committed
Add EdgeDB notification schema
1 parent 723402b commit 7e83e14

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

dbschema/migrations/00008-m146fzf.edgeql

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dbschema/notifications.esdl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module default {
2+
abstract type Notification extending Mixin::Audited {
3+
readAt := .currentRecipient.readAt;
4+
unread := not exists .currentRecipient.readAt;
5+
single currentRecipient := assert_single((
6+
select .recipients filter .user = global currentUser
7+
));
8+
recipients := .<notification[is Notification::Recipient];
9+
}
10+
}
11+
12+
module Notification {
13+
type Recipient {
14+
required notification: default::Notification {
15+
on target delete delete source;
16+
};
17+
required user: default::User {
18+
on target delete delete source;
19+
};
20+
21+
readAt: datetime;
22+
}
23+
24+
type System extending default::Notification {
25+
required message: str;
26+
}
27+
abstract type Comment extending default::Notification {
28+
required comment: Comments::Comment {
29+
on target delete delete source;
30+
};
31+
}
32+
type CommentViaMention extending Comment;
33+
type CommentViaMembership extending Comment;
34+
}

0 commit comments

Comments
 (0)