- 모든 서비스 메서드 시그니처를 실제 구현에 맞게 수정 - TestDataGenerator 제거하고 직접 객체 생성으로 변경 - 모델 필드명 및 타입 불일치 수정 - 불필요한 Either 패턴 사용 제거 - null safety 관련 이슈 해결 수정된 파일: - test/integration/screens/company_integration_test.dart - test/integration/screens/equipment_integration_test.dart - test/integration/screens/user_integration_test.dart - test/integration/screens/login_integration_test.dart
135 lines
4.7 KiB
Dart
135 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,
|
|
@JsonKey(name: 'company_id') int? companyId,
|
|
}) = _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);
|
|
} |