This commit is contained in:
parent
b6f12b7acf
commit
8f8ad3035a
33 changed files with 166 additions and 111 deletions
|
@ -6,14 +6,7 @@ import (
|
|||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// User created content, containing some message, maybe attachments,
|
||||
// tags, pings or other extra things
|
||||
//
|
||||
// Data defined in extra structs (links are included at the bottom):
|
||||
// - Attachments: models.NoteToAttachment
|
||||
// - Emotes: models.NoteToEmote
|
||||
// - Pings: models.NoteToPing
|
||||
// - Tags: models.NoteTag
|
||||
// A note describes some user generated text content.
|
||||
type Note struct {
|
||||
ID string `gorm:"primarykey;type:uuid;default:gen_random_uuid()"` // Make ID a string (uuid) for other implementations
|
||||
CreatedAt time.Time // When this entry was created
|
||||
|
@ -22,9 +15,9 @@ type Note struct {
|
|||
// Soft delete means that this entry still exists in the db, but gorm won't include it anymore unless specifically told to
|
||||
// If not null, this entry is marked as deleted
|
||||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||
Creator User
|
||||
CreatorId string
|
||||
Remote bool // Whether the note is originally a remote one and just "cached"
|
||||
Creator User // The user that created this note
|
||||
CreatorId string // Id of the creator user
|
||||
Remote bool // Whether the note is originally a remote one and just "cached"
|
||||
// Raw content of the note. So without additional formatting applied
|
||||
// Might already have formatting applied beforehand from the origin server
|
||||
RawContent string
|
||||
|
@ -34,8 +27,8 @@ type Note struct {
|
|||
AccessLevel NoteAccessLevel // Where to send this message to (public, home, followers, dm)
|
||||
OriginServer string // Url of the origin server. Also the primary key for those
|
||||
|
||||
AttachmentRelations []NoteToAttachment `gorm:"foreignKey:NoteId"`
|
||||
EmoteRelations []NoteToEmote `gorm:"foreignKey:NoteId"`
|
||||
PingRelations []NoteToPing `gorm:"foreignKey:NoteId"`
|
||||
Tags []NoteTag `gorm:"foreignKey:NoteId"`
|
||||
AttachmentRelations []NoteToAttachment `gorm:"foreignKey:NoteId"` // Attachments added on to this note
|
||||
EmoteRelations []NoteToEmote `gorm:"foreignKey:NoteId"` // Emotes used in this note
|
||||
PingRelations []NoteToPing `gorm:"foreignKey:NoteId"` // Pings/mentions this note performs
|
||||
Tags []NoteTag `gorm:"foreignKey:NoteId"` // Tags this note contains
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue