주요 변경사항: - 창고 관리 API 응답 구조와 DTO 불일치 수정 - WarehouseLocationDto에 code, manager_phone 필드 추가 - RemoteDataSource에서 API 응답을 DTO 구조에 맞게 변환 - 회사 관리 API 응답 파싱 오류 수정 - CompanyResponse의 필수 필드를 nullable로 변경 - PaginatedResponse 구조 매핑 로직 개선 - 에러 처리 및 로깅 개선 - Service Layer에 상세 에러 로깅 추가 - Controller에서 에러 타입별 처리 - 새로운 유틸리티 추가 - ResponseInterceptor: API 응답 정규화 - DebugLogger: 디버깅 도구 - HealthCheckService: 서버 상태 확인 - 문서화 - API 통합 테스트 가이드 - 에러 분석 보고서 - 리팩토링 계획서
134 lines
4.7 KiB
Dart
134 lines
4.7 KiB
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'warehouse_dto.freezed.dart';
|
|
part 'warehouse_dto.g.dart';
|
|
|
|
/// 창고 위치 생성 요청 DTO
|
|
@freezed
|
|
class CreateWarehouseLocationRequest with _$CreateWarehouseLocationRequest {
|
|
const factory CreateWarehouseLocationRequest({
|
|
required String name,
|
|
String? address,
|
|
String? city,
|
|
String? state,
|
|
@JsonKey(name: 'postal_code') String? postalCode,
|
|
String? country,
|
|
int? capacity,
|
|
@JsonKey(name: 'manager_id') int? managerId,
|
|
}) = _CreateWarehouseLocationRequest;
|
|
|
|
factory CreateWarehouseLocationRequest.fromJson(Map<String, dynamic> json) =>
|
|
_$CreateWarehouseLocationRequestFromJson(json);
|
|
}
|
|
|
|
/// 창고 위치 수정 요청 DTO
|
|
@freezed
|
|
class UpdateWarehouseLocationRequest with _$UpdateWarehouseLocationRequest {
|
|
const factory UpdateWarehouseLocationRequest({
|
|
String? name,
|
|
String? address,
|
|
String? city,
|
|
String? state,
|
|
@JsonKey(name: 'postal_code') String? postalCode,
|
|
String? country,
|
|
int? capacity,
|
|
@JsonKey(name: 'manager_id') int? managerId,
|
|
@JsonKey(name: 'is_active') bool? isActive,
|
|
}) = _UpdateWarehouseLocationRequest;
|
|
|
|
factory UpdateWarehouseLocationRequest.fromJson(Map<String, dynamic> json) =>
|
|
_$UpdateWarehouseLocationRequestFromJson(json);
|
|
}
|
|
|
|
/// 창고 위치 응답 DTO
|
|
@freezed
|
|
class WarehouseLocationDto with _$WarehouseLocationDto {
|
|
const factory WarehouseLocationDto({
|
|
required int id,
|
|
required String name,
|
|
String? code,
|
|
@JsonKey(name: 'manager_name') String? managerName,
|
|
@JsonKey(name: 'manager_phone') String? managerPhone,
|
|
int? capacity,
|
|
@JsonKey(name: 'is_active') required bool isActive,
|
|
@JsonKey(name: 'created_at') required DateTime createdAt,
|
|
// API에 없는 필드들은 nullable로 변경
|
|
String? address,
|
|
String? city,
|
|
String? state,
|
|
@JsonKey(name: 'postal_code') String? postalCode,
|
|
String? country,
|
|
@JsonKey(name: 'manager_id') int? managerId,
|
|
@JsonKey(name: 'updated_at') DateTime? updatedAt,
|
|
@JsonKey(name: 'current_stock') int? currentStock,
|
|
@JsonKey(name: 'available_capacity') int? availableCapacity,
|
|
}) = _WarehouseLocationDto;
|
|
|
|
factory WarehouseLocationDto.fromJson(Map<String, dynamic> json) =>
|
|
_$WarehouseLocationDtoFromJson(json);
|
|
}
|
|
|
|
/// 창고 위치 목록 응답 DTO
|
|
@freezed
|
|
class WarehouseLocationListDto with _$WarehouseLocationListDto {
|
|
const factory WarehouseLocationListDto({
|
|
required List<WarehouseLocationDto> items,
|
|
required int total,
|
|
required int page,
|
|
@JsonKey(name: 'per_page') required int perPage,
|
|
@JsonKey(name: 'total_pages') required int totalPages,
|
|
}) = _WarehouseLocationListDto;
|
|
|
|
factory WarehouseLocationListDto.fromJson(Map<String, dynamic> json) =>
|
|
_$WarehouseLocationListDtoFromJson(json);
|
|
}
|
|
|
|
/// 창고 용량 정보 DTO
|
|
@freezed
|
|
class WarehouseCapacityInfo with _$WarehouseCapacityInfo {
|
|
const factory WarehouseCapacityInfo({
|
|
@JsonKey(name: 'warehouse_id') required int warehouseId,
|
|
@JsonKey(name: 'total_capacity') required int totalCapacity,
|
|
@JsonKey(name: 'used_capacity') required int usedCapacity,
|
|
@JsonKey(name: 'available_capacity') required int availableCapacity,
|
|
@JsonKey(name: 'usage_percentage') required double usagePercentage,
|
|
@JsonKey(name: 'equipment_count') required int equipmentCount,
|
|
}) = _WarehouseCapacityInfo;
|
|
|
|
factory WarehouseCapacityInfo.fromJson(Map<String, dynamic> json) =>
|
|
_$WarehouseCapacityInfoFromJson(json);
|
|
}
|
|
|
|
/// 창고별 장비 목록 DTO
|
|
@freezed
|
|
class WarehouseEquipmentDto with _$WarehouseEquipmentDto {
|
|
const factory WarehouseEquipmentDto({
|
|
required int id,
|
|
@JsonKey(name: 'equipment_number') required String equipmentNumber,
|
|
String? manufacturer,
|
|
@JsonKey(name: 'equipment_name') String? equipmentName,
|
|
@JsonKey(name: 'serial_number') String? serialNumber,
|
|
required int quantity,
|
|
String? status,
|
|
@JsonKey(name: 'warehouse_location_id') required int warehouseLocationId,
|
|
@JsonKey(name: 'stored_at') required DateTime storedAt,
|
|
}) = _WarehouseEquipmentDto;
|
|
|
|
factory WarehouseEquipmentDto.fromJson(Map<String, dynamic> json) =>
|
|
_$WarehouseEquipmentDtoFromJson(json);
|
|
}
|
|
|
|
/// 창고별 장비 목록 응답 DTO
|
|
@freezed
|
|
class WarehouseEquipmentListDto with _$WarehouseEquipmentListDto {
|
|
const factory WarehouseEquipmentListDto({
|
|
required List<WarehouseEquipmentDto> items,
|
|
required int total,
|
|
required int page,
|
|
@JsonKey(name: 'per_page') required int perPage,
|
|
@JsonKey(name: 'total_pages') required int totalPages,
|
|
}) = _WarehouseEquipmentListDto;
|
|
|
|
factory WarehouseEquipmentListDto.fromJson(Map<String, dynamic> json) =>
|
|
_$WarehouseEquipmentListDtoFromJson(json);
|
|
} |