0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-03-04 02:11:44 -05:00

chore(server): remove unusuned endpoint/service/interface in asset-v1 (#9086)

This commit is contained in:
Alex 2024-04-26 01:02:04 -05:00 committed by GitHub
parent 3e03f5348f
commit 1d15cfb5f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 2 additions and 1059 deletions

View file

@ -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

View file

@ -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)

View file

@ -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<String> getAssetSearchTerms()
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('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<String>**
### 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<CuratedLocationsResponseDto> getCuratedLocations()
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('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>**](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<CuratedObjectsResponseDto> getCuratedObjects()
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('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>**](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<MapMarkerResponseDto> getMapMarkers(fileCreatedAfter, fileCreatedBefore, isArchived, isFavorite, withPartners)

View file

@ -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)

View file

@ -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)

View file

@ -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';

View file

@ -382,50 +382,6 @@ class AssetApi {
return null;
}
/// Performs an HTTP 'GET /asset/search-terms' operation and returns the [Response].
Future<Response> getAssetSearchTermsWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/asset/search-terms';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
Future<List<String>?> 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<String>') as List)
.cast<String>()
.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<Response> getCuratedLocationsWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/asset/curated-locations';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
Future<List<CuratedLocationsResponseDto>?> 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<CuratedLocationsResponseDto>') as List)
.cast<CuratedLocationsResponseDto>()
.toList(growable: false);
}
return null;
}
/// Performs an HTTP 'GET /asset/curated-objects' operation and returns the [Response].
Future<Response> getCuratedObjectsWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/asset/curated-objects';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
Future<List<CuratedObjectsResponseDto>?> 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<CuratedObjectsResponseDto>') as List)
.cast<CuratedObjectsResponseDto>()
.toList(growable: false);
}
return null;
}
/// Performs an HTTP 'GET /asset/map-marker' operation and returns the [Response].
/// Parameters:
///

View file

@ -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':

View file

@ -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<String, dynamic> toJson() {
final json = <String, dynamic>{};
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<String, dynamic>();
return CuratedLocationsResponseDto(
city: mapValueOfType<String>(json, r'city')!,
deviceAssetId: mapValueOfType<String>(json, r'deviceAssetId')!,
deviceId: mapValueOfType<String>(json, r'deviceId')!,
id: mapValueOfType<String>(json, r'id')!,
resizePath: mapValueOfType<String>(json, r'resizePath')!,
);
}
return null;
}
static List<CuratedLocationsResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <CuratedLocationsResponseDto>[];
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<String, CuratedLocationsResponseDto> mapFromJson(dynamic json) {
final map = <String, CuratedLocationsResponseDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // 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<String, List<CuratedLocationsResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<CuratedLocationsResponseDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
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 = <String>{
'city',
'deviceAssetId',
'deviceId',
'id',
'resizePath',
};
}

View file

@ -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<String, dynamic> toJson() {
final json = <String, dynamic>{};
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<String, dynamic>();
return CuratedObjectsResponseDto(
deviceAssetId: mapValueOfType<String>(json, r'deviceAssetId')!,
deviceId: mapValueOfType<String>(json, r'deviceId')!,
id: mapValueOfType<String>(json, r'id')!,
object: mapValueOfType<String>(json, r'object')!,
resizePath: mapValueOfType<String>(json, r'resizePath')!,
);
}
return null;
}
static List<CuratedObjectsResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <CuratedObjectsResponseDto>[];
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<String, CuratedObjectsResponseDto> mapFromJson(dynamic json) {
final map = <String, CuratedObjectsResponseDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // 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<String, List<CuratedObjectsResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<CuratedObjectsResponseDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
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 = <String>{
'deviceAssetId',
'deviceId',
'id',
'object',
'resizePath',
};
}

View file

@ -55,11 +55,6 @@ void main() {
// TODO
});
//Future<List<String>> getAssetSearchTerms() async
test('test getAssetSearchTerms', () async {
// TODO
});
//Future<AssetStatsResponseDto> getAssetStatistics({ bool isArchived, bool isFavorite, bool isTrashed }) async
test('test getAssetStatistics', () async {
// TODO
@ -70,16 +65,6 @@ void main() {
// TODO
});
//Future<List<CuratedLocationsResponseDto>> getCuratedLocations() async
test('test getCuratedLocations', () async {
// TODO
});
//Future<List<CuratedObjectsResponseDto>> getCuratedObjects() async
test('test getCuratedObjects', () async {
// TODO
});
//Future<List<MapMarkerResponseDto>> getMapMarkers({ DateTime fileCreatedAfter, DateTime fileCreatedBefore, bool isArchived, bool isFavorite, bool withPartners }) async
test('test getMapMarkers', () async {
// TODO

View file

@ -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
});
});
}

View file

@ -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
});
});
}

View file

@ -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": {

View file

@ -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) {

View file

@ -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<CuratedObjectsResponseDto[]> {
return this.service.getCuratedObject(auth);
}
@Get('/curated-locations')
getCuratedLocations(@Auth() auth: AuthDto): Promise<CuratedLocationsResponseDto[]> {
return this.service.getCuratedLocation(auth);
}
@Get('/search-terms')
getAssetSearchTerms(@Auth() auth: AuthDto): Promise<string[]> {
return this.service.getAssetSearchTerm(auth);
}
/**
* Get all AssetEntity belong to the user
*/

View file

@ -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;
}

View file

@ -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' })

View file

@ -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<AssetEntity | null>;
getLocationsByUserId(userId: string): Promise<CuratedLocationsResponseDto[]>;
getDetectedObjectsByUserId(userId: string): Promise<CuratedObjectsResponseDto[]>;
getAllByUserId(userId: string, dto: AssetSearchDto): Promise<AssetEntity[]>;
getSearchPropertiesByUserId(userId: string): Promise<SearchPropertiesDto[]>;
getAssetsByChecksums(userId: string, checksums: Buffer[]): Promise<AssetCheck[]>;
getExistingAssets(userId: string, checkDuplicateAssetDto: CheckExistingAssetsDto): Promise<string[]>;
getByOriginalPath(originalPath: string): Promise<AssetOwnerCheck | null>;

View file

@ -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<SearchPropertiesDto[]> {
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<CuratedObjectsResponseDto[]> {
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<CuratedLocationsResponseDto[]> {
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<AssetEntity | null> {
return this.assetRepository.findOne({
where: { id },

View file

@ -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(),

View file

@ -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<string[]> {
const possibleSearchTerm = new Set<string>();
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<CuratedLocationsResponseDto[]> {
return this.assetRepositoryV1.getLocationsByUserId(auth.user.id);
}
async getCuratedObject(auth: AuthDto): Promise<CuratedObjectsResponseDto[]> {
return this.assetRepositoryV1.getDetectedObjectsByUserId(auth.user.id);
}
async checkExistingAssets(
auth: AuthDto,
checkExistingAssetsDto: CheckExistingAssetsDto,