feat(photos): fix trash permanent delete and add empty trash
Permanently deleting a photo whose album was deleted failed because authorization resolved through the album. Fall back to uploader ownership when the photo is albumless. Add a bulk DELETE /trash that removes every trashed photo the caller may delete (uncapped listing) and returns the deleted count, with an «Очистить корзину» action on the trash screen.
This commit is contained in:
@@ -7,6 +7,14 @@ import (
|
||||
"galo/internal/models"
|
||||
)
|
||||
|
||||
// TrashIdentity is the minimal fact set needed to authorize a trashed photo
|
||||
// during a bulk purge without loading the full photo.
|
||||
type TrashIdentity struct {
|
||||
ID string
|
||||
AlbumID string
|
||||
UploaderID string
|
||||
}
|
||||
|
||||
// Repository is the persistence contract for the photos domain, including the
|
||||
// object ledger, variant queue and garbage collection.
|
||||
type Repository interface {
|
||||
@@ -19,6 +27,9 @@ type Repository interface {
|
||||
Clone(ctx context.Context, src *models.Photo, albumID, uploaderID, id string) error
|
||||
HardDelete(ctx context.Context, id string) error
|
||||
ListTrash(ctx context.Context, userID string) ([]models.Photo, error)
|
||||
// ListTrashIdentities returns every trashed photo accessible to the user
|
||||
// (no display cap) so a bulk purge can authorize and remove each one.
|
||||
ListTrashIdentities(ctx context.Context, userID string) ([]TrashIdentity, error)
|
||||
TrashCount(ctx context.Context, userID string) (int, error)
|
||||
RestoreToAlbum(ctx context.Context, id, albumID string) error
|
||||
AlbumExists(ctx context.Context, albumID string) (bool, error)
|
||||
|
||||
Reference in New Issue
Block a user