summaryrefslogtreecommitdiff
path: root/internal/gtsmodel/notification.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-08-20 12:26:56 +0200
committerLibravatar GitHub <noreply@github.com>2021-08-20 12:26:56 +0200
commit4920229a3b6e1d7dde536bc9ff766542b05d935c (patch)
treea9423beccec5331c372f01eedf38949dfb171e9e /internal/gtsmodel/notification.go
parentText/status parsing fixes (#141) (diff)
downloadgotosocial-4920229a3b6e1d7dde536bc9ff766542b05d935c.tar.xz
Database updates (#144)
* start moving some database stuff around * continue moving db stuff around * more fiddling * more updates * and some more * and yet more * i broke SOMETHING but what, it's a mystery * tidy up * vendor ttlcache * use ttlcache * fix up some tests * rename some stuff * little reminder * some more updates
Diffstat (limited to 'internal/gtsmodel/notification.go')
-rw-r--r--internal/gtsmodel/notification.go20
1 files changed, 6 insertions, 14 deletions
diff --git a/internal/gtsmodel/notification.go b/internal/gtsmodel/notification.go
index efd4fe484..b85bc969e 100644
--- a/internal/gtsmodel/notification.go
+++ b/internal/gtsmodel/notification.go
@@ -29,24 +29,16 @@ type Notification struct {
// Creation time of this notification
CreatedAt time.Time `pg:"type:timestamp,notnull,default:now()"`
// Which account does this notification target (ie., who will receive the notification?)
- TargetAccountID string `pg:"type:CHAR(26),notnull"`
+ TargetAccountID string `pg:"type:CHAR(26),notnull"`
+ TargetAccount *Account `pg:"rel:has-one"`
// Which account performed the action that created this notification?
- OriginAccountID string `pg:"type:CHAR(26),notnull"`
+ OriginAccountID string `pg:"type:CHAR(26),notnull"`
+ OriginAccount *Account `pg:"rel:has-one"`
// If the notification pertains to a status, what is the database ID of that status?
- StatusID string `pg:"type:CHAR(26)"`
+ StatusID string `pg:"type:CHAR(26)"`
+ Status *Status `pg:"rel:has-one"`
// Has this notification been read already?
Read bool
-
- /*
- NON-DATABASE fields
- */
-
- // gts model of the target account, won't be put in the database, it's just for convenience when passing the notification around.
- GTSTargetAccount *Account `pg:"-"`
- // gts model of the origin account, won't be put in the database, it's just for convenience when passing the notification around.
- GTSOriginAccount *Account `pg:"-"`
- // gts model of the relevant status, won't be put in the database, it's just for convenience when passing the notification around.
- GTSStatus *Status `pg:"-"`
}
// NotificationType describes the reason/type of this notification.