summaryrefslogtreecommitdiff
path: root/internal/service/media_access.go
AgeCommit message (Collapse)Author
2026-05-03task 2: decompose mediaService and adminService into role-focused structsPaul Buetow
Extract accessHelper and split mediaService into: - browseService (read-only browsing, streaming, thumbnails) - writeService (upload, soft-delete, restore) - shareService (share links) - tagService (tagging) - favService (favorites) - noteService (notes) Split adminService into: - trashService (list deleted media) - scanService (trigger rescan, scan progress) - userAdminService (create/list/delete users) - permissionAdminService (grant/revoke/list permissions) Add repository sub-interfaces for each service. Add negative tests for share sub-service.
2026-05-01task 4: DRY permission checking by extracting checkSetPermission helperPaul Buetow
Consolidates the duplicated user-admin, explicit permission, and set.Permissions loop logic from verifyAccess, verifyModifyAccess, and verifySetModifyAccess into a single checkSetPermission helper. - checkSetPermission accepts a requiredRole; empty string means any role. - verifyAccess delegates set-level permission check to helper. - verifyModifyAccess delegates owner-only check to helper. - verifySetModifyAccess delegates directly to helper. All tests pass with -race -cover.
2026-05-01service: split media.go (745 lines) into 5 focused filesPaul Buetow
Split the monolithic media.go into cohesive files to fix KISS/SRP violation: - media_access.go: permission verification helpers (verifyAccess, verifyModifyAccess, verifySetModifyAccess) - media_browse.go: browsing, listing, streaming, thumbnails, set cover, tags and favorites - media_write.go: upload, create, soft-delete, restore - media_share.go: share token creation, validation, revocation, streaming via token - media_notes.go: note get/upsert/delete The shared mediaService struct, NewMediaService constructor, and common helpers (supported extensions, type guessing, thumbnail generation) remain in media.go. No functional changes — all tests pass.