chore(server): return duplicate assets as group (#9576)

* chore(server): return duplicate assets as group

* file name
This commit is contained in:
Alex
2024-05-18 13:15:56 -05:00
committed by GitHub
parent 9aed736911
commit 60427f18ce
4 changed files with 28 additions and 5 deletions

View File

@@ -1,7 +1,8 @@
import { Inject, Injectable } from '@nestjs/common';
import { SystemConfigCore } from 'src/cores/system-config.core';
import { AssetResponseDto, mapAsset } from 'src/dtos/asset-response.dto';
import { mapAsset } from 'src/dtos/asset-response.dto';
import { AuthDto } from 'src/dtos/auth.dto';
import { DuplicateResponseDto, mapDuplicateResponse } from 'src/dtos/duplicate.dto';
import { AssetEntity } from 'src/entities/asset.entity';
import { IAssetRepository, WithoutProperty } from 'src/interfaces/asset.interface';
import { ICryptoRepository } from 'src/interfaces/crypto.interface';
@@ -35,9 +36,10 @@ export class DuplicateService {
this.configCore = SystemConfigCore.create(systemMetadataRepository, logger);
}
async getDuplicates(auth: AuthDto): Promise<AssetResponseDto[]> {
async getDuplicates(auth: AuthDto): Promise<DuplicateResponseDto[]> {
const res = await this.assetRepository.getDuplicates({ userIds: [auth.user.id] });
return res.map((a) => mapAsset(a, { auth }));
return mapDuplicateResponse(res.map((a) => mapAsset(a, { auth })));
}
async handleQueueSearchDuplicates({ force }: IBaseJob): Promise<JobStatus> {