1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-16 07:24:40 +02:00

refactor: api validators (boolean and date) (#7709)

* refactor: api validators (boolean and date)

* chore: open api

* revert: time bucket change
This commit is contained in:
Jason Rasmussen
2024-03-07 22:59:02 -05:00
committed by GitHub
parent 753842745d
commit a50f125dd1
41 changed files with 276 additions and 368 deletions

View File

@ -15,7 +15,7 @@ class SharedLinkCreateDto {
SharedLinkCreateDto({
this.albumId,
this.allowDownload = true,
this.allowUpload = false,
this.allowUpload,
this.assetIds = const [],
this.description,
this.expiresAt,
@ -34,7 +34,13 @@ class SharedLinkCreateDto {
bool allowDownload;
bool allowUpload;
///
/// 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? allowUpload;
List<String> assetIds;
@ -77,7 +83,7 @@ class SharedLinkCreateDto {
// ignore: unnecessary_parenthesis
(albumId == null ? 0 : albumId!.hashCode) +
(allowDownload.hashCode) +
(allowUpload.hashCode) +
(allowUpload == null ? 0 : allowUpload!.hashCode) +
(assetIds.hashCode) +
(description == null ? 0 : description!.hashCode) +
(expiresAt == null ? 0 : expiresAt!.hashCode) +
@ -96,7 +102,11 @@ class SharedLinkCreateDto {
// json[r'albumId'] = null;
}
json[r'allowDownload'] = this.allowDownload;
if (this.allowUpload != null) {
json[r'allowUpload'] = this.allowUpload;
} else {
// json[r'allowUpload'] = null;
}
json[r'assetIds'] = this.assetIds;
if (this.description != null) {
json[r'description'] = this.description;
@ -128,7 +138,7 @@ class SharedLinkCreateDto {
return SharedLinkCreateDto(
albumId: mapValueOfType<String>(json, r'albumId'),
allowDownload: mapValueOfType<bool>(json, r'allowDownload') ?? true,
allowUpload: mapValueOfType<bool>(json, r'allowUpload') ?? false,
allowUpload: mapValueOfType<bool>(json, r'allowUpload'),
assetIds: json[r'assetIds'] is Iterable
? (json[r'assetIds'] as Iterable).cast<String>().toList(growable: false)
: const [],