- EquipmentHistoryDto 모델 확장 (상세 정보 추가) - 장비 이력 화면 UI/UX 개선 - 장비 입고 폼 검증 로직 강화 - 테스트 이력 화면 추가 - API 응답 처리 개선 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
49 lines
1.7 KiB
Dart
49 lines
1.7 KiB
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'equipment_history_dto.freezed.dart';
|
|
part 'equipment_history_dto.g.dart';
|
|
|
|
@freezed
|
|
class EquipmentHistoryDto with _$EquipmentHistoryDto {
|
|
const factory EquipmentHistoryDto({
|
|
required int id,
|
|
@JsonKey(name: 'equipment_id') required int equipmentId,
|
|
@JsonKey(name: 'transaction_type') required String transactionType,
|
|
required int quantity,
|
|
@JsonKey(name: 'transaction_date') required DateTime transactionDate,
|
|
String? remarks,
|
|
@JsonKey(name: 'created_by') int? createdBy,
|
|
@JsonKey(name: 'user_id') int? userId,
|
|
@JsonKey(name: 'created_at') required DateTime createdAt,
|
|
// 추가 정보
|
|
@JsonKey(name: 'user_name') String? userName,
|
|
@JsonKey(name: 'performed_by') String? performedBy,
|
|
}) = _EquipmentHistoryDto;
|
|
|
|
factory EquipmentHistoryDto.fromJson(Map<String, dynamic> json) =>
|
|
_$EquipmentHistoryDtoFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
class CreateHistoryRequest with _$CreateHistoryRequest {
|
|
const factory CreateHistoryRequest({
|
|
@JsonKey(name: 'transaction_type') required String transactionType,
|
|
required int quantity,
|
|
@JsonKey(name: 'transaction_date') DateTime? transactionDate,
|
|
String? remarks,
|
|
@JsonKey(name: 'user_id') int? userId,
|
|
}) = _CreateHistoryRequest;
|
|
|
|
factory CreateHistoryRequest.fromJson(Map<String, dynamic> json) =>
|
|
_$CreateHistoryRequestFromJson(json);
|
|
}
|
|
|
|
// 트랜잭션 타입 상수
|
|
class TransactionType {
|
|
static const String checkIn = 'I'; // 입고
|
|
static const String checkOut = 'O'; // 출고
|
|
static const String maintenance = 'maintenance';
|
|
static const String repair = 'repair';
|
|
static const String inspection = 'inspection';
|
|
static const String transfer = 'transfer';
|
|
} |