Compare commits

...

2 Commits

Author SHA1 Message Date
Yaros
6873ca8685 fix(web): recent search doesn't use search type 2025-12-14 19:56:09 +01:00
Yaros
33cdea88aa fix(mobile): birthday off by one day on remote (#24527) 2025-12-11 21:23:11 -06:00
2 changed files with 22 additions and 27 deletions

View File

@@ -17,8 +17,10 @@ class PersonApiRepository extends ApiRepository {
}
Future<PersonDto> update(String id, {String? name, DateTime? birthday}) async {
final dto = await checkNull(_api.updatePerson(id, PersonUpdateDto(name: name, birthDate: birthday)));
return _toPerson(dto);
final birthdayUtc = birthday == null ? null : DateTime.utc(birthday.year, birthday.month, birthday.day);
final dto = PersonUpdateDto(name: name, birthDate: birthdayUtc);
final response = await checkNull(_api.updatePerson(id, dto));
return _toPerson(response);
}
static PersonDto _toPerson(PersonResponseDto dto) => PersonDto(

View File

@@ -79,10 +79,25 @@
searchStore.isSearchEnabled = false;
};
function buildSearchPayload(term: string): SmartSearchDto | MetadataSearchDto {
const searchType = getSearchType();
switch (searchType) {
case 'smart':
return { query: term } as SmartSearchDto;
case 'metadata':
return { originalFileName: term } as MetadataSearchDto;
case 'description':
return { description: term } as MetadataSearchDto;
case 'ocr':
return { ocr: term } as MetadataSearchDto;
default:
return { query: term } as SmartSearchDto;
}
}
const onHistoryTermClick = async (searchTerm: string) => {
value = searchTerm;
const searchPayload = { query: searchTerm };
await handleSearch(searchPayload);
await handleSearch(buildSearchPayload(searchTerm));
};
const onFilterClick = async () => {
@@ -112,29 +127,7 @@
};
const onSubmit = () => {
const searchType = getSearchType();
let payload = {} as SmartSearchDto | MetadataSearchDto;
switch (searchType) {
case 'smart': {
payload = { query: value } as SmartSearchDto;
break;
}
case 'metadata': {
payload = { originalFileName: value } as MetadataSearchDto;
break;
}
case 'description': {
payload = { description: value } as MetadataSearchDto;
break;
}
case 'ocr': {
payload = { ocr: value } as MetadataSearchDto;
break;
}
}
handlePromiseError(handleSearch(payload));
handlePromiseError(handleSearch(buildSearchPayload(value)));
saveSearchTerm(value);
};