fix: API 응답 파싱 오류 수정 및 에러 처리 개선
주요 변경사항: - 창고 관리 API 응답 구조와 DTO 불일치 수정 - WarehouseLocationDto에 code, manager_phone 필드 추가 - RemoteDataSource에서 API 응답을 DTO 구조에 맞게 변환 - 회사 관리 API 응답 파싱 오류 수정 - CompanyResponse의 필수 필드를 nullable로 변경 - PaginatedResponse 구조 매핑 로직 개선 - 에러 처리 및 로깅 개선 - Service Layer에 상세 에러 로깅 추가 - Controller에서 에러 타입별 처리 - 새로운 유틸리티 추가 - ResponseInterceptor: API 응답 정규화 - DebugLogger: 디버깅 도구 - HealthCheckService: 서버 상태 확인 - 문서화 - API 통합 테스트 가이드 - 에러 분석 보고서 - 리팩토링 계획서
This commit is contained in:
@@ -7,9 +7,9 @@ part 'auth_user.g.dart';
|
||||
class AuthUser with _$AuthUser {
|
||||
const factory AuthUser({
|
||||
required int id,
|
||||
required String username,
|
||||
required String email,
|
||||
@JsonKey(name: 'first_name') required String firstName,
|
||||
@JsonKey(name: 'last_name') required String lastName,
|
||||
required String name,
|
||||
required String role,
|
||||
}) = _AuthUser;
|
||||
|
||||
|
||||
@@ -21,11 +21,9 @@ AuthUser _$AuthUserFromJson(Map<String, dynamic> json) {
|
||||
/// @nodoc
|
||||
mixin _$AuthUser {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
String get username => throw _privateConstructorUsedError;
|
||||
String get email => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'first_name')
|
||||
String get firstName => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'last_name')
|
||||
String get lastName => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
String get role => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this AuthUser to a JSON map.
|
||||
@@ -43,12 +41,7 @@ abstract class $AuthUserCopyWith<$Res> {
|
||||
factory $AuthUserCopyWith(AuthUser value, $Res Function(AuthUser) then) =
|
||||
_$AuthUserCopyWithImpl<$Res, AuthUser>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
String email,
|
||||
@JsonKey(name: 'first_name') String firstName,
|
||||
@JsonKey(name: 'last_name') String lastName,
|
||||
String role});
|
||||
$Res call({int id, String username, String email, String name, String role});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -67,9 +60,9 @@ class _$AuthUserCopyWithImpl<$Res, $Val extends AuthUser>
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? username = null,
|
||||
Object? email = null,
|
||||
Object? firstName = null,
|
||||
Object? lastName = null,
|
||||
Object? name = null,
|
||||
Object? role = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
@@ -77,17 +70,17 @@ class _$AuthUserCopyWithImpl<$Res, $Val extends AuthUser>
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
username: null == username
|
||||
? _value.username
|
||||
: username // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
firstName: null == firstName
|
||||
? _value.firstName
|
||||
: firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
lastName: null == lastName
|
||||
? _value.lastName
|
||||
: lastName // ignore: cast_nullable_to_non_nullable
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
role: null == role
|
||||
? _value.role
|
||||
@@ -105,12 +98,7 @@ abstract class _$$AuthUserImplCopyWith<$Res>
|
||||
__$$AuthUserImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
String email,
|
||||
@JsonKey(name: 'first_name') String firstName,
|
||||
@JsonKey(name: 'last_name') String lastName,
|
||||
String role});
|
||||
$Res call({int id, String username, String email, String name, String role});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -127,9 +115,9 @@ class __$$AuthUserImplCopyWithImpl<$Res>
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? username = null,
|
||||
Object? email = null,
|
||||
Object? firstName = null,
|
||||
Object? lastName = null,
|
||||
Object? name = null,
|
||||
Object? role = null,
|
||||
}) {
|
||||
return _then(_$AuthUserImpl(
|
||||
@@ -137,17 +125,17 @@ class __$$AuthUserImplCopyWithImpl<$Res>
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
username: null == username
|
||||
? _value.username
|
||||
: username // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
firstName: null == firstName
|
||||
? _value.firstName
|
||||
: firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
lastName: null == lastName
|
||||
? _value.lastName
|
||||
: lastName // ignore: cast_nullable_to_non_nullable
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
role: null == role
|
||||
? _value.role
|
||||
@@ -162,9 +150,9 @@ class __$$AuthUserImplCopyWithImpl<$Res>
|
||||
class _$AuthUserImpl implements _AuthUser {
|
||||
const _$AuthUserImpl(
|
||||
{required this.id,
|
||||
required this.username,
|
||||
required this.email,
|
||||
@JsonKey(name: 'first_name') required this.firstName,
|
||||
@JsonKey(name: 'last_name') required this.lastName,
|
||||
required this.name,
|
||||
required this.role});
|
||||
|
||||
factory _$AuthUserImpl.fromJson(Map<String, dynamic> json) =>
|
||||
@@ -173,19 +161,17 @@ class _$AuthUserImpl implements _AuthUser {
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
final String username;
|
||||
@override
|
||||
final String email;
|
||||
@override
|
||||
@JsonKey(name: 'first_name')
|
||||
final String firstName;
|
||||
@override
|
||||
@JsonKey(name: 'last_name')
|
||||
final String lastName;
|
||||
final String name;
|
||||
@override
|
||||
final String role;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthUser(id: $id, email: $email, firstName: $firstName, lastName: $lastName, role: $role)';
|
||||
return 'AuthUser(id: $id, username: $username, email: $email, name: $name, role: $role)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -194,18 +180,16 @@ class _$AuthUserImpl implements _AuthUser {
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AuthUserImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.username, username) ||
|
||||
other.username == username) &&
|
||||
(identical(other.email, email) || other.email == email) &&
|
||||
(identical(other.firstName, firstName) ||
|
||||
other.firstName == firstName) &&
|
||||
(identical(other.lastName, lastName) ||
|
||||
other.lastName == lastName) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.role, role) || other.role == role));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, id, email, firstName, lastName, role);
|
||||
int get hashCode => Object.hash(runtimeType, id, username, email, name, role);
|
||||
|
||||
/// Create a copy of AuthUser
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -226,9 +210,9 @@ class _$AuthUserImpl implements _AuthUser {
|
||||
abstract class _AuthUser implements AuthUser {
|
||||
const factory _AuthUser(
|
||||
{required final int id,
|
||||
required final String username,
|
||||
required final String email,
|
||||
@JsonKey(name: 'first_name') required final String firstName,
|
||||
@JsonKey(name: 'last_name') required final String lastName,
|
||||
required final String name,
|
||||
required final String role}) = _$AuthUserImpl;
|
||||
|
||||
factory _AuthUser.fromJson(Map<String, dynamic> json) =
|
||||
@@ -237,13 +221,11 @@ abstract class _AuthUser implements AuthUser {
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
String get username;
|
||||
@override
|
||||
String get email;
|
||||
@override
|
||||
@JsonKey(name: 'first_name')
|
||||
String get firstName;
|
||||
@override
|
||||
@JsonKey(name: 'last_name')
|
||||
String get lastName;
|
||||
String get name;
|
||||
@override
|
||||
String get role;
|
||||
|
||||
|
||||
@@ -9,17 +9,17 @@ part of 'auth_user.dart';
|
||||
_$AuthUserImpl _$$AuthUserImplFromJson(Map<String, dynamic> json) =>
|
||||
_$AuthUserImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
username: json['username'] as String,
|
||||
email: json['email'] as String,
|
||||
firstName: json['first_name'] as String,
|
||||
lastName: json['last_name'] as String,
|
||||
name: json['name'] as String,
|
||||
role: json['role'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$AuthUserImplToJson(_$AuthUserImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'username': instance.username,
|
||||
'email': instance.email,
|
||||
'first_name': instance.firstName,
|
||||
'last_name': instance.lastName,
|
||||
'name': instance.name,
|
||||
'role': instance.role,
|
||||
};
|
||||
|
||||
@@ -6,7 +6,8 @@ part 'login_request.g.dart';
|
||||
@freezed
|
||||
class LoginRequest with _$LoginRequest {
|
||||
const factory LoginRequest({
|
||||
required String email,
|
||||
String? username,
|
||||
String? email,
|
||||
required String password,
|
||||
}) = _LoginRequest;
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ LoginRequest _$LoginRequestFromJson(Map<String, dynamic> json) {
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LoginRequest {
|
||||
String get email => throw _privateConstructorUsedError;
|
||||
String? get username => throw _privateConstructorUsedError;
|
||||
String? get email => throw _privateConstructorUsedError;
|
||||
String get password => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this LoginRequest to a JSON map.
|
||||
@@ -39,7 +40,7 @@ abstract class $LoginRequestCopyWith<$Res> {
|
||||
LoginRequest value, $Res Function(LoginRequest) then) =
|
||||
_$LoginRequestCopyWithImpl<$Res, LoginRequest>;
|
||||
@useResult
|
||||
$Res call({String email, String password});
|
||||
$Res call({String? username, String? email, String password});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -57,14 +58,19 @@ class _$LoginRequestCopyWithImpl<$Res, $Val extends LoginRequest>
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? email = null,
|
||||
Object? username = freezed,
|
||||
Object? email = freezed,
|
||||
Object? password = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
email: null == email
|
||||
username: freezed == username
|
||||
? _value.username
|
||||
: username // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
email: freezed == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
as String?,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
@@ -81,7 +87,7 @@ abstract class _$$LoginRequestImplCopyWith<$Res>
|
||||
__$$LoginRequestImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String email, String password});
|
||||
$Res call({String? username, String? email, String password});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -97,14 +103,19 @@ class __$$LoginRequestImplCopyWithImpl<$Res>
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? email = null,
|
||||
Object? username = freezed,
|
||||
Object? email = freezed,
|
||||
Object? password = null,
|
||||
}) {
|
||||
return _then(_$LoginRequestImpl(
|
||||
email: null == email
|
||||
username: freezed == username
|
||||
? _value.username
|
||||
: username // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
email: freezed == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
as String?,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
@@ -116,19 +127,21 @@ class __$$LoginRequestImplCopyWithImpl<$Res>
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$LoginRequestImpl implements _LoginRequest {
|
||||
const _$LoginRequestImpl({required this.email, required this.password});
|
||||
const _$LoginRequestImpl({this.username, this.email, required this.password});
|
||||
|
||||
factory _$LoginRequestImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LoginRequestImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String email;
|
||||
final String? username;
|
||||
@override
|
||||
final String? email;
|
||||
@override
|
||||
final String password;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginRequest(email: $email, password: $password)';
|
||||
return 'LoginRequest(username: $username, email: $email, password: $password)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -136,6 +149,8 @@ class _$LoginRequestImpl implements _LoginRequest {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LoginRequestImpl &&
|
||||
(identical(other.username, username) ||
|
||||
other.username == username) &&
|
||||
(identical(other.email, email) || other.email == email) &&
|
||||
(identical(other.password, password) ||
|
||||
other.password == password));
|
||||
@@ -143,7 +158,7 @@ class _$LoginRequestImpl implements _LoginRequest {
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, email, password);
|
||||
int get hashCode => Object.hash(runtimeType, username, email, password);
|
||||
|
||||
/// Create a copy of LoginRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -163,14 +178,17 @@ class _$LoginRequestImpl implements _LoginRequest {
|
||||
|
||||
abstract class _LoginRequest implements LoginRequest {
|
||||
const factory _LoginRequest(
|
||||
{required final String email,
|
||||
{final String? username,
|
||||
final String? email,
|
||||
required final String password}) = _$LoginRequestImpl;
|
||||
|
||||
factory _LoginRequest.fromJson(Map<String, dynamic> json) =
|
||||
_$LoginRequestImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get email;
|
||||
String? get username;
|
||||
@override
|
||||
String? get email;
|
||||
@override
|
||||
String get password;
|
||||
|
||||
|
||||
@@ -8,12 +8,14 @@ part of 'login_request.dart';
|
||||
|
||||
_$LoginRequestImpl _$$LoginRequestImplFromJson(Map<String, dynamic> json) =>
|
||||
_$LoginRequestImpl(
|
||||
email: json['email'] as String,
|
||||
username: json['username'] as String?,
|
||||
email: json['email'] as String?,
|
||||
password: json['password'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LoginRequestImplToJson(_$LoginRequestImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'username': instance.username,
|
||||
'email': instance.email,
|
||||
'password': instance.password,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user