feat(server): Add album filter to search (#18985)

* - updated dtos
- added inAlbums to search builder
- only check isNotInAlbum if albumIds is blank/empty

* - consider inAlbums as OR

* - make open-api-dart

* - lint & format

* - remove inAlbums groupBy clause

* - merge main open-api

* - make open-api

* - inAlbums filter AND instead of OR
This commit is contained in:
xCJPECKOVERx 2025-06-09 11:11:43 -04:00 committed by GitHub
parent 242817c49a
commit 14d785cec9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 97 additions and 6 deletions

View file

@ -13,6 +13,7 @@ part of openapi.api;
class SmartSearchDto {
/// Returns a new [SmartSearchDto] instance.
SmartSearchDto({
this.albumIds = const [],
this.city,
this.country,
this.createdAfter,
@ -47,6 +48,8 @@ class SmartSearchDto {
this.withExif,
});
List<String> albumIds;
String? city;
String? country;
@ -256,6 +259,7 @@ class SmartSearchDto {
@override
bool operator ==(Object other) => identical(this, other) || other is SmartSearchDto &&
_deepEquality.equals(other.albumIds, albumIds) &&
other.city == city &&
other.country == country &&
other.createdAfter == createdAfter &&
@ -292,6 +296,7 @@ class SmartSearchDto {
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(albumIds.hashCode) +
(city == null ? 0 : city!.hashCode) +
(country == null ? 0 : country!.hashCode) +
(createdAfter == null ? 0 : createdAfter!.hashCode) +
@ -326,10 +331,11 @@ class SmartSearchDto {
(withExif == null ? 0 : withExif!.hashCode);
@override
String toString() => 'SmartSearchDto[city=$city, country=$country, createdAfter=$createdAfter, createdBefore=$createdBefore, deviceId=$deviceId, isEncoded=$isEncoded, isFavorite=$isFavorite, isMotion=$isMotion, isNotInAlbum=$isNotInAlbum, isOffline=$isOffline, language=$language, lensModel=$lensModel, libraryId=$libraryId, make=$make, model=$model, page=$page, personIds=$personIds, query=$query, rating=$rating, size=$size, state=$state, tagIds=$tagIds, takenAfter=$takenAfter, takenBefore=$takenBefore, trashedAfter=$trashedAfter, trashedBefore=$trashedBefore, type=$type, updatedAfter=$updatedAfter, updatedBefore=$updatedBefore, visibility=$visibility, withDeleted=$withDeleted, withExif=$withExif]';
String toString() => 'SmartSearchDto[albumIds=$albumIds, city=$city, country=$country, createdAfter=$createdAfter, createdBefore=$createdBefore, deviceId=$deviceId, isEncoded=$isEncoded, isFavorite=$isFavorite, isMotion=$isMotion, isNotInAlbum=$isNotInAlbum, isOffline=$isOffline, language=$language, lensModel=$lensModel, libraryId=$libraryId, make=$make, model=$model, page=$page, personIds=$personIds, query=$query, rating=$rating, size=$size, state=$state, tagIds=$tagIds, takenAfter=$takenAfter, takenBefore=$takenBefore, trashedAfter=$trashedAfter, trashedBefore=$trashedBefore, type=$type, updatedAfter=$updatedAfter, updatedBefore=$updatedBefore, visibility=$visibility, withDeleted=$withDeleted, withExif=$withExif]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'albumIds'] = this.albumIds;
if (this.city != null) {
json[r'city'] = this.city;
} else {
@ -490,6 +496,9 @@ class SmartSearchDto {
final json = value.cast<String, dynamic>();
return SmartSearchDto(
albumIds: json[r'albumIds'] is Iterable
? (json[r'albumIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
city: mapValueOfType<String>(json, r'city'),
country: mapValueOfType<String>(json, r'country'),
createdAfter: mapDateTime(json, r'createdAfter', r''),