Moew weork done

This commit is contained in:
Melody Becker 2024-09-12 16:57:53 +02:00
parent 814316ab1e
commit 07d98d1ef5
10 changed files with 147 additions and 16 deletions

View file

@ -6,6 +6,10 @@ import (
"gorm.io/gorm"
)
// MediaFile represents a file containing some media
// This media may be stored locally via a file system or S3 bucket
// or remote on a different server
// Additionally, it contains some useful data for more easily working with it
type MediaFile struct {
ID string `gorm:"primarykey"` // The unique ID of this media file
CreatedAt time.Time // When this entry was created
@ -15,13 +19,18 @@ type MediaFile struct {
// If not null, this entry is marked as deleted
DeletedAt gorm.DeletedAt `gorm:"index"`
Remote bool // whether the attachment is a remote one
Link string // url if remote attachment, identifier if local
Type string // What media type this is, eg image/png
// Always an url, either an absolute path to a local file or an url to a remote file
Link string
Type string // What media type this is following mime types, eg image/png
// Whether this media has been cached locally
// Only really used for user and server icons, not attachments
// Used for user and server icons as well as emotes, not attachments
// If true, Link will be read as file path. url otherwise
// Reason: Attachments would take way to much space considering that they are often only loaded a few times at most
// And caching a file for those few times would be a waste of storage
// Caching user and server icons locally however should reduce burden on remote servers by quite a bit though
// TODO: Decide later during usage if attachment caching would be a good idea
LocallyCached bool
// Descriptive name for a media file
// Emote name for example or servername.filetype for a server's icon
Name string
}