mirror of
https://github.com/immich-app/immich.git
synced 2025-12-20 09:15:35 +03:00
fix(server): handle 5 digit years (#6457)
This commit is contained in:
@@ -687,7 +687,7 @@ export class AssetRepository implements IAssetRepository {
|
||||
const truncated = dateTrunc(options);
|
||||
return (
|
||||
this.getBuilder(options)
|
||||
.andWhere(`${truncated} = :timeBucket`, { timeBucket })
|
||||
.andWhere(`${truncated} = :timeBucket`, { timeBucket: timeBucket.replace(/^[+-]/, '') })
|
||||
// First sort by the day in localtime (put it in the right bucket)
|
||||
.orderBy(truncated, 'DESC')
|
||||
// and then sort by the actual time
|
||||
@@ -757,10 +757,7 @@ export class AssetRepository implements IAssetRepository {
|
||||
private getBuilder(options: AssetBuilderOptions) {
|
||||
const { isArchived, isFavorite, isTrashed, albumId, personId, userIds, withStacked, exifInfo, assetType } = options;
|
||||
|
||||
let builder = this.repository
|
||||
.createQueryBuilder('asset')
|
||||
.where('asset.isVisible = true')
|
||||
.andWhere('asset.fileCreatedAt < NOW()');
|
||||
let builder = this.repository.createQueryBuilder('asset').where('asset.isVisible = true');
|
||||
if (assetType !== undefined) {
|
||||
builder = builder.andWhere('asset.type = :assetType', { assetType });
|
||||
}
|
||||
|
||||
@@ -553,10 +553,7 @@ FROM
|
||||
LEFT JOIN "assets" "stack" ON "stack"."stackParentId" = "asset"."id"
|
||||
AND ("stack"."deletedAt" IS NULL)
|
||||
WHERE
|
||||
(
|
||||
"asset"."isVisible" = true
|
||||
AND "asset"."fileCreatedAt" < NOW()
|
||||
)
|
||||
("asset"."isVisible" = true)
|
||||
AND ("asset"."deletedAt" IS NULL)
|
||||
GROUP BY
|
||||
(
|
||||
@@ -668,7 +665,6 @@ FROM
|
||||
WHERE
|
||||
(
|
||||
"asset"."isVisible" = true
|
||||
AND "asset"."fileCreatedAt" < NOW()
|
||||
AND (
|
||||
date_trunc(
|
||||
'month',
|
||||
@@ -708,7 +704,6 @@ FROM
|
||||
WHERE
|
||||
(
|
||||
"asset"."isVisible" = true
|
||||
AND "asset"."fileCreatedAt" < NOW()
|
||||
AND "asset"."type" = $2
|
||||
AND "asset"."ownerId" IN ($3)
|
||||
AND "asset"."isArchived" = $4
|
||||
@@ -739,7 +734,6 @@ FROM
|
||||
WHERE
|
||||
(
|
||||
"asset"."isVisible" = true
|
||||
AND "asset"."fileCreatedAt" < NOW()
|
||||
AND "asset"."type" = $2
|
||||
AND "asset"."ownerId" IN ($3)
|
||||
AND "asset"."isArchived" = $4
|
||||
@@ -761,7 +755,6 @@ FROM
|
||||
WHERE
|
||||
(
|
||||
"asset"."isVisible" = true
|
||||
AND "asset"."fileCreatedAt" < NOW()
|
||||
AND "asset"."ownerId" IN ($1)
|
||||
AND "asset"."isArchived" = $2
|
||||
AND (
|
||||
|
||||
Reference in New Issue
Block a user