1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-17 15:37:42 +02:00

fix(server): /search/random failing with certain options (#13040)

* fix relation handling, remove pagination

* update api, sql

* update mock
This commit is contained in:
Mert
2024-09-30 00:29:35 -04:00
committed by GitHub
parent 2f13db51df
commit 7adb35e59e
12 changed files with 250 additions and 62 deletions

View File

@ -383,7 +383,7 @@ class SearchApi {
/// Parameters:
///
/// * [RandomSearchDto] randomSearchDto (required):
Future<SearchResponseDto?> searchRandom(RandomSearchDto randomSearchDto,) async {
Future<List<AssetResponseDto>?> searchRandom(RandomSearchDto randomSearchDto,) async {
final response = await searchRandomWithHttpInfo(randomSearchDto,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@ -392,8 +392,11 @@ class SearchApi {
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SearchResponseDto',) as SearchResponseDto;
final responseBody = await _decodeBodyBytes(response);
return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
.cast<AssetResponseDto>()
.toList(growable: false);
}
return null;
}