fix(memories): scope album link cleanup to its owner

Confirm trip access and the scoped album link inside the transaction before handling related photos. Treat a missing link as a completed removal.
This commit is contained in:
Maurice
2026-11-30 22:10:18 +01:00
parent 8335ac45f9
commit 4d3f7fd355
3 changed files with 34 additions and 15 deletions
@@ -146,7 +146,7 @@ export class TripPhotosRepository extends TrekRepository<TripPhotos> {
.execute();
}
/** UM8 (`UnifiedMemoriesService.removeAlbumLink`'s pre-tx orphan-candidate list) — `SELECT photo_id FROM trip_photos WHERE trip_id = ? AND album_link_id = ?`. */
/** UM8 (`UnifiedMemoriesService.removeAlbumLink`, inside its transaction). */
async listPhotoIdsForAlbumLink(trip_id: number | string, album_link_id: number | string): Promise<number[]> {
const rows = await this.kysely<TripPhotosKyselyDB>()
.selectFrom('trip_photos')