1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-15 08:16:48 +01:00

fix(server): fix getByDayOfYear query (#14655)

* fix(server): fix getByDayOfYear query

* generate sql
This commit is contained in:
Alex 2024-12-11 14:51:56 -06:00 committed by GitHub
parent 71b48b11e6
commit 0c03753642
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View file

@ -71,7 +71,20 @@ FROM
INNER JOIN "asset_files" "files" ON "files"."assetId" = "entity"."id"
WHERE
(
"files"."type" = $1
"entity"."ownerId" IN ($1)
AND "entity"."isVisible" = true
AND "entity"."isArchived" = false
AND EXTRACT(
DAY
FROM
"entity"."localDateTime" AT TIME ZONE 'UTC'
) = $2
AND EXTRACT(
MONTH
FROM
"entity"."localDateTime" AT TIME ZONE 'UTC'
) = $3
AND "files"."type" = $4
AND EXTRACT(
YEAR
FROM

View file

@ -92,7 +92,7 @@ export class AssetRepository implements IAssetRepository {
)
.leftJoinAndSelect('entity.exifInfo', 'exifInfo')
.innerJoinAndSelect('entity.files', 'files')
.where('files.type = :type', { type: AssetFileType.THUMBNAIL })
.andWhere('files.type = :type', { type: AssetFileType.THUMBNAIL })
.andWhere(
`EXTRACT(YEAR FROM CURRENT_DATE AT TIME ZONE 'UTC') - EXTRACT(YEAR FROM entity.localDateTime AT TIME ZONE 'UTC') > 0`,
)