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:
Jason Rasmussen 2023-01-25 11:35:28 -05:00 committed by GitHub
parent f64db3a2f9
commit 8f304b8157
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 1481 additions and 1057 deletions

View file

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