From 1d15cfb5f3923518a95f1100b02eee338203503e Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 26 Apr 2024 01:02:04 -0500 Subject: [PATCH] chore(server): remove unusuned endpoint/service/interface in asset-v1 (#9086) --- mobile/openapi/.openapi-generator/FILES | 6 - mobile/openapi/README.md | 5 - mobile/openapi/doc/AssetApi.md | 156 ----------------- .../doc/CuratedLocationsResponseDto.md | 19 --- .../openapi/doc/CuratedObjectsResponseDto.md | 19 --- mobile/openapi/lib/api.dart | 2 - mobile/openapi/lib/api/asset_api.dart | 132 --------------- mobile/openapi/lib/api_client.dart | 4 - .../model/curated_locations_response_dto.dart | 130 -------------- .../model/curated_objects_response_dto.dart | 130 -------------- mobile/openapi/test/asset_api_test.dart | 15 -- .../curated_locations_response_dto_test.dart | 47 ------ .../curated_objects_response_dto_test.dart | 47 ------ open-api/immich-openapi-specs.json | 159 ------------------ open-api/typescript-sdk/src/fetch-client.ts | 38 ----- server/src/controllers/asset-v1.controller.ts | 17 -- server/src/dtos/asset-v1-response.dto.ts | 16 -- server/src/dtos/asset-v1.dto.ts | 13 -- server/src/interfaces/asset-v1.interface.ts | 6 +- .../src/repositories/asset-v1.repository.ts | 53 +----- server/src/services/asset-v1.service.spec.ts | 3 - server/src/services/asset-v1.service.ts | 44 ----- 22 files changed, 2 insertions(+), 1059 deletions(-) delete mode 100644 mobile/openapi/doc/CuratedLocationsResponseDto.md delete mode 100644 mobile/openapi/doc/CuratedObjectsResponseDto.md delete mode 100644 mobile/openapi/lib/model/curated_locations_response_dto.dart delete mode 100644 mobile/openapi/lib/model/curated_objects_response_dto.dart delete mode 100644 mobile/openapi/test/curated_locations_response_dto_test.dart delete mode 100644 mobile/openapi/test/curated_objects_response_dto_test.dart diff --git a/mobile/openapi/.openapi-generator/FILES b/mobile/openapi/.openapi-generator/FILES index 2fd4fba057..e7cbd570dc 100644 --- a/mobile/openapi/.openapi-generator/FILES +++ b/mobile/openapi/.openapi-generator/FILES @@ -60,8 +60,6 @@ doc/CreateLibraryDto.md doc/CreateProfileImageResponseDto.md doc/CreateTagDto.md doc/CreateUserDto.md -doc/CuratedLocationsResponseDto.md -doc/CuratedObjectsResponseDto.md doc/DeleteUserDto.md doc/DownloadApi.md doc/DownloadArchiveInfo.md @@ -297,8 +295,6 @@ lib/model/create_library_dto.dart lib/model/create_profile_image_response_dto.dart lib/model/create_tag_dto.dart lib/model/create_user_dto.dart -lib/model/curated_locations_response_dto.dart -lib/model/curated_objects_response_dto.dart lib/model/delete_user_dto.dart lib/model/download_archive_info.dart lib/model/download_info_dto.dart @@ -485,8 +481,6 @@ test/create_library_dto_test.dart test/create_profile_image_response_dto_test.dart test/create_tag_dto_test.dart test/create_user_dto_test.dart -test/curated_locations_response_dto_test.dart -test/curated_objects_response_dto_test.dart test/delete_user_dto_test.dart test/download_api_test.dart test/download_archive_info_test.dart diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index 3059e3dbef..187d8e8fa9 100644 --- a/mobile/openapi/README.md +++ b/mobile/openapi/README.md @@ -98,11 +98,8 @@ Class | Method | HTTP request | Description *AssetApi* | [**getAllAssets**](doc//AssetApi.md#getallassets) | **GET** /asset | *AssetApi* | [**getAllUserAssetsByDeviceId**](doc//AssetApi.md#getalluserassetsbydeviceid) | **GET** /asset/device/{deviceId} | *AssetApi* | [**getAssetInfo**](doc//AssetApi.md#getassetinfo) | **GET** /asset/{id} | -*AssetApi* | [**getAssetSearchTerms**](doc//AssetApi.md#getassetsearchterms) | **GET** /asset/search-terms | *AssetApi* | [**getAssetStatistics**](doc//AssetApi.md#getassetstatistics) | **GET** /asset/statistics | *AssetApi* | [**getAssetThumbnail**](doc//AssetApi.md#getassetthumbnail) | **GET** /asset/thumbnail/{id} | -*AssetApi* | [**getCuratedLocations**](doc//AssetApi.md#getcuratedlocations) | **GET** /asset/curated-locations | -*AssetApi* | [**getCuratedObjects**](doc//AssetApi.md#getcuratedobjects) | **GET** /asset/curated-objects | *AssetApi* | [**getMapMarkers**](doc//AssetApi.md#getmapmarkers) | **GET** /asset/map-marker | *AssetApi* | [**getMemoryLane**](doc//AssetApi.md#getmemorylane) | **GET** /asset/memory-lane | *AssetApi* | [**getRandom**](doc//AssetApi.md#getrandom) | **GET** /asset/random | @@ -279,8 +276,6 @@ Class | Method | HTTP request | Description - [CreateProfileImageResponseDto](doc//CreateProfileImageResponseDto.md) - [CreateTagDto](doc//CreateTagDto.md) - [CreateUserDto](doc//CreateUserDto.md) - - [CuratedLocationsResponseDto](doc//CuratedLocationsResponseDto.md) - - [CuratedObjectsResponseDto](doc//CuratedObjectsResponseDto.md) - [DeleteUserDto](doc//DeleteUserDto.md) - [DownloadArchiveInfo](doc//DownloadArchiveInfo.md) - [DownloadInfoDto](doc//DownloadInfoDto.md) diff --git a/mobile/openapi/doc/AssetApi.md b/mobile/openapi/doc/AssetApi.md index 297a4cdba6..826e91a690 100644 --- a/mobile/openapi/doc/AssetApi.md +++ b/mobile/openapi/doc/AssetApi.md @@ -15,11 +15,8 @@ Method | HTTP request | Description [**getAllAssets**](AssetApi.md#getallassets) | **GET** /asset | [**getAllUserAssetsByDeviceId**](AssetApi.md#getalluserassetsbydeviceid) | **GET** /asset/device/{deviceId} | [**getAssetInfo**](AssetApi.md#getassetinfo) | **GET** /asset/{id} | -[**getAssetSearchTerms**](AssetApi.md#getassetsearchterms) | **GET** /asset/search-terms | [**getAssetStatistics**](AssetApi.md#getassetstatistics) | **GET** /asset/statistics | [**getAssetThumbnail**](AssetApi.md#getassetthumbnail) | **GET** /asset/thumbnail/{id} | -[**getCuratedLocations**](AssetApi.md#getcuratedlocations) | **GET** /asset/curated-locations | -[**getCuratedObjects**](AssetApi.md#getcuratedobjects) | **GET** /asset/curated-objects | [**getMapMarkers**](AssetApi.md#getmapmarkers) | **GET** /asset/map-marker | [**getMemoryLane**](AssetApi.md#getmemorylane) | **GET** /asset/memory-lane | [**getRandom**](AssetApi.md#getrandom) | **GET** /asset/random | @@ -385,57 +382,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **getAssetSearchTerms** -> List getAssetSearchTerms() - - - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: cookie -//defaultApiClient.getAuthentication('cookie').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('cookie').apiKeyPrefix = 'Bearer'; -// TODO Configure API key authorization: api_key -//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -// TODO Configure HTTP Bearer authorization: bearer -// Case 1. Use String Token -//defaultApiClient.getAuthentication('bearer').setAccessToken('YOUR_ACCESS_TOKEN'); -// Case 2. Use Function which generate token. -// String yourTokenGeneratorFunction() { ... } -//defaultApiClient.getAuthentication('bearer').setAccessToken(yourTokenGeneratorFunction); - -final api_instance = AssetApi(); - -try { - final result = api_instance.getAssetSearchTerms(); - print(result); -} catch (e) { - print('Exception when calling AssetApi->getAssetSearchTerms: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**List** - -### Authorization - -[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **getAssetStatistics** > AssetStatsResponseDto getAssetStatistics(isArchived, isFavorite, isTrashed) @@ -554,108 +500,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **getCuratedLocations** -> List getCuratedLocations() - - - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: cookie -//defaultApiClient.getAuthentication('cookie').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('cookie').apiKeyPrefix = 'Bearer'; -// TODO Configure API key authorization: api_key -//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -// TODO Configure HTTP Bearer authorization: bearer -// Case 1. Use String Token -//defaultApiClient.getAuthentication('bearer').setAccessToken('YOUR_ACCESS_TOKEN'); -// Case 2. Use Function which generate token. -// String yourTokenGeneratorFunction() { ... } -//defaultApiClient.getAuthentication('bearer').setAccessToken(yourTokenGeneratorFunction); - -final api_instance = AssetApi(); - -try { - final result = api_instance.getCuratedLocations(); - print(result); -} catch (e) { - print('Exception when calling AssetApi->getCuratedLocations: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**List**](CuratedLocationsResponseDto.md) - -### Authorization - -[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getCuratedObjects** -> List getCuratedObjects() - - - -### Example -```dart -import 'package:openapi/api.dart'; -// TODO Configure API key authorization: cookie -//defaultApiClient.getAuthentication('cookie').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('cookie').apiKeyPrefix = 'Bearer'; -// TODO Configure API key authorization: api_key -//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; -// TODO Configure HTTP Bearer authorization: bearer -// Case 1. Use String Token -//defaultApiClient.getAuthentication('bearer').setAccessToken('YOUR_ACCESS_TOKEN'); -// Case 2. Use Function which generate token. -// String yourTokenGeneratorFunction() { ... } -//defaultApiClient.getAuthentication('bearer').setAccessToken(yourTokenGeneratorFunction); - -final api_instance = AssetApi(); - -try { - final result = api_instance.getCuratedObjects(); - print(result); -} catch (e) { - print('Exception when calling AssetApi->getCuratedObjects: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**List**](CuratedObjectsResponseDto.md) - -### Authorization - -[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **getMapMarkers** > List getMapMarkers(fileCreatedAfter, fileCreatedBefore, isArchived, isFavorite, withPartners) diff --git a/mobile/openapi/doc/CuratedLocationsResponseDto.md b/mobile/openapi/doc/CuratedLocationsResponseDto.md deleted file mode 100644 index 627bcbf854..0000000000 --- a/mobile/openapi/doc/CuratedLocationsResponseDto.md +++ /dev/null @@ -1,19 +0,0 @@ -# openapi.model.CuratedLocationsResponseDto - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**city** | **String** | | -**deviceAssetId** | **String** | | -**deviceId** | **String** | | -**id** | **String** | | -**resizePath** | **String** | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/mobile/openapi/doc/CuratedObjectsResponseDto.md b/mobile/openapi/doc/CuratedObjectsResponseDto.md deleted file mode 100644 index ee041a8215..0000000000 --- a/mobile/openapi/doc/CuratedObjectsResponseDto.md +++ /dev/null @@ -1,19 +0,0 @@ -# openapi.model.CuratedObjectsResponseDto - -## Load the model package -```dart -import 'package:openapi/api.dart'; -``` - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**deviceAssetId** | **String** | | -**deviceId** | **String** | | -**id** | **String** | | -**object** | **String** | | -**resizePath** | **String** | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart index 78f2e9ed5a..3e2f23024e 100644 --- a/mobile/openapi/lib/api.dart +++ b/mobile/openapi/lib/api.dart @@ -107,8 +107,6 @@ part 'model/create_library_dto.dart'; part 'model/create_profile_image_response_dto.dart'; part 'model/create_tag_dto.dart'; part 'model/create_user_dto.dart'; -part 'model/curated_locations_response_dto.dart'; -part 'model/curated_objects_response_dto.dart'; part 'model/delete_user_dto.dart'; part 'model/download_archive_info.dart'; part 'model/download_info_dto.dart'; diff --git a/mobile/openapi/lib/api/asset_api.dart b/mobile/openapi/lib/api/asset_api.dart index 10f1c0c10e..c6031f6bda 100644 --- a/mobile/openapi/lib/api/asset_api.dart +++ b/mobile/openapi/lib/api/asset_api.dart @@ -382,50 +382,6 @@ class AssetApi { return null; } - /// Performs an HTTP 'GET /asset/search-terms' operation and returns the [Response]. - Future getAssetSearchTermsWithHttpInfo() async { - // ignore: prefer_const_declarations - final path = r'/asset/search-terms'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes.first, - ); - } - - Future?> getAssetSearchTerms() async { - final response = await getAssetSearchTermsWithHttpInfo(); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // 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) { - final responseBody = await _decodeBodyBytes(response); - return (await apiClient.deserializeAsync(responseBody, 'List') as List) - .cast() - .toList(growable: false); - - } - return null; - } - /// Performs an HTTP 'GET /asset/statistics' operation and returns the [Response]. /// Parameters: /// @@ -554,94 +510,6 @@ class AssetApi { return null; } - /// Performs an HTTP 'GET /asset/curated-locations' operation and returns the [Response]. - Future getCuratedLocationsWithHttpInfo() async { - // ignore: prefer_const_declarations - final path = r'/asset/curated-locations'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes.first, - ); - } - - Future?> getCuratedLocations() async { - final response = await getCuratedLocationsWithHttpInfo(); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // 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) { - final responseBody = await _decodeBodyBytes(response); - return (await apiClient.deserializeAsync(responseBody, 'List') as List) - .cast() - .toList(growable: false); - - } - return null; - } - - /// Performs an HTTP 'GET /asset/curated-objects' operation and returns the [Response]. - Future getCuratedObjectsWithHttpInfo() async { - // ignore: prefer_const_declarations - final path = r'/asset/curated-objects'; - - // ignore: prefer_final_locals - Object? postBody; - - final queryParams = []; - final headerParams = {}; - final formParams = {}; - - const contentTypes = []; - - - return apiClient.invokeAPI( - path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentTypes.isEmpty ? null : contentTypes.first, - ); - } - - Future?> getCuratedObjects() async { - final response = await getCuratedObjectsWithHttpInfo(); - if (response.statusCode >= HttpStatus.badRequest) { - throw ApiException(response.statusCode, await _decodeBodyBytes(response)); - } - // When a remote server returns no body with a status of 204, we shall not decode it. - // 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) { - final responseBody = await _decodeBodyBytes(response); - return (await apiClient.deserializeAsync(responseBody, 'List') as List) - .cast() - .toList(growable: false); - - } - return null; - } - /// Performs an HTTP 'GET /asset/map-marker' operation and returns the [Response]. /// Parameters: /// diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart index ae3b9dadf1..5db7b8fbef 100644 --- a/mobile/openapi/lib/api_client.dart +++ b/mobile/openapi/lib/api_client.dart @@ -284,10 +284,6 @@ class ApiClient { return CreateTagDto.fromJson(value); case 'CreateUserDto': return CreateUserDto.fromJson(value); - case 'CuratedLocationsResponseDto': - return CuratedLocationsResponseDto.fromJson(value); - case 'CuratedObjectsResponseDto': - return CuratedObjectsResponseDto.fromJson(value); case 'DeleteUserDto': return DeleteUserDto.fromJson(value); case 'DownloadArchiveInfo': diff --git a/mobile/openapi/lib/model/curated_locations_response_dto.dart b/mobile/openapi/lib/model/curated_locations_response_dto.dart deleted file mode 100644 index 0b54c4807f..0000000000 --- a/mobile/openapi/lib/model/curated_locations_response_dto.dart +++ /dev/null @@ -1,130 +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 CuratedLocationsResponseDto { - /// Returns a new [CuratedLocationsResponseDto] instance. - CuratedLocationsResponseDto({ - required this.city, - required this.deviceAssetId, - required this.deviceId, - required this.id, - required this.resizePath, - }); - - String city; - - String deviceAssetId; - - String deviceId; - - String id; - - String resizePath; - - @override - bool operator ==(Object other) => identical(this, other) || other is CuratedLocationsResponseDto && - other.city == city && - other.deviceAssetId == deviceAssetId && - other.deviceId == deviceId && - other.id == id && - other.resizePath == resizePath; - - @override - int get hashCode => - // ignore: unnecessary_parenthesis - (city.hashCode) + - (deviceAssetId.hashCode) + - (deviceId.hashCode) + - (id.hashCode) + - (resizePath.hashCode); - - @override - String toString() => 'CuratedLocationsResponseDto[city=$city, deviceAssetId=$deviceAssetId, deviceId=$deviceId, id=$id, resizePath=$resizePath]'; - - Map toJson() { - final json = {}; - json[r'city'] = this.city; - json[r'deviceAssetId'] = this.deviceAssetId; - json[r'deviceId'] = this.deviceId; - json[r'id'] = this.id; - json[r'resizePath'] = this.resizePath; - return json; - } - - /// Returns a new [CuratedLocationsResponseDto] instance and imports its values from - /// [value] if it's a [Map], null otherwise. - // ignore: prefer_constructors_over_static_methods - static CuratedLocationsResponseDto? fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - - return CuratedLocationsResponseDto( - city: mapValueOfType(json, r'city')!, - deviceAssetId: mapValueOfType(json, r'deviceAssetId')!, - deviceId: mapValueOfType(json, r'deviceId')!, - id: mapValueOfType(json, r'id')!, - resizePath: mapValueOfType(json, r'resizePath')!, - ); - } - return null; - } - - static List listFromJson(dynamic json, {bool growable = false,}) { - final result = []; - if (json is List && json.isNotEmpty) { - for (final row in json) { - final value = CuratedLocationsResponseDto.fromJson(row); - if (value != null) { - result.add(value); - } - } - } - return result.toList(growable: growable); - } - - static Map mapFromJson(dynamic json) { - final map = {}; - if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments - for (final entry in json.entries) { - final value = CuratedLocationsResponseDto.fromJson(entry.value); - if (value != null) { - map[entry.key] = value; - } - } - } - return map; - } - - // maps a json object with a list of CuratedLocationsResponseDto-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { - final map = >{}; - if (json is Map && json.isNotEmpty) { - // ignore: parameter_assignments - json = json.cast(); - for (final entry in json.entries) { - map[entry.key] = CuratedLocationsResponseDto.listFromJson(entry.value, growable: growable,); - } - } - return map; - } - - /// The list of required keys that must be present in a JSON. - static const requiredKeys = { - 'city', - 'deviceAssetId', - 'deviceId', - 'id', - 'resizePath', - }; -} - diff --git a/mobile/openapi/lib/model/curated_objects_response_dto.dart b/mobile/openapi/lib/model/curated_objects_response_dto.dart deleted file mode 100644 index 40b6e1789b..0000000000 --- a/mobile/openapi/lib/model/curated_objects_response_dto.dart +++ /dev/null @@ -1,130 +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 CuratedObjectsResponseDto { - /// Returns a new [CuratedObjectsResponseDto] instance. - CuratedObjectsResponseDto({ - required this.deviceAssetId, - required this.deviceId, - required this.id, - required this.object, - required this.resizePath, - }); - - String deviceAssetId; - - String deviceId; - - String id; - - String object; - - String resizePath; - - @override - bool operator ==(Object other) => identical(this, other) || other is CuratedObjectsResponseDto && - other.deviceAssetId == deviceAssetId && - other.deviceId == deviceId && - other.id == id && - other.object == object && - other.resizePath == resizePath; - - @override - int get hashCode => - // ignore: unnecessary_parenthesis - (deviceAssetId.hashCode) + - (deviceId.hashCode) + - (id.hashCode) + - (object.hashCode) + - (resizePath.hashCode); - - @override - String toString() => 'CuratedObjectsResponseDto[deviceAssetId=$deviceAssetId, deviceId=$deviceId, id=$id, object=$object, resizePath=$resizePath]'; - - Map toJson() { - final json = {}; - json[r'deviceAssetId'] = this.deviceAssetId; - json[r'deviceId'] = this.deviceId; - json[r'id'] = this.id; - json[r'object'] = this.object; - json[r'resizePath'] = this.resizePath; - return json; - } - - /// Returns a new [CuratedObjectsResponseDto] instance and imports its values from - /// [value] if it's a [Map], null otherwise. - // ignore: prefer_constructors_over_static_methods - static CuratedObjectsResponseDto? fromJson(dynamic value) { - if (value is Map) { - final json = value.cast(); - - return CuratedObjectsResponseDto( - deviceAssetId: mapValueOfType(json, r'deviceAssetId')!, - deviceId: mapValueOfType(json, r'deviceId')!, - id: mapValueOfType(json, r'id')!, - object: mapValueOfType(json, r'object')!, - resizePath: mapValueOfType(json, r'resizePath')!, - ); - } - return null; - } - - static List listFromJson(dynamic json, {bool growable = false,}) { - final result = []; - if (json is List && json.isNotEmpty) { - for (final row in json) { - final value = CuratedObjectsResponseDto.fromJson(row); - if (value != null) { - result.add(value); - } - } - } - return result.toList(growable: growable); - } - - static Map mapFromJson(dynamic json) { - final map = {}; - if (json is Map && json.isNotEmpty) { - json = json.cast(); // ignore: parameter_assignments - for (final entry in json.entries) { - final value = CuratedObjectsResponseDto.fromJson(entry.value); - if (value != null) { - map[entry.key] = value; - } - } - } - return map; - } - - // maps a json object with a list of CuratedObjectsResponseDto-objects as value to a dart map - static Map> mapListFromJson(dynamic json, {bool growable = false,}) { - final map = >{}; - if (json is Map && json.isNotEmpty) { - // ignore: parameter_assignments - json = json.cast(); - for (final entry in json.entries) { - map[entry.key] = CuratedObjectsResponseDto.listFromJson(entry.value, growable: growable,); - } - } - return map; - } - - /// The list of required keys that must be present in a JSON. - static const requiredKeys = { - 'deviceAssetId', - 'deviceId', - 'id', - 'object', - 'resizePath', - }; -} - diff --git a/mobile/openapi/test/asset_api_test.dart b/mobile/openapi/test/asset_api_test.dart index 0c1729e95f..e64d3acf5e 100644 --- a/mobile/openapi/test/asset_api_test.dart +++ b/mobile/openapi/test/asset_api_test.dart @@ -55,11 +55,6 @@ void main() { // TODO }); - //Future> getAssetSearchTerms() async - test('test getAssetSearchTerms', () async { - // TODO - }); - //Future getAssetStatistics({ bool isArchived, bool isFavorite, bool isTrashed }) async test('test getAssetStatistics', () async { // TODO @@ -70,16 +65,6 @@ void main() { // TODO }); - //Future> getCuratedLocations() async - test('test getCuratedLocations', () async { - // TODO - }); - - //Future> getCuratedObjects() async - test('test getCuratedObjects', () async { - // TODO - }); - //Future> getMapMarkers({ DateTime fileCreatedAfter, DateTime fileCreatedBefore, bool isArchived, bool isFavorite, bool withPartners }) async test('test getMapMarkers', () async { // TODO diff --git a/mobile/openapi/test/curated_locations_response_dto_test.dart b/mobile/openapi/test/curated_locations_response_dto_test.dart deleted file mode 100644 index 7529aaf7c8..0000000000 --- a/mobile/openapi/test/curated_locations_response_dto_test.dart +++ /dev/null @@ -1,47 +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 CuratedLocationsResponseDto -void main() { - // final instance = CuratedLocationsResponseDto(); - - group('test CuratedLocationsResponseDto', () { - // String city - test('to test the property `city`', () async { - // TODO - }); - - // String deviceAssetId - test('to test the property `deviceAssetId`', () async { - // TODO - }); - - // String deviceId - test('to test the property `deviceId`', () async { - // TODO - }); - - // String id - test('to test the property `id`', () async { - // TODO - }); - - // String resizePath - test('to test the property `resizePath`', () async { - // TODO - }); - - - }); - -} diff --git a/mobile/openapi/test/curated_objects_response_dto_test.dart b/mobile/openapi/test/curated_objects_response_dto_test.dart deleted file mode 100644 index f71723ab27..0000000000 --- a/mobile/openapi/test/curated_objects_response_dto_test.dart +++ /dev/null @@ -1,47 +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 CuratedObjectsResponseDto -void main() { - // final instance = CuratedObjectsResponseDto(); - - group('test CuratedObjectsResponseDto', () { - // String deviceAssetId - test('to test the property `deviceAssetId`', () async { - // TODO - }); - - // String deviceId - test('to test the property `deviceId`', () async { - // TODO - }); - - // String id - test('to test the property `id`', () async { - // TODO - }); - - // String object - test('to test the property `object`', () async { - // TODO - }); - - // String resizePath - test('to test the property `resizePath`', () async { - // TODO - }); - - - }); - -} diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 5905f2ccfc..d1e0b6aace 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -1149,76 +1149,6 @@ ] } }, - "/asset/curated-locations": { - "get": { - "operationId": "getCuratedLocations", - "parameters": [], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/CuratedLocationsResponseDto" - }, - "type": "array" - } - } - }, - "description": "" - } - }, - "security": [ - { - "bearer": [] - }, - { - "cookie": [] - }, - { - "api_key": [] - } - ], - "tags": [ - "Asset" - ] - } - }, - "/asset/curated-objects": { - "get": { - "operationId": "getCuratedObjects", - "parameters": [], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/CuratedObjectsResponseDto" - }, - "type": "array" - } - } - }, - "description": "" - } - }, - "security": [ - { - "bearer": [] - }, - { - "cookie": [] - }, - { - "api_key": [] - } - ], - "tags": [ - "Asset" - ] - } - }, "/asset/device/{deviceId}": { "get": { "description": "Get all asset of a device that are in the database, ID only.", @@ -1590,41 +1520,6 @@ ] } }, - "/asset/search-terms": { - "get": { - "operationId": "getAssetSearchTerms", - "parameters": [], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "items": { - "type": "string" - }, - "type": "array" - } - } - }, - "description": "" - } - }, - "security": [ - { - "bearer": [] - }, - { - "cookie": [] - }, - { - "api_key": [] - } - ], - "tags": [ - "Asset" - ] - } - }, "/asset/stack/parent": { "put": { "operationId": "updateStackParent", @@ -8423,60 +8318,6 @@ ], "type": "object" }, - "CuratedLocationsResponseDto": { - "properties": { - "city": { - "type": "string" - }, - "deviceAssetId": { - "type": "string" - }, - "deviceId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "resizePath": { - "type": "string" - } - }, - "required": [ - "city", - "deviceAssetId", - "deviceId", - "id", - "resizePath" - ], - "type": "object" - }, - "CuratedObjectsResponseDto": { - "properties": { - "deviceAssetId": { - "type": "string" - }, - "deviceId": { - "type": "string" - }, - "id": { - "type": "string" - }, - "object": { - "type": "string" - }, - "resizePath": { - "type": "string" - } - }, - "required": [ - "deviceAssetId", - "deviceId", - "id", - "object", - "resizePath" - ], - "type": "object" - }, "DeleteUserDto": { "properties": { "force": { diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index a517cb6602..2536afe598 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -252,20 +252,6 @@ export type AssetBulkUploadCheckResult = { export type AssetBulkUploadCheckResponseDto = { results: AssetBulkUploadCheckResult[]; }; -export type CuratedLocationsResponseDto = { - city: string; - deviceAssetId: string; - deviceId: string; - id: string; - resizePath: string; -}; -export type CuratedObjectsResponseDto = { - deviceAssetId: string; - deviceId: string; - id: string; - "object": string; - resizePath: string; -}; export type CheckExistingAssetsDto = { deviceAssetIds: string[]; deviceId: string; @@ -1363,22 +1349,6 @@ export function checkBulkUpload({ assetBulkUploadCheckDto }: { body: assetBulkUploadCheckDto }))); } -export function getCuratedLocations(opts?: Oazapfts.RequestOpts) { - return oazapfts.ok(oazapfts.fetchJson<{ - status: 200; - data: CuratedLocationsResponseDto[]; - }>("/asset/curated-locations", { - ...opts - })); -} -export function getCuratedObjects(opts?: Oazapfts.RequestOpts) { - return oazapfts.ok(oazapfts.fetchJson<{ - status: 200; - data: CuratedObjectsResponseDto[]; - }>("/asset/curated-objects", { - ...opts - })); -} /** * Get all asset of a device that are in the database, ID only. */ @@ -1479,14 +1449,6 @@ export function getRandom({ count }: { ...opts })); } -export function getAssetSearchTerms(opts?: Oazapfts.RequestOpts) { - return oazapfts.ok(oazapfts.fetchJson<{ - status: 200; - data: string[]; - }>("/asset/search-terms", { - ...opts - })); -} export function updateStackParent({ updateStackParentDto }: { updateStackParentDto: UpdateStackParentDto; }, opts?: Oazapfts.RequestOpts) { diff --git a/server/src/controllers/asset-v1.controller.ts b/server/src/controllers/asset-v1.controller.ts index 2ba9aa7a03..e83df8d0d1 100644 --- a/server/src/controllers/asset-v1.controller.ts +++ b/server/src/controllers/asset-v1.controller.ts @@ -20,8 +20,6 @@ import { AssetBulkUploadCheckResponseDto, AssetFileUploadResponseDto, CheckExistingAssetsResponseDto, - CuratedLocationsResponseDto, - CuratedObjectsResponseDto, } from 'src/dtos/asset-v1-response.dto'; import { AssetBulkUploadCheckDto, @@ -111,21 +109,6 @@ export class AssetControllerV1 { await sendFile(res, next, () => this.service.serveThumbnail(auth, id, dto)); } - @Get('/curated-objects') - getCuratedObjects(@Auth() auth: AuthDto): Promise { - return this.service.getCuratedObject(auth); - } - - @Get('/curated-locations') - getCuratedLocations(@Auth() auth: AuthDto): Promise { - return this.service.getCuratedLocation(auth); - } - - @Get('/search-terms') - getAssetSearchTerms(@Auth() auth: AuthDto): Promise { - return this.service.getAssetSearchTerm(auth); - } - /** * Get all AssetEntity belong to the user */ diff --git a/server/src/dtos/asset-v1-response.dto.ts b/server/src/dtos/asset-v1-response.dto.ts index 4b1e97b478..687b336428 100644 --- a/server/src/dtos/asset-v1-response.dto.ts +++ b/server/src/dtos/asset-v1-response.dto.ts @@ -27,19 +27,3 @@ export class AssetFileUploadResponseDto { export class CheckExistingAssetsResponseDto { existingIds!: string[]; } - -export class CuratedLocationsResponseDto { - id!: string; - city!: string; - resizePath!: string; - deviceAssetId!: string; - deviceId!: string; -} - -export class CuratedObjectsResponseDto { - id!: string; - object!: string; - resizePath!: string; - deviceAssetId!: string; - deviceId!: string; -} diff --git a/server/src/dtos/asset-v1.dto.ts b/server/src/dtos/asset-v1.dto.ts index 50ff3d18b1..5cac6fbe65 100644 --- a/server/src/dtos/asset-v1.dto.ts +++ b/server/src/dtos/asset-v1.dto.ts @@ -130,19 +130,6 @@ export class GetAssetThumbnailDto { format: GetAssetThumbnailFormatEnum = GetAssetThumbnailFormatEnum.WEBP; } -export class SearchPropertiesDto { - tags?: string[]; - objects?: string[]; - assetType?: string; - orientation?: string; - lensModel?: string; - make?: string; - model?: string; - city?: string; - state?: string; - country?: string; -} - export class ServeFileDto { @ValidateBoolean({ optional: true }) @ApiProperty({ title: 'Is serve thumbnail (resize) file' }) diff --git a/server/src/interfaces/asset-v1.interface.ts b/server/src/interfaces/asset-v1.interface.ts index 8348bfaeea..799a303ba6 100644 --- a/server/src/interfaces/asset-v1.interface.ts +++ b/server/src/interfaces/asset-v1.interface.ts @@ -1,5 +1,4 @@ -import { CuratedLocationsResponseDto, CuratedObjectsResponseDto } from 'src/dtos/asset-v1-response.dto'; -import { AssetSearchDto, CheckExistingAssetsDto, SearchPropertiesDto } from 'src/dtos/asset-v1.dto'; +import { AssetSearchDto, CheckExistingAssetsDto } from 'src/dtos/asset-v1.dto'; import { AssetEntity } from 'src/entities/asset.entity'; export interface AssetCheck { @@ -13,10 +12,7 @@ export interface AssetOwnerCheck extends AssetCheck { export interface IAssetRepositoryV1 { get(id: string): Promise; - getLocationsByUserId(userId: string): Promise; - getDetectedObjectsByUserId(userId: string): Promise; getAllByUserId(userId: string, dto: AssetSearchDto): Promise; - getSearchPropertiesByUserId(userId: string): Promise; getAssetsByChecksums(userId: string, checksums: Buffer[]): Promise; getExistingAssets(userId: string, checkDuplicateAssetDto: CheckExistingAssetsDto): Promise; getByOriginalPath(originalPath: string): Promise; diff --git a/server/src/repositories/asset-v1.repository.ts b/server/src/repositories/asset-v1.repository.ts index 229e700fd5..4e346d5fdf 100644 --- a/server/src/repositories/asset-v1.repository.ts +++ b/server/src/repositories/asset-v1.repository.ts @@ -1,7 +1,6 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { CuratedLocationsResponseDto, CuratedObjectsResponseDto } from 'src/dtos/asset-v1-response.dto'; -import { AssetSearchDto, CheckExistingAssetsDto, SearchPropertiesDto } from 'src/dtos/asset-v1.dto'; +import { AssetSearchDto, CheckExistingAssetsDto } from 'src/dtos/asset-v1.dto'; import { AssetEntity } from 'src/entities/asset.entity'; import { AssetCheck, AssetOwnerCheck, IAssetRepositoryV1 } from 'src/interfaces/asset-v1.interface'; import { OptionalBetween } from 'src/utils/database'; @@ -42,56 +41,6 @@ export class AssetRepositoryV1 implements IAssetRepositoryV1 { }); } - getSearchPropertiesByUserId(userId: string): Promise { - return this.assetRepository - .createQueryBuilder('asset') - .where('asset.ownerId = :userId', { userId: userId }) - .andWhere('asset.isVisible = true') - .leftJoin('asset.exifInfo', 'ei') - .leftJoin('asset.smartInfo', 'si') - .select('si.tags', 'tags') - .addSelect('si.objects', 'objects') - .addSelect('asset.type', 'assetType') - .addSelect('ei.orientation', 'orientation') - .addSelect('ei."lensModel"', 'lensModel') - .addSelect('ei.make', 'make') - .addSelect('ei.model', 'model') - .addSelect('ei.city', 'city') - .addSelect('ei.state', 'state') - .addSelect('ei.country', 'country') - .distinctOn(['si.tags']) - .getRawMany(); - } - - getDetectedObjectsByUserId(userId: string): Promise { - return this.assetRepository.query( - ` - SELECT DISTINCT ON (unnest(si.objects)) a.id, unnest(si.objects) as "object", a."previewPath" AS "resizePath", a."deviceAssetId", a."deviceId" - FROM assets a - LEFT JOIN smart_info si ON a.id = si."assetId" - WHERE a."ownerId" = $1 - AND a."isVisible" = true - AND si.objects IS NOT NULL - `, - [userId], - ); - } - - getLocationsByUserId(userId: string): Promise { - return this.assetRepository.query( - ` - SELECT DISTINCT ON (e.city) a.id, e.city, a."previewPath" AS "resizePath", a."deviceAssetId", a."deviceId" - FROM assets a - LEFT JOIN exif e ON a.id = e."assetId" - WHERE a."ownerId" = $1 - AND a."isVisible" = true - AND e.city IS NOT NULL - AND a.type = 'IMAGE'; - `, - [userId], - ); - } - get(id: string): Promise { return this.assetRepository.findOne({ where: { id }, diff --git a/server/src/services/asset-v1.service.spec.ts b/server/src/services/asset-v1.service.spec.ts index bc088cb30b..40211ee40a 100644 --- a/server/src/services/asset-v1.service.spec.ts +++ b/server/src/services/asset-v1.service.spec.ts @@ -76,9 +76,6 @@ describe('AssetService', () => { assetRepositoryMockV1 = { get: vitest.fn(), getAllByUserId: vitest.fn(), - getDetectedObjectsByUserId: vitest.fn(), - getLocationsByUserId: vitest.fn(), - getSearchPropertiesByUserId: vitest.fn(), getAssetsByChecksums: vitest.fn(), getExistingAssets: vitest.fn(), getByOriginalPath: vitest.fn(), diff --git a/server/src/services/asset-v1.service.ts b/server/src/services/asset-v1.service.ts index 61fe5bd80b..e7affe1073 100644 --- a/server/src/services/asset-v1.service.ts +++ b/server/src/services/asset-v1.service.ts @@ -13,8 +13,6 @@ import { AssetRejectReason, AssetUploadAction, CheckExistingAssetsResponseDto, - CuratedLocationsResponseDto, - CuratedObjectsResponseDto, } from 'src/dtos/asset-v1-response.dto'; import { AssetBulkUploadCheckDto, @@ -156,48 +154,6 @@ export class AssetServiceV1 { }); } - async getAssetSearchTerm(auth: AuthDto): Promise { - const possibleSearchTerm = new Set(); - - const rows = await this.assetRepositoryV1.getSearchPropertiesByUserId(auth.user.id); - - for (const row of rows) { - // tags - row.tags?.map((tag: string) => possibleSearchTerm.add(tag?.toLowerCase())); - - // objects - row.objects?.map((object: string) => possibleSearchTerm.add(object?.toLowerCase())); - - // asset's tyoe - possibleSearchTerm.add(row.assetType?.toLowerCase() || ''); - - // image orientation - possibleSearchTerm.add(row.orientation?.toLowerCase() || ''); - - // Lens model - possibleSearchTerm.add(row.lensModel?.toLowerCase() || ''); - - // Make and model - possibleSearchTerm.add(row.make?.toLowerCase() || ''); - possibleSearchTerm.add(row.model?.toLowerCase() || ''); - - // Location - possibleSearchTerm.add(row.city?.toLowerCase() || ''); - possibleSearchTerm.add(row.state?.toLowerCase() || ''); - possibleSearchTerm.add(row.country?.toLowerCase() || ''); - } - - return [...possibleSearchTerm].filter((x) => x != null && x != ''); - } - - async getCuratedLocation(auth: AuthDto): Promise { - return this.assetRepositoryV1.getLocationsByUserId(auth.user.id); - } - - async getCuratedObject(auth: AuthDto): Promise { - return this.assetRepositoryV1.getDetectedObjectsByUserId(auth.user.id); - } - async checkExistingAssets( auth: AuthDto, checkExistingAssetsDto: CheckExistingAssetsDto,