mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
refactor(server): shared links (#1385)
* refactor(server): shared links * chore: tests * fix: bugs and tests * fix: missed one expired at * fix: standardize file upload checks * test: lower flutter version Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
10
mobile/openapi/lib/api/share_api.dart
generated
10
mobile/openapi/lib/api/share_api.dart
generated
@@ -255,18 +255,10 @@ class ShareApi {
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
Future<String?> removeSharedLink(String id,) async {
|
||||
Future<void> removeSharedLink(String id,) async {
|
||||
final response = await removeSharedLinkWithHttpInfo(id,);
|
||||
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) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class CreateAlbumShareLinkDto {
|
||||
/// Returns a new [CreateAlbumShareLinkDto] instance.
|
||||
CreateAlbumShareLinkDto({
|
||||
required this.albumId,
|
||||
this.expiredAt,
|
||||
this.expiresAt,
|
||||
this.allowUpload,
|
||||
this.allowDownload,
|
||||
this.showExif,
|
||||
@@ -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? expiredAt;
|
||||
String? expiresAt;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
@@ -66,7 +66,7 @@ class CreateAlbumShareLinkDto {
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is CreateAlbumShareLinkDto &&
|
||||
other.albumId == albumId &&
|
||||
other.expiredAt == expiredAt &&
|
||||
other.expiresAt == expiresAt &&
|
||||
other.allowUpload == allowUpload &&
|
||||
other.allowDownload == allowDownload &&
|
||||
other.showExif == showExif &&
|
||||
@@ -76,22 +76,22 @@ class CreateAlbumShareLinkDto {
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(albumId.hashCode) +
|
||||
(expiredAt == null ? 0 : expiredAt!.hashCode) +
|
||||
(expiresAt == null ? 0 : expiresAt!.hashCode) +
|
||||
(allowUpload == null ? 0 : allowUpload!.hashCode) +
|
||||
(allowDownload == null ? 0 : allowDownload!.hashCode) +
|
||||
(showExif == null ? 0 : showExif!.hashCode) +
|
||||
(description == null ? 0 : description!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'CreateAlbumShareLinkDto[albumId=$albumId, expiredAt=$expiredAt, allowUpload=$allowUpload, allowDownload=$allowDownload, showExif=$showExif, description=$description]';
|
||||
String toString() => 'CreateAlbumShareLinkDto[albumId=$albumId, expiresAt=$expiresAt, allowUpload=$allowUpload, allowDownload=$allowDownload, showExif=$showExif, description=$description]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'albumId'] = this.albumId;
|
||||
if (this.expiredAt != null) {
|
||||
json[r'expiredAt'] = this.expiredAt;
|
||||
if (this.expiresAt != null) {
|
||||
json[r'expiresAt'] = this.expiresAt;
|
||||
} else {
|
||||
// json[r'expiredAt'] = null;
|
||||
// json[r'expiresAt'] = null;
|
||||
}
|
||||
if (this.allowUpload != null) {
|
||||
json[r'allowUpload'] = this.allowUpload;
|
||||
@@ -136,7 +136,7 @@ class CreateAlbumShareLinkDto {
|
||||
|
||||
return CreateAlbumShareLinkDto(
|
||||
albumId: mapValueOfType<String>(json, r'albumId')!,
|
||||
expiredAt: mapValueOfType<String>(json, r'expiredAt'),
|
||||
expiresAt: mapValueOfType<String>(json, r'expiresAt'),
|
||||
allowUpload: mapValueOfType<bool>(json, r'allowUpload'),
|
||||
allowDownload: mapValueOfType<bool>(json, r'allowDownload'),
|
||||
showExif: mapValueOfType<bool>(json, r'showExif'),
|
||||
|
||||
@@ -14,7 +14,7 @@ class CreateAssetsShareLinkDto {
|
||||
/// Returns a new [CreateAssetsShareLinkDto] instance.
|
||||
CreateAssetsShareLinkDto({
|
||||
this.assetIds = const [],
|
||||
this.expiredAt,
|
||||
this.expiresAt,
|
||||
this.allowUpload,
|
||||
this.allowDownload,
|
||||
this.showExif,
|
||||
@@ -29,7 +29,7 @@ class CreateAssetsShareLinkDto {
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
String? expiredAt;
|
||||
String? expiresAt;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
@@ -66,7 +66,7 @@ class CreateAssetsShareLinkDto {
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is CreateAssetsShareLinkDto &&
|
||||
other.assetIds == assetIds &&
|
||||
other.expiredAt == expiredAt &&
|
||||
other.expiresAt == expiresAt &&
|
||||
other.allowUpload == allowUpload &&
|
||||
other.allowDownload == allowDownload &&
|
||||
other.showExif == showExif &&
|
||||
@@ -76,22 +76,22 @@ class CreateAssetsShareLinkDto {
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(assetIds.hashCode) +
|
||||
(expiredAt == null ? 0 : expiredAt!.hashCode) +
|
||||
(expiresAt == null ? 0 : expiresAt!.hashCode) +
|
||||
(allowUpload == null ? 0 : allowUpload!.hashCode) +
|
||||
(allowDownload == null ? 0 : allowDownload!.hashCode) +
|
||||
(showExif == null ? 0 : showExif!.hashCode) +
|
||||
(description == null ? 0 : description!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'CreateAssetsShareLinkDto[assetIds=$assetIds, expiredAt=$expiredAt, allowUpload=$allowUpload, allowDownload=$allowDownload, showExif=$showExif, description=$description]';
|
||||
String toString() => 'CreateAssetsShareLinkDto[assetIds=$assetIds, expiresAt=$expiresAt, allowUpload=$allowUpload, allowDownload=$allowDownload, showExif=$showExif, description=$description]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'assetIds'] = this.assetIds;
|
||||
if (this.expiredAt != null) {
|
||||
json[r'expiredAt'] = this.expiredAt;
|
||||
if (this.expiresAt != null) {
|
||||
json[r'expiresAt'] = this.expiresAt;
|
||||
} else {
|
||||
// json[r'expiredAt'] = null;
|
||||
// json[r'expiresAt'] = null;
|
||||
}
|
||||
if (this.allowUpload != null) {
|
||||
json[r'allowUpload'] = this.allowUpload;
|
||||
@@ -138,7 +138,7 @@ class CreateAssetsShareLinkDto {
|
||||
assetIds: json[r'assetIds'] is List
|
||||
? (json[r'assetIds'] as List).cast<String>()
|
||||
: const [],
|
||||
expiredAt: mapValueOfType<String>(json, r'expiredAt'),
|
||||
expiresAt: mapValueOfType<String>(json, r'expiresAt'),
|
||||
allowUpload: mapValueOfType<bool>(json, r'allowUpload'),
|
||||
allowDownload: mapValueOfType<bool>(json, r'allowDownload'),
|
||||
showExif: mapValueOfType<bool>(json, r'showExif'),
|
||||
|
||||
45
mobile/openapi/lib/model/edit_shared_link_dto.dart
generated
45
mobile/openapi/lib/model/edit_shared_link_dto.dart
generated
@@ -14,11 +14,10 @@ class EditSharedLinkDto {
|
||||
/// Returns a new [EditSharedLinkDto] instance.
|
||||
EditSharedLinkDto({
|
||||
this.description,
|
||||
this.expiredAt,
|
||||
this.expiresAt,
|
||||
this.allowUpload,
|
||||
this.allowDownload,
|
||||
this.showExif,
|
||||
this.isEditExpireTime,
|
||||
});
|
||||
|
||||
///
|
||||
@@ -29,13 +28,7 @@ class EditSharedLinkDto {
|
||||
///
|
||||
String? description;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
String? expiredAt;
|
||||
String? expiresAt;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
@@ -61,35 +54,25 @@ class EditSharedLinkDto {
|
||||
///
|
||||
bool? showExif;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
bool? isEditExpireTime;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is EditSharedLinkDto &&
|
||||
other.description == description &&
|
||||
other.expiredAt == expiredAt &&
|
||||
other.expiresAt == expiresAt &&
|
||||
other.allowUpload == allowUpload &&
|
||||
other.allowDownload == allowDownload &&
|
||||
other.showExif == showExif &&
|
||||
other.isEditExpireTime == isEditExpireTime;
|
||||
other.showExif == showExif;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(description == null ? 0 : description!.hashCode) +
|
||||
(expiredAt == null ? 0 : expiredAt!.hashCode) +
|
||||
(expiresAt == null ? 0 : expiresAt!.hashCode) +
|
||||
(allowUpload == null ? 0 : allowUpload!.hashCode) +
|
||||
(allowDownload == null ? 0 : allowDownload!.hashCode) +
|
||||
(showExif == null ? 0 : showExif!.hashCode) +
|
||||
(isEditExpireTime == null ? 0 : isEditExpireTime!.hashCode);
|
||||
(showExif == null ? 0 : showExif!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'EditSharedLinkDto[description=$description, expiredAt=$expiredAt, allowUpload=$allowUpload, allowDownload=$allowDownload, showExif=$showExif, isEditExpireTime=$isEditExpireTime]';
|
||||
String toString() => 'EditSharedLinkDto[description=$description, expiresAt=$expiresAt, allowUpload=$allowUpload, allowDownload=$allowDownload, showExif=$showExif]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@@ -98,10 +81,10 @@ class EditSharedLinkDto {
|
||||
} else {
|
||||
// json[r'description'] = null;
|
||||
}
|
||||
if (this.expiredAt != null) {
|
||||
json[r'expiredAt'] = this.expiredAt;
|
||||
if (this.expiresAt != null) {
|
||||
json[r'expiresAt'] = this.expiresAt;
|
||||
} else {
|
||||
// json[r'expiredAt'] = null;
|
||||
// json[r'expiresAt'] = null;
|
||||
}
|
||||
if (this.allowUpload != null) {
|
||||
json[r'allowUpload'] = this.allowUpload;
|
||||
@@ -118,11 +101,6 @@ class EditSharedLinkDto {
|
||||
} else {
|
||||
// json[r'showExif'] = null;
|
||||
}
|
||||
if (this.isEditExpireTime != null) {
|
||||
json[r'isEditExpireTime'] = this.isEditExpireTime;
|
||||
} else {
|
||||
// json[r'isEditExpireTime'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -146,11 +124,10 @@ class EditSharedLinkDto {
|
||||
|
||||
return EditSharedLinkDto(
|
||||
description: mapValueOfType<String>(json, r'description'),
|
||||
expiredAt: mapValueOfType<String>(json, r'expiredAt'),
|
||||
expiresAt: mapValueOfType<String>(json, r'expiresAt'),
|
||||
allowUpload: mapValueOfType<bool>(json, r'allowUpload'),
|
||||
allowDownload: mapValueOfType<bool>(json, r'allowDownload'),
|
||||
showExif: mapValueOfType<bool>(json, r'showExif'),
|
||||
isEditExpireTime: mapValueOfType<bool>(json, r'isEditExpireTime'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user