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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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',
};
}