refactor: library type (#9525)

This commit is contained in:
Jason Rasmussen
2024-05-20 18:09:10 -04:00
committed by GitHub
parent 4353153fe6
commit 84d824d6a7
66 changed files with 183 additions and 984 deletions
+8 -6
View File
@@ -5,7 +5,6 @@ import { AlbumEntity, AssetOrder } from 'src/entities/album.entity';
import { AssetJobStatusEntity } from 'src/entities/asset-job-status.entity';
import { AssetEntity, AssetType } from 'src/entities/asset.entity';
import { ExifEntity } from 'src/entities/exif.entity';
import { LibraryType } from 'src/entities/library.entity';
import { PartnerEntity } from 'src/entities/partner.entity';
import { SmartInfoEntity } from 'src/entities/smart-info.entity';
import {
@@ -292,8 +291,13 @@ export class AssetRepository implements IAssetRepository {
}
@GenerateSql({ params: [DummyValue.UUID, DummyValue.BUFFER] })
getByChecksum(libraryId: string, checksum: Buffer): Promise<AssetEntity | null> {
return this.repository.findOne({ where: { libraryId, checksum } });
getByChecksum(libraryId: string | null, checksum: Buffer): Promise<AssetEntity | null> {
return this.repository.findOne({
where: {
libraryId: libraryId || IsNull(),
checksum,
},
});
}
@GenerateSql({ params: [DummyValue.UUID, DummyValue.BUFFER] })
@@ -303,9 +307,7 @@ export class AssetRepository implements IAssetRepository {
where: {
ownerId,
checksum,
library: {
type: LibraryType.UPLOAD,
},
library: IsNull(),
},
withDeleted: true,
});