0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-21 00:52:43 -05:00

fix(server): Execute query in AlbumRepository.removeAsset method (#6216)

The current `removeAsset` implementation just builds the query but does
not execute it. That also seems to be the reason the `@GenerateSql`
decorator was commented out.
This commit is contained in:
Michael Manganiello 2024-01-06 12:56:08 -05:00 committed by GitHub
parent a233e176e5
commit 8921278447
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -177,14 +177,15 @@ export class AlbumRepository implements IAlbumRepository {
});
}
// @GenerateSql({ params: [DummyValue.UUID] })
@GenerateSql({ params: [DummyValue.UUID] })
async removeAsset(assetId: string): Promise<void> {
// Using dataSource, because there is no direct access to albums_assets_assets.
await this.dataSource
.createQueryBuilder()
.delete()
.from('albums_assets_assets')
.where('"albums_assets_assets"."assetsId" = :assetId', { assetId });
.where('"albums_assets_assets"."assetsId" = :assetId', { assetId })
.execute();
}
@GenerateSql({ params: [{ albumId: DummyValue.UUID, assetIds: [DummyValue.UUID] }] })

View file

@ -508,6 +508,11 @@ FROM
WHERE
"AlbumEntity"."deletedAt" IS NULL
-- AlbumRepository.removeAsset
DELETE FROM "albums_assets_assets"
WHERE
"albums_assets_assets"."assetsId" = $1
-- AlbumRepository.removeAssets
DELETE FROM "albums_assets_assets"
WHERE