1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-17 10:47:43 +02:00

refactor(server): album count (#2746)

* refactor(server): album count

* chore: open api
This commit is contained in:
Jason Rasmussen
2023-06-16 11:48:48 -04:00
committed by GitHub
parent 441ee2ef90
commit 07f7fffae7
21 changed files with 100 additions and 95 deletions

View File

@ -332,10 +332,10 @@ class AlbumApi {
return null;
}
/// Performs an HTTP 'GET /album/count-by-user-id' operation and returns the [Response].
Future<Response> getAlbumCountByUserIdWithHttpInfo() async {
/// Performs an HTTP 'GET /album/count' operation and returns the [Response].
Future<Response> getAlbumCountWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/album/count-by-user-id';
final path = r'/album/count';
// ignore: prefer_final_locals
Object? postBody;
@ -358,8 +358,8 @@ class AlbumApi {
);
}
Future<AlbumCountResponseDto?> getAlbumCountByUserId() async {
final response = await getAlbumCountByUserIdWithHttpInfo();
Future<AlbumCountResponseDto?> getAlbumCount() async {
final response = await getAlbumCountWithHttpInfo();
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}

View File

@ -15,36 +15,36 @@ class AlbumCountResponseDto {
AlbumCountResponseDto({
required this.owned,
required this.shared,
required this.sharing,
required this.notShared,
});
int owned;
int shared;
int sharing;
int notShared;
@override
bool operator ==(Object other) => identical(this, other) || other is AlbumCountResponseDto &&
other.owned == owned &&
other.shared == shared &&
other.sharing == sharing;
other.notShared == notShared;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(owned.hashCode) +
(shared.hashCode) +
(sharing.hashCode);
(notShared.hashCode);
@override
String toString() => 'AlbumCountResponseDto[owned=$owned, shared=$shared, sharing=$sharing]';
String toString() => 'AlbumCountResponseDto[owned=$owned, shared=$shared, notShared=$notShared]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'owned'] = this.owned;
json[r'shared'] = this.shared;
json[r'sharing'] = this.sharing;
json[r'notShared'] = this.notShared;
return json;
}
@ -69,7 +69,7 @@ class AlbumCountResponseDto {
return AlbumCountResponseDto(
owned: mapValueOfType<int>(json, r'owned')!,
shared: mapValueOfType<int>(json, r'shared')!,
sharing: mapValueOfType<int>(json, r'sharing')!,
notShared: mapValueOfType<int>(json, r'notShared')!,
);
}
return null;
@ -119,7 +119,7 @@ class AlbumCountResponseDto {
static const requiredKeys = <String>{
'owned',
'shared',
'sharing',
'notShared',
};
}