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:
JiWoong Sul
2025-07-31 19:15:39 +09:00
parent ad2c699ff7
commit f08b7fec79
89 changed files with 10521 additions and 892 deletions

View File

@@ -23,11 +23,18 @@ mixin _$RecentActivity {
int get id => throw _privateConstructorUsedError;
@JsonKey(name: 'activity_type')
String get activityType => throw _privateConstructorUsedError;
@JsonKey(name: 'entity_type')
String get entityType => throw _privateConstructorUsedError;
@JsonKey(name: 'entity_id')
int get entityId => throw _privateConstructorUsedError;
@JsonKey(name: 'entity_name')
String get entityName => throw _privateConstructorUsedError;
String get description => throw _privateConstructorUsedError;
@JsonKey(name: 'user_id')
int? get userId => throw _privateConstructorUsedError;
@JsonKey(name: 'user_name')
String get userName => throw _privateConstructorUsedError;
@JsonKey(name: 'created_at')
DateTime get createdAt => throw _privateConstructorUsedError;
String? get userName => throw _privateConstructorUsedError;
DateTime get timestamp => throw _privateConstructorUsedError;
Map<String, dynamic>? get metadata => throw _privateConstructorUsedError;
/// Serializes this RecentActivity to a JSON map.
@@ -49,9 +56,13 @@ abstract class $RecentActivityCopyWith<$Res> {
$Res call(
{int id,
@JsonKey(name: 'activity_type') String activityType,
@JsonKey(name: 'entity_type') String entityType,
@JsonKey(name: 'entity_id') int entityId,
@JsonKey(name: 'entity_name') String entityName,
String description,
@JsonKey(name: 'user_name') String userName,
@JsonKey(name: 'created_at') DateTime createdAt,
@JsonKey(name: 'user_id') int? userId,
@JsonKey(name: 'user_name') String? userName,
DateTime timestamp,
Map<String, dynamic>? metadata});
}
@@ -72,9 +83,13 @@ class _$RecentActivityCopyWithImpl<$Res, $Val extends RecentActivity>
$Res call({
Object? id = null,
Object? activityType = null,
Object? entityType = null,
Object? entityId = null,
Object? entityName = null,
Object? description = null,
Object? userName = null,
Object? createdAt = null,
Object? userId = freezed,
Object? userName = freezed,
Object? timestamp = null,
Object? metadata = freezed,
}) {
return _then(_value.copyWith(
@@ -86,17 +101,33 @@ class _$RecentActivityCopyWithImpl<$Res, $Val extends RecentActivity>
? _value.activityType
: activityType // ignore: cast_nullable_to_non_nullable
as String,
entityType: null == entityType
? _value.entityType
: entityType // ignore: cast_nullable_to_non_nullable
as String,
entityId: null == entityId
? _value.entityId
: entityId // ignore: cast_nullable_to_non_nullable
as int,
entityName: null == entityName
? _value.entityName
: entityName // ignore: cast_nullable_to_non_nullable
as String,
description: null == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
userName: null == userName
userId: freezed == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as int?,
userName: freezed == userName
? _value.userName
: userName // ignore: cast_nullable_to_non_nullable
as String,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as String?,
timestamp: null == timestamp
? _value.timestamp
: timestamp // ignore: cast_nullable_to_non_nullable
as DateTime,
metadata: freezed == metadata
? _value.metadata
@@ -117,9 +148,13 @@ abstract class _$$RecentActivityImplCopyWith<$Res>
$Res call(
{int id,
@JsonKey(name: 'activity_type') String activityType,
@JsonKey(name: 'entity_type') String entityType,
@JsonKey(name: 'entity_id') int entityId,
@JsonKey(name: 'entity_name') String entityName,
String description,
@JsonKey(name: 'user_name') String userName,
@JsonKey(name: 'created_at') DateTime createdAt,
@JsonKey(name: 'user_id') int? userId,
@JsonKey(name: 'user_name') String? userName,
DateTime timestamp,
Map<String, dynamic>? metadata});
}
@@ -138,9 +173,13 @@ class __$$RecentActivityImplCopyWithImpl<$Res>
$Res call({
Object? id = null,
Object? activityType = null,
Object? entityType = null,
Object? entityId = null,
Object? entityName = null,
Object? description = null,
Object? userName = null,
Object? createdAt = null,
Object? userId = freezed,
Object? userName = freezed,
Object? timestamp = null,
Object? metadata = freezed,
}) {
return _then(_$RecentActivityImpl(
@@ -152,17 +191,33 @@ class __$$RecentActivityImplCopyWithImpl<$Res>
? _value.activityType
: activityType // ignore: cast_nullable_to_non_nullable
as String,
entityType: null == entityType
? _value.entityType
: entityType // ignore: cast_nullable_to_non_nullable
as String,
entityId: null == entityId
? _value.entityId
: entityId // ignore: cast_nullable_to_non_nullable
as int,
entityName: null == entityName
? _value.entityName
: entityName // ignore: cast_nullable_to_non_nullable
as String,
description: null == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
userName: null == userName
userId: freezed == userId
? _value.userId
: userId // ignore: cast_nullable_to_non_nullable
as int?,
userName: freezed == userName
? _value.userName
: userName // ignore: cast_nullable_to_non_nullable
as String,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as String?,
timestamp: null == timestamp
? _value.timestamp
: timestamp // ignore: cast_nullable_to_non_nullable
as DateTime,
metadata: freezed == metadata
? _value._metadata
@@ -178,9 +233,13 @@ class _$RecentActivityImpl implements _RecentActivity {
const _$RecentActivityImpl(
{required this.id,
@JsonKey(name: 'activity_type') required this.activityType,
@JsonKey(name: 'entity_type') required this.entityType,
@JsonKey(name: 'entity_id') required this.entityId,
@JsonKey(name: 'entity_name') required this.entityName,
required this.description,
@JsonKey(name: 'user_name') required this.userName,
@JsonKey(name: 'created_at') required this.createdAt,
@JsonKey(name: 'user_id') this.userId,
@JsonKey(name: 'user_name') this.userName,
required this.timestamp,
final Map<String, dynamic>? metadata})
: _metadata = metadata;
@@ -193,13 +252,24 @@ class _$RecentActivityImpl implements _RecentActivity {
@JsonKey(name: 'activity_type')
final String activityType;
@override
@JsonKey(name: 'entity_type')
final String entityType;
@override
@JsonKey(name: 'entity_id')
final int entityId;
@override
@JsonKey(name: 'entity_name')
final String entityName;
@override
final String description;
@override
@JsonKey(name: 'user_name')
final String userName;
@JsonKey(name: 'user_id')
final int? userId;
@override
@JsonKey(name: 'created_at')
final DateTime createdAt;
@JsonKey(name: 'user_name')
final String? userName;
@override
final DateTime timestamp;
final Map<String, dynamic>? _metadata;
@override
Map<String, dynamic>? get metadata {
@@ -212,7 +282,7 @@ class _$RecentActivityImpl implements _RecentActivity {
@override
String toString() {
return 'RecentActivity(id: $id, activityType: $activityType, description: $description, userName: $userName, createdAt: $createdAt, metadata: $metadata)';
return 'RecentActivity(id: $id, activityType: $activityType, entityType: $entityType, entityId: $entityId, entityName: $entityName, description: $description, userId: $userId, userName: $userName, timestamp: $timestamp, metadata: $metadata)';
}
@override
@@ -223,19 +293,36 @@ class _$RecentActivityImpl implements _RecentActivity {
(identical(other.id, id) || other.id == id) &&
(identical(other.activityType, activityType) ||
other.activityType == activityType) &&
(identical(other.entityType, entityType) ||
other.entityType == entityType) &&
(identical(other.entityId, entityId) ||
other.entityId == entityId) &&
(identical(other.entityName, entityName) ||
other.entityName == entityName) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.userId, userId) || other.userId == userId) &&
(identical(other.userName, userName) ||
other.userName == userName) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.timestamp, timestamp) ||
other.timestamp == timestamp) &&
const DeepCollectionEquality().equals(other._metadata, _metadata));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, activityType, description,
userName, createdAt, const DeepCollectionEquality().hash(_metadata));
int get hashCode => Object.hash(
runtimeType,
id,
activityType,
entityType,
entityId,
entityName,
description,
userId,
userName,
timestamp,
const DeepCollectionEquality().hash(_metadata));
/// Create a copy of RecentActivity
/// with the given fields replaced by the non-null parameter values.
@@ -258,9 +345,13 @@ abstract class _RecentActivity implements RecentActivity {
const factory _RecentActivity(
{required final int id,
@JsonKey(name: 'activity_type') required final String activityType,
@JsonKey(name: 'entity_type') required final String entityType,
@JsonKey(name: 'entity_id') required final int entityId,
@JsonKey(name: 'entity_name') required final String entityName,
required final String description,
@JsonKey(name: 'user_name') required final String userName,
@JsonKey(name: 'created_at') required final DateTime createdAt,
@JsonKey(name: 'user_id') final int? userId,
@JsonKey(name: 'user_name') final String? userName,
required final DateTime timestamp,
final Map<String, dynamic>? metadata}) = _$RecentActivityImpl;
factory _RecentActivity.fromJson(Map<String, dynamic> json) =
@@ -272,13 +363,24 @@ abstract class _RecentActivity implements RecentActivity {
@JsonKey(name: 'activity_type')
String get activityType;
@override
@JsonKey(name: 'entity_type')
String get entityType;
@override
@JsonKey(name: 'entity_id')
int get entityId;
@override
@JsonKey(name: 'entity_name')
String get entityName;
@override
String get description;
@override
@JsonKey(name: 'user_name')
String get userName;
@JsonKey(name: 'user_id')
int? get userId;
@override
@JsonKey(name: 'created_at')
DateTime get createdAt;
@JsonKey(name: 'user_name')
String? get userName;
@override
DateTime get timestamp;
@override
Map<String, dynamic>? get metadata;