Files
superport/lib/data/models/company/company_dto.dart
JiWoong Sul df7dd8dacb
Some checks failed
Flutter Test & Quality Check / Test on macos-latest (push) Has been cancelled
Flutter Test & Quality Check / Test on ubuntu-latest (push) Has been cancelled
Flutter Test & Quality Check / Build APK (push) Has been cancelled
feat: 대규모 코드베이스 개선 - 백엔드 통합성 강화 및 UI 일관성 완성
- CLAUDE.md 대폭 개선: 개발 가이드라인 및 프로젝트 상태 문서화
- 백엔드 API 통합: 모든 엔티티 간 Foreign Key 관계 완벽 구현
- UI 일관성 강화: shadcn_ui 컴포넌트 표준화 적용
- 데이터 모델 개선: DTO 및 모델 클래스 백엔드 스키마와 100% 일치
- 사용자 관리: 회사 연결, 중복 검사, 입력 검증 기능 추가
- 창고 관리: 우편번호 연결, 중복 검사 기능 강화
- 회사 관리: 우편번호 연결, 중복 검사 로직 구현
- 장비 관리: 불필요한 카테고리 필드 제거, 벤더-모델 관계 정리
- 우편번호 시스템: 검색 다이얼로그 Provider 버그 수정

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-31 15:49:05 +09:00

99 lines
3.7 KiB
Dart

import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:superport/data/models/zipcode_dto.dart';
part 'company_dto.freezed.dart';
part 'company_dto.g.dart';
@freezed
class CompanyDto with _$CompanyDto {
const CompanyDto._(); // Private constructor for getters
const factory CompanyDto({
int? id,
required String name,
@JsonKey(name: 'contact_name') required String contactName,
@JsonKey(name: 'contact_phone') required String contactPhone,
@JsonKey(name: 'contact_email') required String contactEmail,
@JsonKey(name: 'parent_company_id') int? parentCompanyId,
@JsonKey(name: 'zipcodes_zipcode') String? zipcodesZipcode,
required String address,
String? remark,
@JsonKey(name: 'is_partner') @Default(false) bool isPartner,
@JsonKey(name: 'is_customer') @Default(false) bool isCustomer,
@JsonKey(name: 'is_active') @Default(false) bool isActive,
@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: 'parent_company') CompanyNameDto? parentCompany,
@JsonKey(name: 'zipcode') ZipcodeDto? zipcode,
}) = _CompanyDto;
factory CompanyDto.fromJson(Map<String, dynamic> json) => _$CompanyDtoFromJson(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);
}
@freezed
class CompanyRequestDto with _$CompanyRequestDto {
const factory CompanyRequestDto({
required String name,
@JsonKey(name: 'contact_name') required String contactName,
@JsonKey(name: 'contact_phone') required String contactPhone,
@JsonKey(name: 'contact_email') required String contactEmail,
@JsonKey(name: 'parent_company_id') int? parentCompanyId,
@JsonKey(name: 'zipcodes_zipcode') String? zipcodesZipcode,
required String address,
String? remark,
@JsonKey(name: 'is_partner') @Default(false) bool isPartner,
@JsonKey(name: 'is_customer') @Default(false) bool isCustomer,
@JsonKey(name: 'is_active') @Default(false) bool isActive,
}) = _CompanyRequestDto;
factory CompanyRequestDto.fromJson(Map<String, dynamic> json) =>
_$CompanyRequestDtoFromJson(json);
}
@freezed
class CompanyUpdateRequestDto with _$CompanyUpdateRequestDto {
const factory CompanyUpdateRequestDto({
String? name,
@JsonKey(name: 'contact_name') String? contactName,
@JsonKey(name: 'contact_phone') String? contactPhone,
@JsonKey(name: 'contact_email') String? contactEmail,
@JsonKey(name: 'parent_company_id') int? parentCompanyId,
@JsonKey(name: 'zipcodes_zipcode') String? zipcodesZipcode,
String? address,
String? remark,
@JsonKey(name: 'is_partner') bool? isPartner,
@JsonKey(name: 'is_customer') bool? isCustomer,
@JsonKey(name: 'is_active') bool? isActive,
}) = _CompanyUpdateRequestDto;
factory CompanyUpdateRequestDto.fromJson(Map<String, dynamic> json) =>
_$CompanyUpdateRequestDtoFromJson(json);
}
@freezed
class CompanyListResponse with _$CompanyListResponse {
const factory CompanyListResponse({
@JsonKey(name: 'data') required List<CompanyDto> 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,
}) = _CompanyListResponse;
factory CompanyListResponse.fromJson(Map<String, dynamic> json) =>
_$CompanyListResponseFromJson(json);
}