1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02:00

feat(server): sort images in duplicate groups by date (#12094)

* feat(server): sort images in duplicate groups by date

* Update server/src/dtos/duplicate.dto.ts

Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com>

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com>
This commit is contained in:
Geoffrey Frogeye 2024-08-28 21:59:09 +02:00 committed by GitHub
parent 363c558db7
commit 562fec6e2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,5 @@
import { IsNotEmpty } from 'class-validator';
import { groupBy } from 'lodash';
import { groupBy, sortBy } from 'lodash';
import { AssetResponseDto } from 'src/dtos/asset-response.dto';
import { ValidateUUID } from 'src/validation';
@ -19,7 +19,8 @@ export function mapDuplicateResponse(assets: AssetResponseDto[]): DuplicateRespo
const grouped = groupBy(assets, (a) => a.duplicateId);
for (const [duplicateId, assets] of Object.entries(grouped)) {
for (const [duplicateId, unsortedAssets] of Object.entries(grouped)) {
const assets = sortBy(unsortedAssets, (asset) => asset.localDateTime);
result.push({ duplicateId, assets });
}