Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
etnoy committed Feb 8, 2025
1 parent 9217757 commit e66d025
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions server/src/queries/asset.repository.sql
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ with
where
"assets"."deletedAt" is null
and "assets"."isVisible" = $2
and "assets"."fileCreatedAt" is not null
and "assets"."fileModifiedAt" is not null
and "assets"."localDateTime" is not null
)
select
"timeBucket",
Expand Down
5 changes: 4 additions & 1 deletion server/src/queries/library.repository.sql
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ from
inner join "assets" on "assets"."libraryId" = "libraries"."id"
left join "exif" on "exif"."assetId" = "assets"."id"
where
"libraries"."id" = $6
"assets"."fileCreatedAt" is not null
and "assets"."fileModifiedAt" is not null
and "assets"."localDateTime" is not null
and "libraries"."id" = $6
group by
"libraries"."id"
select
Expand Down
3 changes: 0 additions & 3 deletions server/src/repositories/asset.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ export class AssetRepository implements IAssetRepository {
)
.innerJoin('exif', 'a.id', 'exif.assetId')
.selectAll('a')
.$narrowType<{ fileCreatedAt: NotNull }>()
.$narrowType<{ fileModifiedAt: NotNull }>()
.$narrowType<{ localDateTime: NotNull }>()
.select((eb) => eb.fn.toJson(eb.table('exif')).as('exifInfo')),
)
.selectFrom('res')
Expand Down
3 changes: 3 additions & 0 deletions server/src/repositories/library.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ export class LibraryRepository implements ILibraryRepository {
const stats = await this.db
.selectFrom('libraries')
.innerJoin('assets', 'assets.libraryId', 'libraries.id')
.where('assets.fileCreatedAt', 'is not', null)
.where('assets.fileModifiedAt', 'is not', null)
.where('assets.localDateTime', 'is not', null)
.leftJoin('exif', 'exif.assetId', 'assets.id')
.select((eb) =>
eb.fn
Expand Down

0 comments on commit e66d025

Please sign in to comment.