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

refactor(server): library service (#8050)

* refactor: library service

* chore: open api

* fix: checks
This commit is contained in:
Jason Rasmussen
2024-03-18 15:59:53 -05:00
committed by GitHub
parent 761e7fdd2d
commit 40262c30cb
21 changed files with 198 additions and 335 deletions

View File

@@ -18,7 +18,7 @@ class CreateLibraryDto {
this.isVisible,
this.isWatched,
this.name,
this.ownerId,
required this.ownerId,
required this.type,
});
@@ -50,13 +50,7 @@ class CreateLibraryDto {
///
String? name;
///
/// 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? ownerId;
String ownerId;
LibraryType type;
@@ -78,7 +72,7 @@ class CreateLibraryDto {
(isVisible == null ? 0 : isVisible!.hashCode) +
(isWatched == null ? 0 : isWatched!.hashCode) +
(name == null ? 0 : name!.hashCode) +
(ownerId == null ? 0 : ownerId!.hashCode) +
(ownerId.hashCode) +
(type.hashCode);
@override
@@ -103,11 +97,7 @@ class CreateLibraryDto {
} else {
// json[r'name'] = null;
}
if (this.ownerId != null) {
json[r'ownerId'] = this.ownerId;
} else {
// json[r'ownerId'] = null;
}
json[r'type'] = this.type;
return json;
}
@@ -129,7 +119,7 @@ class CreateLibraryDto {
isVisible: mapValueOfType<bool>(json, r'isVisible'),
isWatched: mapValueOfType<bool>(json, r'isWatched'),
name: mapValueOfType<String>(json, r'name'),
ownerId: mapValueOfType<String>(json, r'ownerId'),
ownerId: mapValueOfType<String>(json, r'ownerId')!,
type: LibraryType.fromJson(json[r'type'])!,
);
}
@@ -178,6 +168,7 @@ class CreateLibraryDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'ownerId',
'type',
};
}

View File

@@ -67,7 +67,7 @@ class ValidateLibraryImportPathResponseDto {
return ValidateLibraryImportPathResponseDto(
importPath: mapValueOfType<String>(json, r'importPath')!,
isValid: mapValueOfType<bool>(json, r'isValid') ?? false,
isValid: mapValueOfType<bool>(json, r'isValid')!,
message: mapValueOfType<String>(json, r'message'),
);
}
@@ -117,6 +117,7 @@ class ValidateLibraryImportPathResponseDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'importPath',
'isValid',
};
}