feat: adds option to search only for untagged assets (#19730)

Co-authored-by: SkwalExe <skwal@skwal.net>
This commit is contained in:
Léopold Koprivnik 2025-07-10 16:28:20 +02:00 committed by GitHub
parent 818bdde317
commit f778adea92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 75 additions and 23 deletions

View file

@ -307,6 +307,9 @@ export function searchAssetBuilder(kysely: Kysely<DB>, options: AssetSearchBuild
.where('assets.visibility', '=', visibility)
.$if(!!options.albumIds && options.albumIds.length > 0, (qb) => inAlbums(qb, options.albumIds!))
.$if(!!options.tagIds && options.tagIds.length > 0, (qb) => hasTags(qb, options.tagIds!))
.$if(options.tagIds === null, (qb) =>
qb.where((eb) => eb.not(eb.exists((eb) => eb.selectFrom('tag_asset').whereRef('assetsId', '=', 'assets.id')))),
)
.$if(!!options.personIds && options.personIds.length > 0, (qb) => hasPeople(qb, options.personIds!))
.$if(!!options.createdBefore, (qb) => qb.where('assets.createdAt', '<=', options.createdBefore!))
.$if(!!options.createdAfter, (qb) => qb.where('assets.createdAt', '>=', options.createdAfter!))