Extend media metadata to include ownership

This commit is contained in:
Melody Becker 2024-11-07 10:48:48 +01:00
parent 54ccbaa96e
commit c01b851fbf

View file

@ -19,6 +19,7 @@ type MediaMetadata struct {
// Soft delete means that this entry still exists in the db, but gorm won't include it anymore unless specifically told to // 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 // If not null, this entry is marked as deleted
DeletedAt gorm.DeletedAt `gorm:"index"` DeletedAt gorm.DeletedAt `gorm:"index"`
OwnedBy string // Account id this media belongs to
Remote bool // whether the attachment is a remote one Remote bool // whether the attachment is a remote one
// Where the media is stored. Url if remote file, file path if local // Where the media is stored. Url if remote file, file path if local
Location string Location string
@ -32,9 +33,12 @@ type MediaMetadata struct {
Blurred bool Blurred bool
} }
func (s *Storage) NewMediaMetadata(location, mediaType, name string) (*MediaMetadata, error) { func (s *Storage) NewMediaMetadata(
ownerId, location, mediaType, name string,
) (*MediaMetadata, error) {
defer util.Untrace(util.Trace(&log.Logger)) defer util.Untrace(util.Trace(&log.Logger))
newMedia := MediaMetadata{ newMedia := MediaMetadata{
OwnedBy: ownerId,
Location: location, Location: location,
Name: name, Name: name,
Type: mediaType, Type: mediaType,