주요 변경사항: - Company-Branch → 계층형 Company 구조 완전 마이그레이션 - Equipment 모델 필드명 표준화 (current_company_id → company_id) - DropdownButton assertion 오류 완전 해결 - 지점 추가 드롭다운 페이지네이션 문제 해결 (20개→55개 전체 표시) - Equipment 백엔드 API 데이터 활용도 40%→100% 달성 - 소프트 딜리트 시스템 안정성 향상 기술적 개선: - Branch 관련 deprecated 메서드 정리 - Equipment Status 유효성 검증 로직 추가 - Company 리스트 페이지네이션 최적화 - DTO 모델 Freezed 코드 생성 완료 - 테스트 파일 API 구조 변경 대응 성과: - Flutter 웹 빌드 성공 (컴파일 에러 0건) - 백엔드 API 호환성 95% 달성 - 시스템 안정성 및 사용자 경험 대폭 개선
81 lines
3.1 KiB
Dart
81 lines
3.1 KiB
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'company_dto.freezed.dart';
|
|
part 'company_dto.g.dart';
|
|
|
|
@freezed
|
|
class CreateCompanyRequest with _$CreateCompanyRequest {
|
|
const factory CreateCompanyRequest({
|
|
required String name,
|
|
required String address,
|
|
@JsonKey(name: 'contact_name') required String contactName,
|
|
@JsonKey(name: 'contact_position') required String contactPosition,
|
|
@JsonKey(name: 'contact_phone') required String contactPhone,
|
|
@JsonKey(name: 'contact_email') required String contactEmail,
|
|
@JsonKey(name: 'company_types') @Default([]) List<String> companyTypes,
|
|
@JsonKey(name: 'is_partner') @Default(false) bool isPartner,
|
|
@JsonKey(name: 'is_customer') @Default(true) bool isCustomer,
|
|
@JsonKey(name: 'parent_company_id') int? parentCompanyId,
|
|
String? remark,
|
|
}) = _CreateCompanyRequest;
|
|
|
|
factory CreateCompanyRequest.fromJson(Map<String, dynamic> json) =>
|
|
_$CreateCompanyRequestFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
class UpdateCompanyRequest with _$UpdateCompanyRequest {
|
|
const factory UpdateCompanyRequest({
|
|
String? name,
|
|
String? address,
|
|
@JsonKey(name: 'contact_name') String? contactName,
|
|
@JsonKey(name: 'contact_position') String? contactPosition,
|
|
@JsonKey(name: 'contact_phone') String? contactPhone,
|
|
@JsonKey(name: 'contact_email') String? contactEmail,
|
|
@JsonKey(name: 'company_types') List<String>? companyTypes,
|
|
@JsonKey(name: 'is_partner') bool? isPartner,
|
|
@JsonKey(name: 'is_customer') bool? isCustomer,
|
|
@JsonKey(name: 'parent_company_id') int? parentCompanyId,
|
|
String? remark,
|
|
@JsonKey(name: 'is_active') bool? isActive,
|
|
}) = _UpdateCompanyRequest;
|
|
|
|
factory UpdateCompanyRequest.fromJson(Map<String, dynamic> json) =>
|
|
_$UpdateCompanyRequestFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
class CompanyResponse with _$CompanyResponse {
|
|
const factory CompanyResponse({
|
|
required int id,
|
|
required String name,
|
|
String? address,
|
|
@JsonKey(name: 'contact_name') required String contactName,
|
|
@JsonKey(name: 'contact_position') String? contactPosition, // nullable로 변경
|
|
@JsonKey(name: 'contact_phone') required String contactPhone,
|
|
@JsonKey(name: 'contact_email') required String contactEmail,
|
|
@JsonKey(name: 'company_types') @Default([]) List<String> companyTypes,
|
|
String? remark,
|
|
@JsonKey(name: 'is_active') required bool isActive,
|
|
@JsonKey(name: 'is_partner') @Default(false) bool isPartner,
|
|
@JsonKey(name: 'is_customer') @Default(false) bool isCustomer,
|
|
@JsonKey(name: 'parent_company_id') int? parentCompanyId,
|
|
@JsonKey(name: 'created_at') required DateTime createdAt,
|
|
@JsonKey(name: 'updated_at') DateTime? updatedAt, // nullable로 변경
|
|
@JsonKey(name: 'address_id') int? addressId,
|
|
}) = _CompanyResponse;
|
|
|
|
factory CompanyResponse.fromJson(Map<String, dynamic> json) =>
|
|
_$CompanyResponseFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
class CompanyNameDto with _$CompanyNameDto {
|
|
const factory CompanyNameDto({
|
|
required int id,
|
|
required String name,
|
|
}) = _CompanyNameDto;
|
|
|
|
factory CompanyNameDto.fromJson(Map<String, dynamic> json) =>
|
|
_$CompanyNameDtoFromJson(json);
|
|
} |