You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-09 23:17:29 +02:00
feat: postgres reverse geocoding (#5301)
* feat: add system metadata repository for storing key values for internal usage * feat: add database entities for geodata * feat: move reverse geocoding from local-reverse-geocoder to postgresql * infra: disable synchronization for geodata_places table until typeorm supports earth column * feat: remove cities override config as we will default all instances to cities500 now * test: e2e tests don't clear geodata tables on reset
This commit is contained in:
3
mobile/openapi/.openapi-generator/FILES
generated
3
mobile/openapi/.openapi-generator/FILES
generated
@@ -46,7 +46,6 @@ doc/CQMode.md
|
||||
doc/ChangePasswordDto.md
|
||||
doc/CheckExistingAssetsDto.md
|
||||
doc/CheckExistingAssetsResponseDto.md
|
||||
doc/CitiesFile.md
|
||||
doc/ClassificationConfig.md
|
||||
doc/Colorspace.md
|
||||
doc/CreateAlbumDto.md
|
||||
@@ -231,7 +230,6 @@ lib/model/bulk_ids_dto.dart
|
||||
lib/model/change_password_dto.dart
|
||||
lib/model/check_existing_assets_dto.dart
|
||||
lib/model/check_existing_assets_response_dto.dart
|
||||
lib/model/cities_file.dart
|
||||
lib/model/classification_config.dart
|
||||
lib/model/clip_config.dart
|
||||
lib/model/clip_mode.dart
|
||||
@@ -388,7 +386,6 @@ test/bulk_ids_dto_test.dart
|
||||
test/change_password_dto_test.dart
|
||||
test/check_existing_assets_dto_test.dart
|
||||
test/check_existing_assets_response_dto_test.dart
|
||||
test/cities_file_test.dart
|
||||
test/classification_config_test.dart
|
||||
test/clip_config_test.dart
|
||||
test/clip_mode_test.dart
|
||||
|
1
mobile/openapi/README.md
generated
1
mobile/openapi/README.md
generated
@@ -244,7 +244,6 @@ Class | Method | HTTP request | Description
|
||||
- [ChangePasswordDto](doc//ChangePasswordDto.md)
|
||||
- [CheckExistingAssetsDto](doc//CheckExistingAssetsDto.md)
|
||||
- [CheckExistingAssetsResponseDto](doc//CheckExistingAssetsResponseDto.md)
|
||||
- [CitiesFile](doc//CitiesFile.md)
|
||||
- [ClassificationConfig](doc//ClassificationConfig.md)
|
||||
- [Colorspace](doc//Colorspace.md)
|
||||
- [CreateAlbumDto](doc//CreateAlbumDto.md)
|
||||
|
14
mobile/openapi/doc/CitiesFile.md
generated
14
mobile/openapi/doc/CitiesFile.md
generated
@@ -1,14 +0,0 @@
|
||||
# openapi.model.CitiesFile
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@@ -8,7 +8,6 @@ import 'package:openapi/api.dart';
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**citiesFileOverride** | [**CitiesFile**](CitiesFile.md) | |
|
||||
**enabled** | **bool** | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
1
mobile/openapi/lib/api.dart
generated
1
mobile/openapi/lib/api.dart
generated
@@ -83,7 +83,6 @@ part 'model/cq_mode.dart';
|
||||
part 'model/change_password_dto.dart';
|
||||
part 'model/check_existing_assets_dto.dart';
|
||||
part 'model/check_existing_assets_response_dto.dart';
|
||||
part 'model/cities_file.dart';
|
||||
part 'model/classification_config.dart';
|
||||
part 'model/colorspace.dart';
|
||||
part 'model/create_album_dto.dart';
|
||||
|
2
mobile/openapi/lib/api_client.dart
generated
2
mobile/openapi/lib/api_client.dart
generated
@@ -255,8 +255,6 @@ class ApiClient {
|
||||
return CheckExistingAssetsDto.fromJson(value);
|
||||
case 'CheckExistingAssetsResponseDto':
|
||||
return CheckExistingAssetsResponseDto.fromJson(value);
|
||||
case 'CitiesFile':
|
||||
return CitiesFileTypeTransformer().decode(value);
|
||||
case 'ClassificationConfig':
|
||||
return ClassificationConfig.fromJson(value);
|
||||
case 'Colorspace':
|
||||
|
3
mobile/openapi/lib/api_helper.dart
generated
3
mobile/openapi/lib/api_helper.dart
generated
@@ -73,9 +73,6 @@ String parameterToString(dynamic value) {
|
||||
if (value is CQMode) {
|
||||
return CQModeTypeTransformer().encode(value).toString();
|
||||
}
|
||||
if (value is CitiesFile) {
|
||||
return CitiesFileTypeTransformer().encode(value).toString();
|
||||
}
|
||||
if (value is Colorspace) {
|
||||
return ColorspaceTypeTransformer().encode(value).toString();
|
||||
}
|
||||
|
91
mobile/openapi/lib/model/cities_file.dart
generated
91
mobile/openapi/lib/model/cities_file.dart
generated
@@ -1,91 +0,0 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
|
||||
class CitiesFile {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const CitiesFile._(this.value);
|
||||
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
static const cities15000 = CitiesFile._(r'cities15000');
|
||||
static const cities5000 = CitiesFile._(r'cities5000');
|
||||
static const cities1000 = CitiesFile._(r'cities1000');
|
||||
static const cities500 = CitiesFile._(r'cities500');
|
||||
|
||||
/// List of all possible values in this [enum][CitiesFile].
|
||||
static const values = <CitiesFile>[
|
||||
cities15000,
|
||||
cities5000,
|
||||
cities1000,
|
||||
cities500,
|
||||
];
|
||||
|
||||
static CitiesFile? fromJson(dynamic value) => CitiesFileTypeTransformer().decode(value);
|
||||
|
||||
static List<CitiesFile>? listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <CitiesFile>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = CitiesFile.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [CitiesFile] to String,
|
||||
/// and [decode] dynamic data back to [CitiesFile].
|
||||
class CitiesFileTypeTransformer {
|
||||
factory CitiesFileTypeTransformer() => _instance ??= const CitiesFileTypeTransformer._();
|
||||
|
||||
const CitiesFileTypeTransformer._();
|
||||
|
||||
String encode(CitiesFile data) => data.value;
|
||||
|
||||
/// Decodes a [dynamic value][data] to a CitiesFile.
|
||||
///
|
||||
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
||||
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
||||
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
||||
///
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
CitiesFile? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case r'cities15000': return CitiesFile.cities15000;
|
||||
case r'cities5000': return CitiesFile.cities5000;
|
||||
case r'cities1000': return CitiesFile.cities1000;
|
||||
case r'cities500': return CitiesFile.cities500;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [CitiesFileTypeTransformer] instance.
|
||||
static CitiesFileTypeTransformer? _instance;
|
||||
}
|
||||
|
@@ -13,31 +13,25 @@ part of openapi.api;
|
||||
class SystemConfigReverseGeocodingDto {
|
||||
/// Returns a new [SystemConfigReverseGeocodingDto] instance.
|
||||
SystemConfigReverseGeocodingDto({
|
||||
required this.citiesFileOverride,
|
||||
required this.enabled,
|
||||
});
|
||||
|
||||
CitiesFile citiesFileOverride;
|
||||
|
||||
bool enabled;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SystemConfigReverseGeocodingDto &&
|
||||
other.citiesFileOverride == citiesFileOverride &&
|
||||
other.enabled == enabled;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(citiesFileOverride.hashCode) +
|
||||
(enabled.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SystemConfigReverseGeocodingDto[citiesFileOverride=$citiesFileOverride, enabled=$enabled]';
|
||||
String toString() => 'SystemConfigReverseGeocodingDto[enabled=$enabled]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'citiesFileOverride'] = this.citiesFileOverride;
|
||||
json[r'enabled'] = this.enabled;
|
||||
return json;
|
||||
}
|
||||
@@ -50,7 +44,6 @@ class SystemConfigReverseGeocodingDto {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return SystemConfigReverseGeocodingDto(
|
||||
citiesFileOverride: CitiesFile.fromJson(json[r'citiesFileOverride'])!,
|
||||
enabled: mapValueOfType<bool>(json, r'enabled')!,
|
||||
);
|
||||
}
|
||||
@@ -99,7 +92,6 @@ class SystemConfigReverseGeocodingDto {
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'citiesFileOverride',
|
||||
'enabled',
|
||||
};
|
||||
}
|
||||
|
21
mobile/openapi/test/cities_file_test.dart
generated
21
mobile/openapi/test/cities_file_test.dart
generated
@@ -1,21 +0,0 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for CitiesFile
|
||||
void main() {
|
||||
|
||||
group('test CitiesFile', () {
|
||||
|
||||
});
|
||||
|
||||
}
|
@@ -16,11 +16,6 @@ void main() {
|
||||
// final instance = SystemConfigReverseGeocodingDto();
|
||||
|
||||
group('test SystemConfigReverseGeocodingDto', () {
|
||||
// CitiesFile citiesFileOverride
|
||||
test('to test the property `citiesFileOverride`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// bool enabled
|
||||
test('to test the property `enabled`', () async {
|
||||
// TODO
|
||||
|
Reference in New Issue
Block a user