Skip to content

Commit

Permalink
Fix: [공통] 서버 데이터 key camel case로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Yellowtoast committed Mar 3, 2024
1 parent 9bc9110 commit 51fffc8
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 42 deletions.
2 changes: 1 addition & 1 deletion lib/core/pagination/pagination_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PaginationResponse<T> {
items = (json['items'] as List<dynamic>)
.map((e) => fromJson.call(e))
.toList(),
isLastPage = json['is_last_page'] as bool;
isLastPage = json['isLastPage'] as bool;

final int page;
final int size;
Expand Down
7 changes: 2 additions & 5 deletions lib/features/pet/data/dto/pet_data_dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@ class PetDataListDto {
@JsonSerializable()
class PetDataDto {
final int id;
@JsonKey(name: 'birth_date')
final String birthDate;
final String breed;
final String name;
final bool neutered;
@JsonKey(name: 'pet_type')
final String petType;
final String sex;
@JsonKey(name: 'weight_in_kg')
final int weightKg;
final int weightInKg;

PetDataDto({
required this.id,
Expand All @@ -35,7 +32,7 @@ class PetDataDto {
required this.neutered,
required this.petType,
required this.sex,
required this.weightKg,
required this.weightInKg,
});

factory PetDataDto.fromJson(Map<String, dynamic> json) =>
Expand Down
12 changes: 6 additions & 6 deletions lib/features/pet/data/dto/pet_data_dto.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/features/pet/domain/breed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ part 'breed.g.dart';
class Breed with _$Breed {
factory Breed({
required int id,
@JsonKey(name: 'pet_type') required PetType petType,
required PetType petType,
required String name,
}) = _Breed;

Expand Down
14 changes: 4 additions & 10 deletions lib/features/pet/domain/breed.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Breed _$BreedFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$Breed {
int get id => throw _privateConstructorUsedError;
@JsonKey(name: 'pet_type')
PetType get petType => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;

Expand All @@ -35,7 +34,7 @@ abstract class $BreedCopyWith<$Res> {
factory $BreedCopyWith(Breed value, $Res Function(Breed) then) =
_$BreedCopyWithImpl<$Res, Breed>;
@useResult
$Res call({int id, @JsonKey(name: 'pet_type') PetType petType, String name});
$Res call({int id, PetType petType, String name});
}

/// @nodoc
Expand Down Expand Up @@ -78,7 +77,7 @@ abstract class _$$_BreedCopyWith<$Res> implements $BreedCopyWith<$Res> {
__$$_BreedCopyWithImpl<$Res>;
@override
@useResult
$Res call({int id, @JsonKey(name: 'pet_type') PetType petType, String name});
$Res call({int id, PetType petType, String name});
}

/// @nodoc
Expand Down Expand Up @@ -114,18 +113,14 @@ class __$$_BreedCopyWithImpl<$Res> extends _$BreedCopyWithImpl<$Res, _$_Breed>
/// @nodoc
@JsonSerializable()
class _$_Breed implements _Breed {
_$_Breed(
{required this.id,
@JsonKey(name: 'pet_type') required this.petType,
required this.name});
_$_Breed({required this.id, required this.petType, required this.name});

factory _$_Breed.fromJson(Map<String, dynamic> json) =>
_$$_BreedFromJson(json);

@override
final int id;
@override
@JsonKey(name: 'pet_type')
final PetType petType;
@override
final String name;
Expand Down Expand Up @@ -166,15 +161,14 @@ class _$_Breed implements _Breed {
abstract class _Breed implements Breed {
factory _Breed(
{required final int id,
@JsonKey(name: 'pet_type') required final PetType petType,
required final PetType petType,
required final String name}) = _$_Breed;

factory _Breed.fromJson(Map<String, dynamic> json) = _$_Breed.fromJson;

@override
int get id;
@override
@JsonKey(name: 'pet_type')
PetType get petType;
@override
String get name;
Expand Down
4 changes: 2 additions & 2 deletions lib/features/pet/domain/breed.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/features/pet/entities/pet_data_entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PetDataEntity with _$PetDataEntity {
neutered: dto.neutered,
petType: PetType.getByCode(dto.petType),
sexType: SexType.getByCode(dto.sex),
weightKg: dto.weightKg,
weightKg: dto.weightInKg,
breed: dto.breed);
}
}
11 changes: 7 additions & 4 deletions lib/features/pet/entities/pet_data_entity.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mixin _$PetDataEntity {
String get name => throw _privateConstructorUsedError;
bool get neutered => throw _privateConstructorUsedError;
PetType get petType => throw _privateConstructorUsedError;
@JsonKey(name: 'sex')
SexType get sexType => throw _privateConstructorUsedError;
int get weightKg => throw _privateConstructorUsedError;
String get breed => throw _privateConstructorUsedError;
Expand All @@ -42,7 +43,7 @@ abstract class $PetDataEntityCopyWith<$Res> {
String name,
bool neutered,
PetType petType,
SexType sexType,
@JsonKey(name: 'sex') SexType sexType,
int weightKg,
String breed});
}
Expand Down Expand Up @@ -120,7 +121,7 @@ abstract class _$$_PetDataEntityCopyWith<$Res>
String name,
bool neutered,
PetType petType,
SexType sexType,
@JsonKey(name: 'sex') SexType sexType,
int weightKg,
String breed});
}
Expand Down Expand Up @@ -191,7 +192,7 @@ class _$_PetDataEntity extends _PetDataEntity {
required this.name,
required this.neutered,
required this.petType,
required this.sexType,
@JsonKey(name: 'sex') required this.sexType,
required this.weightKg,
required this.breed})
: super._();
Expand All @@ -207,6 +208,7 @@ class _$_PetDataEntity extends _PetDataEntity {
@override
final PetType petType;
@override
@JsonKey(name: 'sex')
final SexType sexType;
@override
final int weightKg;
Expand Down Expand Up @@ -253,7 +255,7 @@ abstract class _PetDataEntity extends PetDataEntity {
required final String name,
required final bool neutered,
required final PetType petType,
required final SexType sexType,
@JsonKey(name: 'sex') required final SexType sexType,
required final int weightKg,
required final String breed}) = _$_PetDataEntity;
const _PetDataEntity._() : super._();
Expand All @@ -269,6 +271,7 @@ abstract class _PetDataEntity extends PetDataEntity {
@override
PetType get petType;
@override
@JsonKey(name: 'sex')
SexType get sexType;
@override
int get weightKg;
Expand Down
4 changes: 0 additions & 4 deletions lib/features/sos/data/dto/sos_post_dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@ class SosPostDto {
final AuthorDto author;
final String title;
final String content;
@JsonKey(name: 'date_start_at')
final String dateStartAt;
@JsonKey(name: 'date_end_at')
final String dateEndAt;
@JsonKey(name: 'thumbnail_id')
final int thumbnailId;
final List<SosConditionDto> conditions;
final List<MediaImageDto> media;
final String reward;
@JsonKey(name: 'reward_amount')
final String rewardAmount;
final List<PetDataDto> pets;

Expand Down
16 changes: 8 additions & 8 deletions lib/features/sos/data/dto/sos_post_dto.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 51fffc8

Please sign in to comment.