From c01b851fbf7b6dc5f4d8ae360fef26164b4c0bd0 Mon Sep 17 00:00:00 2001 From: mStar Date: Thu, 7 Nov 2024 10:48:48 +0100 Subject: [PATCH] Extend media metadata to include ownership --- storage/mediaFile.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/storage/mediaFile.go b/storage/mediaFile.go index 2c475e0..e2c6843 100644 --- a/storage/mediaFile.go +++ b/storage/mediaFile.go @@ -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 // If not null, this entry is marked as deleted DeletedAt gorm.DeletedAt `gorm:"index"` + OwnedBy string // Account id this media belongs to Remote bool // whether the attachment is a remote one // Where the media is stored. Url if remote file, file path if local Location string @@ -32,9 +33,12 @@ type MediaMetadata struct { 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)) newMedia := MediaMetadata{ + OwnedBy: ownerId, Location: location, Name: name, Type: mediaType,