1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-10 23:22:22 +02:00

feat(server): improve validation of albums (#2188)

* feat(server): improve validation of albums

* regenerate openapi + fix downloadArchive for web
This commit is contained in:
Michel Heusschen
2023-04-06 19:50:55 +02:00
committed by GitHub
parent b03ce897c7
commit 8e3a7caebd
23 changed files with 164 additions and 83 deletions

View File

@@ -294,7 +294,7 @@ void (empty response body)
[[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)
# **downloadArchive**
> MultipartFile downloadArchive(albumId, skip, key)
> MultipartFile downloadArchive(albumId, name, skip, key)
@@ -316,11 +316,12 @@ import 'package:openapi/api.dart';
final api_instance = AlbumApi();
final albumId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final name = name_example; // String |
final skip = 8.14; // num |
final key = key_example; // String |
try {
final result = api_instance.downloadArchive(albumId, skip, key);
final result = api_instance.downloadArchive(albumId, name, skip, key);
print(result);
} catch (e) {
print('Exception when calling AlbumApi->downloadArchive: $e\n');
@@ -332,6 +333,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**albumId** | **String**| |
**name** | **String**| | [optional]
**skip** | **num**| | [optional]
**key** | **String**| | [optional]

View File

@@ -414,7 +414,7 @@ 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)
# **downloadLibrary**
> MultipartFile downloadLibrary(skip, key)
> MultipartFile downloadLibrary(name, skip, key)
@@ -435,11 +435,12 @@ import 'package:openapi/api.dart';
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
final api_instance = AssetApi();
final name = name_example; // String |
final skip = 8.14; // num |
final key = key_example; // String |
try {
final result = api_instance.downloadLibrary(skip, key);
final result = api_instance.downloadLibrary(name, skip, key);
print(result);
} catch (e) {
print('Exception when calling AssetApi->downloadLibrary: $e\n');
@@ -450,6 +451,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**name** | **String**| | [optional]
**skip** | **num**| | [optional]
**key** | **String**| | [optional]

View File

@@ -9,7 +9,7 @@ import 'package:openapi/api.dart';
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**albumId** | **String** | |
**expiresAt** | **String** | | [optional]
**expiresAt** | [**DateTime**](DateTime.md) | | [optional]
**allowUpload** | **bool** | | [optional]
**allowDownload** | **bool** | | [optional]
**showExif** | **bool** | | [optional]

View File

@@ -295,10 +295,12 @@ class AlbumApi {
///
/// * [String] albumId (required):
///
/// * [String] name:
///
/// * [num] skip:
///
/// * [String] key:
Future<Response> downloadArchiveWithHttpInfo(String albumId, { num? skip, String? key, }) async {
Future<Response> downloadArchiveWithHttpInfo(String albumId, { String? name, num? skip, String? key, }) async {
// ignore: prefer_const_declarations
final path = r'/album/{albumId}/download'
.replaceAll('{albumId}', albumId);
@@ -310,6 +312,9 @@ class AlbumApi {
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (name != null) {
queryParams.addAll(_queryParams('', 'name', name));
}
if (skip != null) {
queryParams.addAll(_queryParams('', 'skip', skip));
}
@@ -337,11 +342,13 @@ class AlbumApi {
///
/// * [String] albumId (required):
///
/// * [String] name:
///
/// * [num] skip:
///
/// * [String] key:
Future<MultipartFile?> downloadArchive(String albumId, { num? skip, String? key, }) async {
final response = await downloadArchiveWithHttpInfo(albumId, skip: skip, key: key, );
Future<MultipartFile?> downloadArchive(String albumId, { String? name, num? skip, String? key, }) async {
final response = await downloadArchiveWithHttpInfo(albumId, name: name, skip: skip, key: key, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}

View File

@@ -422,10 +422,12 @@ class AssetApi {
///
/// Parameters:
///
/// * [String] name:
///
/// * [num] skip:
///
/// * [String] key:
Future<Response> downloadLibraryWithHttpInfo({ num? skip, String? key, }) async {
Future<Response> downloadLibraryWithHttpInfo({ String? name, num? skip, String? key, }) async {
// ignore: prefer_const_declarations
final path = r'/asset/download-library';
@@ -436,6 +438,9 @@ class AssetApi {
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (name != null) {
queryParams.addAll(_queryParams('', 'name', name));
}
if (skip != null) {
queryParams.addAll(_queryParams('', 'skip', skip));
}
@@ -461,11 +466,13 @@ class AssetApi {
///
/// Parameters:
///
/// * [String] name:
///
/// * [num] skip:
///
/// * [String] key:
Future<MultipartFile?> downloadLibrary({ num? skip, String? key, }) async {
final response = await downloadLibraryWithHttpInfo( skip: skip, key: key, );
Future<MultipartFile?> downloadLibrary({ String? name, num? skip, String? key, }) async {
final response = await downloadLibraryWithHttpInfo( name: name, skip: skip, key: key, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}

View File

@@ -29,7 +29,7 @@ class CreateAlbumShareLinkDto {
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
String? expiresAt;
DateTime? expiresAt;
///
/// Please note: This property should have been non-nullable! Since the specification file
@@ -89,7 +89,7 @@ class CreateAlbumShareLinkDto {
final json = <String, dynamic>{};
json[r'albumId'] = this.albumId;
if (this.expiresAt != null) {
json[r'expiresAt'] = this.expiresAt;
json[r'expiresAt'] = this.expiresAt!.toUtc().toIso8601String();
} else {
// json[r'expiresAt'] = null;
}
@@ -136,7 +136,7 @@ class CreateAlbumShareLinkDto {
return CreateAlbumShareLinkDto(
albumId: mapValueOfType<String>(json, r'albumId')!,
expiresAt: mapValueOfType<String>(json, r'expiresAt'),
expiresAt: mapDateTime(json, r'expiresAt', ''),
allowUpload: mapValueOfType<bool>(json, r'allowUpload'),
allowDownload: mapValueOfType<bool>(json, r'allowDownload'),
showExif: mapValueOfType<bool>(json, r'showExif'),

View File

@@ -54,7 +54,7 @@ void main() {
//
//
//Future<MultipartFile> downloadArchive(String albumId, { num skip, String key }) async
//Future<MultipartFile> downloadArchive(String albumId, { String name, num skip, String key }) async
test('test downloadArchive', () async {
// TODO
});

View File

@@ -68,7 +68,7 @@ void main() {
// Current this is not used in any UI element
//
//Future<MultipartFile> downloadLibrary({ num skip, String key }) async
//Future<MultipartFile> downloadLibrary({ String name, num skip, String key }) async
test('test downloadLibrary', () async {
// TODO
});

View File

@@ -21,7 +21,7 @@ void main() {
// TODO
});
// String expiresAt
// DateTime expiresAt
test('to test the property `expiresAt`', () async {
// TODO
});