oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package notifications
2
3import (
4 "amadan.net/oficina/equipo/internal/equipo/personapi"
5 "time"
6)
7
8type Notification = personapi.Notification
9type NotificationSubscription = personapi.NotificationSubscription
10
11type Event struct {
12 Sequence int64 `gorm:"primaryKey;autoIncrement;index:notification_feed,priority:3"`
13 ID string `gorm:"uniqueIndex:notification_id;not null"`
14 TeamID string `gorm:"uniqueIndex:notification_event,priority:1;index:notification_feed,priority:1;not null"`
15 Recipient string `gorm:"uniqueIndex:notification_event,priority:2;index:notification_feed,priority:2;not null"`
16 Event string `gorm:"uniqueIndex:notification_event,priority:3;not null"`
17 ResourceID string `gorm:"uniqueIndex:notification_event,priority:4;not null"`
18 ResourceRevision int64 `gorm:"uniqueIndex:notification_event,priority:5;not null"`
19 Kind, ResourceType, DeepLink, State string
20 CreatedAt time.Time
21 AcknowledgedAt *time.Time
22}
23
24func (Event) TableName() string { return "notification_outbox" }
25
26type Subscription struct {
27 ID string `gorm:"primaryKey"`
28 TeamID, Person string
29 DeviceID string `gorm:"index:notification_device"`
30 Revision, AckSequence int64
31 Active bool
32 CreatedAt, ExpiresAt time.Time
33}
34
35func (Subscription) TableName() string { return "notification_subscriptions" }
36
37type Delivery struct {
38 SubscriptionID string `gorm:"primaryKey"`
39 Sequence int64 `gorm:"primaryKey;autoIncrement:false"`
40 DeliveredAt time.Time
41 AcknowledgedAt *time.Time
42}
43
44func (Delivery) TableName() string { return "notification_deliveries" }
45
46type History struct {
47 TeamID, Person string `gorm:"primaryKey"`
48 PrunedThrough int64
49}
50
51func (History) TableName() string { return "notification_history" }
52
53var Models = []any{&Event{}, &Subscription{}, &Delivery{}, &History{}}
54