mirror of
https://github.com/immich-app/immich.git
synced 2026-03-07 10:37:22 +03:00
feat(server): immich checksum header (#9229)
* feat: dedupe by checksum header * chore: open api
This commit is contained in:
@@ -5,6 +5,7 @@ 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 {
|
||||
@@ -273,6 +274,23 @@ export class AssetRepository implements IAssetRepository {
|
||||
return this.repository.findOne({ where: { libraryId, checksum } });
|
||||
}
|
||||
|
||||
@GenerateSql({ params: [DummyValue.UUID, DummyValue.BUFFER] })
|
||||
async getUploadAssetIdByChecksum(ownerId: string, checksum: Buffer): Promise<string | undefined> {
|
||||
const asset = await this.repository.findOne({
|
||||
select: { id: true },
|
||||
where: {
|
||||
ownerId,
|
||||
checksum,
|
||||
library: {
|
||||
type: LibraryType.UPLOAD,
|
||||
},
|
||||
},
|
||||
withDeleted: true,
|
||||
});
|
||||
|
||||
return asset?.id;
|
||||
}
|
||||
|
||||
findLivePhotoMatch(options: LivePhotoSearchOptions): Promise<AssetEntity | null> {
|
||||
const { ownerId, otherAssetId, livePhotoCID, type } = options;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user