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

fix(server) added TagResponseDto for TagController (#1065)

* fix(server) added TagResponseDto for TagController

* Added userId to DTO
This commit is contained in:
Alex
2022-12-06 15:46:13 -06:00
committed by GitHub
parent db34f2f7fd
commit f91bdc2785
13 changed files with 107 additions and 941 deletions

View File

@ -48,7 +48,6 @@ part 'model/all_job_status_response_dto.dart';
part 'model/asset_count_by_time_bucket.dart';
part 'model/asset_count_by_time_bucket_response_dto.dart';
part 'model/asset_count_by_user_id_response_dto.dart';
part 'model/asset_entity.dart';
part 'model/asset_file_upload_response_dto.dart';
part 'model/asset_response_dto.dart';
part 'model/asset_type_enum.dart';
@ -68,7 +67,6 @@ part 'model/delete_asset_response_dto.dart';
part 'model/delete_asset_status.dart';
part 'model/device_info_response_dto.dart';
part 'model/device_type_enum.dart';
part 'model/exif_entity.dart';
part 'model/exif_response_dto.dart';
part 'model/get_asset_by_time_bucket_dto.dart';
part 'model/get_asset_count_by_time_bucket_dto.dart';
@ -90,12 +88,10 @@ part 'model/server_ping_response.dart';
part 'model/server_stats_response_dto.dart';
part 'model/server_version_reponse_dto.dart';
part 'model/sign_up_dto.dart';
part 'model/smart_info_entity.dart';
part 'model/smart_info_response_dto.dart';
part 'model/system_config_key.dart';
part 'model/system_config_response_dto.dart';
part 'model/system_config_response_item.dart';
part 'model/tag_entity.dart';
part 'model/tag_response_dto.dart';
part 'model/tag_type_enum.dart';
part 'model/thumbnail_format.dart';
@ -107,7 +103,6 @@ part 'model/update_tag_dto.dart';
part 'model/update_user_dto.dart';
part 'model/usage_by_user_dto.dart';
part 'model/user_count_response_dto.dart';
part 'model/user_entity.dart';
part 'model/user_response_dto.dart';
part 'model/validate_access_token_response_dto.dart';

View File

@ -48,7 +48,7 @@ class TagApi {
/// Parameters:
///
/// * [CreateTagDto] createTagDto (required):
Future<TagEntity?> create(CreateTagDto createTagDto,) async {
Future<TagResponseDto?> create(CreateTagDto createTagDto,) async {
final response = await createWithHttpInfo(createTagDto,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@ -57,7 +57,7 @@ class TagApi {
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'TagEntity',) as TagEntity;
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'TagResponseDto',) as TagResponseDto;
}
return null;
@ -96,19 +96,11 @@ class TagApi {
/// Parameters:
///
/// * [String] id (required):
Future<TagEntity?> delete(String id,) async {
Future<void> delete(String id,) async {
final response = await deleteWithHttpInfo(id,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'TagEntity',) as TagEntity;
}
return null;
}
/// Performs an HTTP 'GET /tag' operation and returns the [Response].
@ -137,7 +129,7 @@ class TagApi {
);
}
Future<List<TagEntity>?> findAll() async {
Future<List<TagResponseDto>?> findAll() async {
final response = await findAllWithHttpInfo();
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@ -147,8 +139,8 @@ class TagApi {
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
final responseBody = await _decodeBodyBytes(response);
return (await apiClient.deserializeAsync(responseBody, 'List<TagEntity>') as List)
.cast<TagEntity>()
return (await apiClient.deserializeAsync(responseBody, 'List<TagResponseDto>') as List)
.cast<TagResponseDto>()
.toList();
}
@ -188,7 +180,7 @@ class TagApi {
/// Parameters:
///
/// * [String] id (required):
Future<TagEntity?> findOne(String id,) async {
Future<TagResponseDto?> findOne(String id,) async {
final response = await findOneWithHttpInfo(id,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@ -197,7 +189,7 @@ class TagApi {
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'TagEntity',) as TagEntity;
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'TagResponseDto',) as TagResponseDto;
}
return null;
@ -240,7 +232,7 @@ class TagApi {
/// * [String] id (required):
///
/// * [UpdateTagDto] updateTagDto (required):
Future<Object?> update(String id, UpdateTagDto updateTagDto,) async {
Future<TagResponseDto?> update(String id, UpdateTagDto updateTagDto,) async {
final response = await updateWithHttpInfo(id, updateTagDto,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@ -249,7 +241,7 @@ class TagApi {
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'TagResponseDto',) as TagResponseDto;
}
return null;

View File

@ -212,8 +212,6 @@ class ApiClient {
return AssetCountByTimeBucketResponseDto.fromJson(value);
case 'AssetCountByUserIdResponseDto':
return AssetCountByUserIdResponseDto.fromJson(value);
case 'AssetEntity':
return AssetEntity.fromJson(value);
case 'AssetFileUploadResponseDto':
return AssetFileUploadResponseDto.fromJson(value);
case 'AssetResponseDto':
@ -252,8 +250,6 @@ class ApiClient {
return DeviceInfoResponseDto.fromJson(value);
case 'DeviceTypeEnum':
return DeviceTypeEnumTypeTransformer().decode(value);
case 'ExifEntity':
return ExifEntity.fromJson(value);
case 'ExifResponseDto':
return ExifResponseDto.fromJson(value);
case 'GetAssetByTimeBucketDto':
@ -296,8 +292,6 @@ class ApiClient {
return ServerVersionReponseDto.fromJson(value);
case 'SignUpDto':
return SignUpDto.fromJson(value);
case 'SmartInfoEntity':
return SmartInfoEntity.fromJson(value);
case 'SmartInfoResponseDto':
return SmartInfoResponseDto.fromJson(value);
case 'SystemConfigKey':
@ -306,8 +300,6 @@ class ApiClient {
return SystemConfigResponseDto.fromJson(value);
case 'SystemConfigResponseItem':
return SystemConfigResponseItem.fromJson(value);
case 'TagEntity':
return TagEntity.fromJson(value);
case 'TagResponseDto':
return TagResponseDto.fromJson(value);
case 'TagTypeEnum':
@ -330,8 +322,6 @@ class ApiClient {
return UsageByUserDto.fromJson(value);
case 'UserCountResponseDto':
return UserCountResponseDto.fromJson(value);
case 'UserEntity':
return UserEntity.fromJson(value);
case 'UserResponseDto':
return UserResponseDto.fromJson(value);
case 'ValidateAccessTokenResponseDto':

View File

@ -16,6 +16,8 @@ class TagResponseDto {
required this.id,
required this.type,
required this.name,
required this.userId,
this.renameTagId,
});
String id;
@ -24,27 +26,41 @@ class TagResponseDto {
String name;
String userId;
String? renameTagId;
@override
bool operator ==(Object other) => identical(this, other) || other is TagResponseDto &&
other.id == id &&
other.type == type &&
other.name == name;
other.name == name &&
other.userId == userId &&
other.renameTagId == renameTagId;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(id.hashCode) +
(type.hashCode) +
(name.hashCode);
(name.hashCode) +
(userId.hashCode) +
(renameTagId == null ? 0 : renameTagId!.hashCode);
@override
String toString() => 'TagResponseDto[id=$id, type=$type, name=$name]';
String toString() => 'TagResponseDto[id=$id, type=$type, name=$name, userId=$userId, renameTagId=$renameTagId]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
_json[r'type'] = type;
_json[r'name'] = name;
_json[r'userId'] = userId;
if (renameTagId != null) {
_json[r'renameTagId'] = renameTagId;
} else {
_json[r'renameTagId'] = null;
}
return _json;
}
@ -70,6 +86,8 @@ class TagResponseDto {
id: mapValueOfType<String>(json, r'id')!,
type: TagTypeEnum.fromJson(json[r'type'])!,
name: mapValueOfType<String>(json, r'name')!,
userId: mapValueOfType<String>(json, r'userId')!,
renameTagId: mapValueOfType<String>(json, r'renameTagId'),
);
}
return null;
@ -122,6 +140,7 @@ class TagResponseDto {
'id',
'type',
'name',
'userId',
};
}