2024-05-31 09:54:39 +00:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"gorm.io/gorm"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Note struct {
|
|
|
|
ID string `gorm:"primarykey"` // Make ID a string (uuid) for other implementations
|
|
|
|
CreatedAt time.Time
|
|
|
|
UpdatedAt time.Time
|
|
|
|
DeletedAt gorm.DeletedAt `gorm:"index"`
|
|
|
|
Creator string // Full handle of the creator, eg: @max@example.com
|
|
|
|
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
|
|
|
|
ContentWarning *string // Content warnings of the note, if it contains any
|
|
|
|
Attachments []string `gorm:"serializer:json"` // Links to attachments
|
|
|
|
Emotes []string `gorm:"serializer:json"` // Emotes used in that message
|
|
|
|
RepliesTo *string // Url of the message this replies to
|
|
|
|
Quotes *string // url of the message this note quotes
|
|
|
|
Target NoteTarget // Where to send this message to (public, home, followers, dm)
|
|
|
|
Pings []string `gorm:"serializer:json"` // Who is being tagged in this message. Also serves as DM targets
|
|
|
|
OriginServer string // Url of the origin server. Also the primary key for those
|
|
|
|
Tags []string `gorm:"serializer:json"` // Hashtags
|
|
|
|
}
|
2024-05-31 15:21:29 +00:00
|
|
|
|
|
|
|
var placeholderNote = &Note{
|
|
|
|
ID: "placeholder",
|
|
|
|
Creator: "placeholder",
|
|
|
|
Remote: false,
|
|
|
|
RawContent: "placeholder",
|
|
|
|
ContentWarning: nil,
|
|
|
|
Attachments: []string{},
|
|
|
|
Emotes: []string{},
|
|
|
|
RepliesTo: nil,
|
|
|
|
Quotes: nil,
|
|
|
|
Target: NOTE_TARGET_HOME,
|
|
|
|
Pings: []string{},
|
|
|
|
OriginServer: "placeholder",
|
|
|
|
Tags: []string{},
|
|
|
|
}
|