사용하지 않는 파일 정리 전 백업 (Phase 10 완료 후 상태)
This commit is contained in:
@@ -56,14 +56,12 @@ class CompanyService {
|
||||
// 회사 생성
|
||||
Future<Company> createCompany(Company company) async {
|
||||
try {
|
||||
final request = CreateCompanyRequest(
|
||||
final request = CompanyRequestDto(
|
||||
name: company.name,
|
||||
address: company.address.toString(),
|
||||
contactName: company.contactName ?? '',
|
||||
contactPosition: company.contactPosition ?? '',
|
||||
contactPhone: company.contactPhone ?? '',
|
||||
contactEmail: company.contactEmail ?? '',
|
||||
companyTypes: company.companyTypes.map((e) => e.toString().split('.').last).toList(),
|
||||
isPartner: company.isPartner,
|
||||
isCustomer: company.isCustomer,
|
||||
parentCompanyId: company.parentCompanyId,
|
||||
@@ -114,14 +112,12 @@ class CompanyService {
|
||||
// 회사 수정
|
||||
Future<Company> updateCompany(int id, Company company) async {
|
||||
try {
|
||||
final request = UpdateCompanyRequest(
|
||||
final request = CompanyUpdateRequestDto(
|
||||
name: company.name,
|
||||
address: company.address.toString(),
|
||||
contactName: company.contactName,
|
||||
contactPosition: company.contactPosition,
|
||||
contactPhone: company.contactPhone,
|
||||
contactEmail: company.contactEmail,
|
||||
companyTypes: company.companyTypes.map((e) => e.toString().split('.').last).toList(),
|
||||
isPartner: company.isPartner,
|
||||
isCustomer: company.isCustomer,
|
||||
parentCompanyId: company.parentCompanyId,
|
||||
@@ -377,30 +373,18 @@ class CompanyService {
|
||||
isPartner: dto.isPartner,
|
||||
isCustomer: dto.isCustomer,
|
||||
parentCompanyId: dto.parentCompanyId,
|
||||
createdAt: dto.createdAt,
|
||||
createdAt: dto.registeredAt, // CompanyListDto.registeredAt → createdAt
|
||||
updatedAt: null, // CompanyListDto에는 updatedAt이 없음
|
||||
branches: [], // branches는 빈 배열로 초기화
|
||||
);
|
||||
}
|
||||
|
||||
Company _convertResponseToCompany(CompanyResponse dto) {
|
||||
Company _convertResponseToCompany(CompanyDto dto) {
|
||||
List<CompanyType> companyTypes = [];
|
||||
|
||||
// 1. company_types 필드가 있으면 우선 사용 (하위 호환성)
|
||||
if (dto.companyTypes.isNotEmpty) {
|
||||
companyTypes = dto.companyTypes.map((typeStr) {
|
||||
final normalized = typeStr.toLowerCase();
|
||||
if (normalized.contains('partner')) return CompanyType.partner;
|
||||
if (normalized.contains('customer')) return CompanyType.customer;
|
||||
if (normalized == 'other') return CompanyType.customer; // "Other"는 고객사로 매핑
|
||||
return CompanyType.customer; // 기본값
|
||||
}).toSet().toList(); // 중복 제거
|
||||
}
|
||||
// 2. company_types가 없으면 is_partner, is_customer 사용
|
||||
else {
|
||||
if (dto.isCustomer) companyTypes.add(CompanyType.customer);
|
||||
if (dto.isPartner) companyTypes.add(CompanyType.partner);
|
||||
}
|
||||
// CompanyDto에는 companyTypes 필드가 없으므로 is_partner, is_customer 사용
|
||||
if (dto.isCustomer) companyTypes.add(CompanyType.customer);
|
||||
if (dto.isPartner) companyTypes.add(CompanyType.partner);
|
||||
|
||||
// 3. 둘 다 없으면 빈 리스트 유지
|
||||
|
||||
@@ -409,7 +393,7 @@ class CompanyService {
|
||||
name: dto.name,
|
||||
address: dto.address != null ? Address.fromFullAddress(dto.address!) : const Address(),
|
||||
contactName: dto.contactName,
|
||||
contactPosition: dto.contactPosition,
|
||||
contactPosition: null, // CompanyDto에 contactPosition 필드 없음
|
||||
contactPhone: dto.contactPhone,
|
||||
contactEmail: dto.contactEmail,
|
||||
companyTypes: companyTypes,
|
||||
@@ -418,7 +402,7 @@ class CompanyService {
|
||||
isPartner: dto.isPartner,
|
||||
isCustomer: dto.isCustomer,
|
||||
parentCompanyId: dto.parentCompanyId,
|
||||
createdAt: dto.createdAt,
|
||||
createdAt: dto.registeredAt, // createdAt → registeredAt
|
||||
updatedAt: dto.updatedAt,
|
||||
branches: [], // branches는 빈 배열로 초기화
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user