mirror of
https://github.com/Art051/immich.git
synced 2025-08-11 19:29:00 +00:00
feat(server, web): album orders (#7819)
* feat: album orders * fix: tests * pr feedback * pr feedback * pr feedback * fix: tests * add comment * pr feedback * fix: rendering issue * wording * fix: order value doesn't change --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
@@ -36,7 +36,7 @@ import {
|
||||
Not,
|
||||
Repository,
|
||||
} from 'typeorm';
|
||||
import { AssetEntity, AssetJobStatusEntity, AssetType, ExifEntity, SmartInfoEntity } from '../entities';
|
||||
import { AssetEntity, AssetJobStatusEntity, AssetOrder, AssetType, ExifEntity, SmartInfoEntity } from '../entities';
|
||||
import { DummyValue, GenerateSql } from '../infra.util';
|
||||
import { Chunked, ChunkedArray, OptionalBetween, paginate, paginatedBuilder, searchAssetBuilder } from '../infra.utils';
|
||||
import { Instrumentation } from '../instrumentation';
|
||||
@@ -607,7 +607,7 @@ export class AssetRepository implements IAssetRepository {
|
||||
.select(`COUNT(asset.id)::int`, 'count')
|
||||
.addSelect(truncated, 'timeBucket')
|
||||
.groupBy(truncated)
|
||||
.orderBy(truncated, 'DESC')
|
||||
.orderBy(truncated, options.order === AssetOrder.ASC ? 'ASC' : 'DESC')
|
||||
.getRawMany();
|
||||
}
|
||||
|
||||
@@ -620,7 +620,7 @@ export class AssetRepository implements IAssetRepository {
|
||||
// First sort by the day in localtime (put it in the right bucket)
|
||||
.orderBy(truncated, 'DESC')
|
||||
// and then sort by the actual time
|
||||
.addOrderBy('asset.fileCreatedAt', 'DESC')
|
||||
.addOrderBy('asset.fileCreatedAt', options.order === AssetOrder.ASC ? 'ASC' : 'DESC')
|
||||
.getMany()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user