사용하지 않는 파일 정리 전 백업 (Phase 10 완료 후 상태)
This commit is contained in:
@@ -1,66 +1,78 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:superport/data/models/zipcode_dto.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,
|
||||
@JsonKey(name: 'manager_name') String? managerName,
|
||||
@JsonKey(name: 'manager_phone') String? managerPhone,
|
||||
int? capacity,
|
||||
String? remark,
|
||||
}) = _CreateWarehouseLocationRequest;
|
||||
class WarehouseDto with _$WarehouseDto {
|
||||
const WarehouseDto._(); // Private constructor for getters
|
||||
|
||||
factory CreateWarehouseLocationRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$CreateWarehouseLocationRequestFromJson(json);
|
||||
const factory WarehouseDto({
|
||||
@JsonKey(name: 'id') int? id,
|
||||
@JsonKey(name: 'name') required String name,
|
||||
@JsonKey(name: 'zipcodes_zipcode') String? zipcodesZipcode,
|
||||
@JsonKey(name: 'zipcode_address') String? zipcodeAddress,
|
||||
@JsonKey(name: 'remark') String? remark,
|
||||
@JsonKey(name: 'is_deleted') @Default(false) bool isDeleted,
|
||||
@JsonKey(name: 'registered_at') DateTime? registeredAt,
|
||||
@JsonKey(name: 'updated_at') DateTime? updatedAt,
|
||||
|
||||
// Nested data (optional, populated in GET requests)
|
||||
@JsonKey(name: 'zipcode') ZipcodeDto? zipcode,
|
||||
}) = _WarehouseDto;
|
||||
|
||||
// isActive 계산 속성 (is_deleted의 반대)
|
||||
bool get isActive => !isDeleted;
|
||||
|
||||
factory WarehouseDto.fromJson(Map<String, dynamic> json) => _$WarehouseDtoFromJson(json);
|
||||
}
|
||||
|
||||
/// 창고 위치 수정 요청 DTO
|
||||
@freezed
|
||||
class UpdateWarehouseLocationRequest with _$UpdateWarehouseLocationRequest {
|
||||
const factory UpdateWarehouseLocationRequest({
|
||||
String? name,
|
||||
String? address,
|
||||
@JsonKey(name: 'manager_name') String? managerName,
|
||||
@JsonKey(name: 'manager_phone') String? managerPhone,
|
||||
int? capacity,
|
||||
String? remark,
|
||||
}) = _UpdateWarehouseLocationRequest;
|
||||
class WarehouseRequestDto with _$WarehouseRequestDto {
|
||||
const factory WarehouseRequestDto({
|
||||
@JsonKey(name: 'Name') required String name,
|
||||
@JsonKey(name: 'zipcodes_zipcode') String? zipcodesZipcode,
|
||||
@JsonKey(name: 'Remark') String? remark,
|
||||
}) = _WarehouseRequestDto;
|
||||
|
||||
factory UpdateWarehouseLocationRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$UpdateWarehouseLocationRequestFromJson(json);
|
||||
factory WarehouseRequestDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$WarehouseRequestDtoFromJson(json);
|
||||
}
|
||||
|
||||
/// 창고 위치 응답 DTO
|
||||
@freezed
|
||||
class WarehouseLocationDto with _$WarehouseLocationDto {
|
||||
const factory WarehouseLocationDto({
|
||||
required int id,
|
||||
required String name,
|
||||
String? address,
|
||||
@JsonKey(name: 'manager_name') String? managerName,
|
||||
@JsonKey(name: 'manager_phone') String? managerPhone,
|
||||
int? capacity,
|
||||
String? remark,
|
||||
@JsonKey(name: 'is_active') required bool isActive,
|
||||
@JsonKey(name: 'created_at') required DateTime createdAt,
|
||||
}) = _WarehouseLocationDto;
|
||||
class WarehouseUpdateRequestDto with _$WarehouseUpdateRequestDto {
|
||||
const factory WarehouseUpdateRequestDto({
|
||||
@JsonKey(name: 'Name') String? name,
|
||||
@JsonKey(name: 'zipcodes_zipcode') String? zipcodesZipcode,
|
||||
@JsonKey(name: 'Remark') String? remark,
|
||||
}) = _WarehouseUpdateRequestDto;
|
||||
|
||||
factory WarehouseLocationDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$WarehouseLocationDtoFromJson(json);
|
||||
factory WarehouseUpdateRequestDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$WarehouseUpdateRequestDtoFromJson(json);
|
||||
}
|
||||
|
||||
/// 창고 위치 목록 응답 DTO
|
||||
@freezed
|
||||
class WarehouseListResponse with _$WarehouseListResponse {
|
||||
const factory WarehouseListResponse({
|
||||
@JsonKey(name: 'data') required List<WarehouseDto> items,
|
||||
@JsonKey(name: 'total') required int totalCount,
|
||||
@JsonKey(name: 'page') required int currentPage,
|
||||
@JsonKey(name: 'total_pages') required int totalPages,
|
||||
@JsonKey(name: 'page_size') int? pageSize,
|
||||
}) = _WarehouseListResponse;
|
||||
|
||||
factory WarehouseListResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$WarehouseListResponseFromJson(json);
|
||||
}
|
||||
|
||||
// Legacy support classes
|
||||
@freezed
|
||||
class WarehouseLocationListDto with _$WarehouseLocationListDto {
|
||||
const factory WarehouseLocationListDto({
|
||||
required List<WarehouseLocationDto> items,
|
||||
required int total,
|
||||
required int page,
|
||||
@JsonKey(name: 'items') required List<WarehouseDto> items,
|
||||
@JsonKey(name: 'total') required int total,
|
||||
@JsonKey(name: 'page') required int page,
|
||||
@JsonKey(name: 'per_page') required int perPage,
|
||||
@JsonKey(name: 'total_pages') required int totalPages,
|
||||
}) = _WarehouseLocationListDto;
|
||||
@@ -69,52 +81,39 @@ class WarehouseLocationListDto with _$WarehouseLocationListDto {
|
||||
_$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,
|
||||
@JsonKey(name: 'total_capacity') int? totalCapacity,
|
||||
@JsonKey(name: 'used_capacity') int? usedCapacity,
|
||||
@JsonKey(name: 'available_capacity') int? availableCapacity,
|
||||
}) = _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,
|
||||
@JsonKey(name: 'items') required List<WarehouseEquipmentDto> items,
|
||||
@JsonKey(name: 'total') required int total,
|
||||
}) = _WarehouseEquipmentListDto;
|
||||
|
||||
factory WarehouseEquipmentListDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$WarehouseEquipmentListDtoFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class WarehouseEquipmentDto with _$WarehouseEquipmentDto {
|
||||
const factory WarehouseEquipmentDto({
|
||||
int? id,
|
||||
@JsonKey(name: 'equipment_id') int? equipmentId,
|
||||
@JsonKey(name: 'warehouse_id') int? warehouseId,
|
||||
String? name,
|
||||
int? quantity,
|
||||
}) = _WarehouseEquipmentDto;
|
||||
|
||||
factory WarehouseEquipmentDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$WarehouseEquipmentDtoFromJson(json);
|
||||
}
|
||||
Reference in New Issue
Block a user