updates to models and tags

This commit is contained in:
tsmethurst 2021-04-15 19:10:04 +02:00
commit f91ba5b304
16 changed files with 290 additions and 70 deletions

View file

@ -25,15 +25,15 @@ type Mention struct {
// ID of this mention in the database
ID string `pg:"type:uuid,default:gen_random_uuid(),pk,notnull,unique"`
// ID of the status this mention originates from
StatusID string
StatusID string `pg:",notnull"`
// When was this mention created?
CreatedAt time.Time `pg:"type:timestamp,notnull,default:now()"`
// When was this mention last updated?
UpdatedAt time.Time `pg:"type:timestamp,notnull,default:now()"`
// Who created this mention?
OriginAccountID string
OriginAccountID string `pg:",notnull"`
// Who does this mention target?
TargetAccountID string
TargetAccountID string `pg:",notnull"`
// Prevent this mention from generating a notification?
Silent bool
}

View file

@ -31,7 +31,13 @@ type Status struct {
// the html-formatted content of this status
Content string
// Database IDs of any media attachments associated with this status
Attachments []string
Attachments []string `pg:",array"`
// Database IDs of any tags used in this status
Tags []string `pg:",array"`
// Database IDs of any mentions in this status
Mentions []string `pg:",array"`
// Database IDs of any emojis used in this status
Emojis []string `pg:",array"`
// when was this status created?
CreatedAt time.Time `pg:"type:timestamp,notnull,default:now()"`
// when was this status updated?

View file

@ -20,17 +20,22 @@ package gtsmodel
import "time"
// Tag represents a hashtag for gathering public statuses together
type Tag struct {
ID string `pg:"type:uuid,default:gen_random_uuid(),pk,notnull"`
Name string `pg:"unique,notnull"`
CreatedAt time.Time `pg:"type:timestamp,notnull,default:now()"`
UpdatedAt time.Time `pg:"type:timestamp,notnull,default:now()"`
Useable bool
Trendable bool
Listable bool
ReviewedAt time.Time
RequestedReviewAt time.Time
LastStatusAt time.Time
MaxScore float32
MaxScoreAt time.Time
// id of this tag in the database
ID string `pg:",unique,type:uuid,default:gen_random_uuid(),pk,notnull"`
// name of this tag -- the tag without the hash part
Name string `pg:",unique,pk,notnull"`
// Which account ID is the first one we saw using this tag?
FirstSeenFromAccountID string
// when was this tag created
CreatedAt time.Time `pg:"type:timestamp,notnull,default:now()"`
// when was this tag last updated
UpdatedAt time.Time `pg:"type:timestamp,notnull,default:now()"`
// can our instance users use this tag?
Useable bool `pg:",notnull,default:true"`
// can our instance users look up this tag?
Listable bool `pg:",notnull,default:true"`
// when was this tag last used?
LastStatusAt time.Time `pg:"type:timestamp,notnull,default:now()"`
}