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:
parent
71b48b11e6
commit
0c03753642
2 changed files with 15 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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`,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue