feat: 백엔드 API 구조 변경 대응 및 시스템 안정성 대폭 향상
Some checks failed
Flutter Test & Quality Check / Build APK (push) Has been cancelled
Flutter Test & Quality Check / Test on macos-latest (push) Has been cancelled
Flutter Test & Quality Check / Test on ubuntu-latest (push) Has been cancelled

주요 변경사항:
- 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% 달성
- 시스템 안정성 및 사용자 경험 대폭 개선
This commit is contained in:
JiWoong Sul
2025-08-20 19:09:03 +09:00
parent 6d745051b5
commit ca830063f0
52 changed files with 2772 additions and 1670 deletions

View File

@@ -15,6 +15,7 @@ class CreateCompanyRequest with _$CreateCompanyRequest {
@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;
@@ -34,6 +35,7 @@ class UpdateCompanyRequest with _$UpdateCompanyRequest {
@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;
@@ -57,6 +59,7 @@ class CompanyResponse with _$CompanyResponse {
@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,

View File

@@ -36,6 +36,8 @@ mixin _$CreateCompanyRequest {
bool get isPartner => throw _privateConstructorUsedError;
@JsonKey(name: 'is_customer')
bool get isCustomer => throw _privateConstructorUsedError;
@JsonKey(name: 'parent_company_id')
int? get parentCompanyId => throw _privateConstructorUsedError;
String? get remark => throw _privateConstructorUsedError;
/// Serializes this CreateCompanyRequest to a JSON map.
@@ -64,6 +66,7 @@ abstract class $CreateCompanyRequestCopyWith<$Res> {
@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});
}
@@ -92,6 +95,7 @@ class _$CreateCompanyRequestCopyWithImpl<$Res,
Object? companyTypes = null,
Object? isPartner = null,
Object? isCustomer = null,
Object? parentCompanyId = freezed,
Object? remark = freezed,
}) {
return _then(_value.copyWith(
@@ -131,6 +135,10 @@ class _$CreateCompanyRequestCopyWithImpl<$Res,
? _value.isCustomer
: isCustomer // ignore: cast_nullable_to_non_nullable
as bool,
parentCompanyId: freezed == parentCompanyId
? _value.parentCompanyId
: parentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
remark: freezed == remark
? _value.remark
: remark // ignore: cast_nullable_to_non_nullable
@@ -157,6 +165,7 @@ abstract class _$$CreateCompanyRequestImplCopyWith<$Res>
@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});
}
@@ -182,6 +191,7 @@ class __$$CreateCompanyRequestImplCopyWithImpl<$Res>
Object? companyTypes = null,
Object? isPartner = null,
Object? isCustomer = null,
Object? parentCompanyId = freezed,
Object? remark = freezed,
}) {
return _then(_$CreateCompanyRequestImpl(
@@ -221,6 +231,10 @@ class __$$CreateCompanyRequestImplCopyWithImpl<$Res>
? _value.isCustomer
: isCustomer // ignore: cast_nullable_to_non_nullable
as bool,
parentCompanyId: freezed == parentCompanyId
? _value.parentCompanyId
: parentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
remark: freezed == remark
? _value.remark
: remark // ignore: cast_nullable_to_non_nullable
@@ -243,6 +257,7 @@ class _$CreateCompanyRequestImpl implements _CreateCompanyRequest {
final List<String> companyTypes = const [],
@JsonKey(name: 'is_partner') this.isPartner = false,
@JsonKey(name: 'is_customer') this.isCustomer = true,
@JsonKey(name: 'parent_company_id') this.parentCompanyId,
this.remark})
: _companyTypes = companyTypes;
@@ -281,11 +296,14 @@ class _$CreateCompanyRequestImpl implements _CreateCompanyRequest {
@JsonKey(name: 'is_customer')
final bool isCustomer;
@override
@JsonKey(name: 'parent_company_id')
final int? parentCompanyId;
@override
final String? remark;
@override
String toString() {
return 'CreateCompanyRequest(name: $name, address: $address, contactName: $contactName, contactPosition: $contactPosition, contactPhone: $contactPhone, contactEmail: $contactEmail, companyTypes: $companyTypes, isPartner: $isPartner, isCustomer: $isCustomer, remark: $remark)';
return 'CreateCompanyRequest(name: $name, address: $address, contactName: $contactName, contactPosition: $contactPosition, contactPhone: $contactPhone, contactEmail: $contactEmail, companyTypes: $companyTypes, isPartner: $isPartner, isCustomer: $isCustomer, parentCompanyId: $parentCompanyId, remark: $remark)';
}
@override
@@ -309,6 +327,8 @@ class _$CreateCompanyRequestImpl implements _CreateCompanyRequest {
other.isPartner == isPartner) &&
(identical(other.isCustomer, isCustomer) ||
other.isCustomer == isCustomer) &&
(identical(other.parentCompanyId, parentCompanyId) ||
other.parentCompanyId == parentCompanyId) &&
(identical(other.remark, remark) || other.remark == remark));
}
@@ -325,6 +345,7 @@ class _$CreateCompanyRequestImpl implements _CreateCompanyRequest {
const DeepCollectionEquality().hash(_companyTypes),
isPartner,
isCustomer,
parentCompanyId,
remark);
/// Create a copy of CreateCompanyRequest
@@ -356,6 +377,7 @@ abstract class _CreateCompanyRequest implements CreateCompanyRequest {
@JsonKey(name: 'company_types') final List<String> companyTypes,
@JsonKey(name: 'is_partner') final bool isPartner,
@JsonKey(name: 'is_customer') final bool isCustomer,
@JsonKey(name: 'parent_company_id') final int? parentCompanyId,
final String? remark}) = _$CreateCompanyRequestImpl;
factory _CreateCompanyRequest.fromJson(Map<String, dynamic> json) =
@@ -387,6 +409,9 @@ abstract class _CreateCompanyRequest implements CreateCompanyRequest {
@JsonKey(name: 'is_customer')
bool get isCustomer;
@override
@JsonKey(name: 'parent_company_id')
int? get parentCompanyId;
@override
String? get remark;
/// Create a copy of CreateCompanyRequest
@@ -419,6 +444,8 @@ mixin _$UpdateCompanyRequest {
bool? get isPartner => throw _privateConstructorUsedError;
@JsonKey(name: 'is_customer')
bool? get isCustomer => throw _privateConstructorUsedError;
@JsonKey(name: 'parent_company_id')
int? get parentCompanyId => throw _privateConstructorUsedError;
String? get remark => throw _privateConstructorUsedError;
@JsonKey(name: 'is_active')
bool? get isActive => throw _privateConstructorUsedError;
@@ -449,6 +476,7 @@ abstract class $UpdateCompanyRequestCopyWith<$Res> {
@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});
}
@@ -478,6 +506,7 @@ class _$UpdateCompanyRequestCopyWithImpl<$Res,
Object? companyTypes = freezed,
Object? isPartner = freezed,
Object? isCustomer = freezed,
Object? parentCompanyId = freezed,
Object? remark = freezed,
Object? isActive = freezed,
}) {
@@ -518,6 +547,10 @@ class _$UpdateCompanyRequestCopyWithImpl<$Res,
? _value.isCustomer
: isCustomer // ignore: cast_nullable_to_non_nullable
as bool?,
parentCompanyId: freezed == parentCompanyId
? _value.parentCompanyId
: parentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
remark: freezed == remark
? _value.remark
: remark // ignore: cast_nullable_to_non_nullable
@@ -548,6 +581,7 @@ abstract class _$$UpdateCompanyRequestImplCopyWith<$Res>
@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});
}
@@ -574,6 +608,7 @@ class __$$UpdateCompanyRequestImplCopyWithImpl<$Res>
Object? companyTypes = freezed,
Object? isPartner = freezed,
Object? isCustomer = freezed,
Object? parentCompanyId = freezed,
Object? remark = freezed,
Object? isActive = freezed,
}) {
@@ -614,6 +649,10 @@ class __$$UpdateCompanyRequestImplCopyWithImpl<$Res>
? _value.isCustomer
: isCustomer // ignore: cast_nullable_to_non_nullable
as bool?,
parentCompanyId: freezed == parentCompanyId
? _value.parentCompanyId
: parentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
remark: freezed == remark
? _value.remark
: remark // ignore: cast_nullable_to_non_nullable
@@ -639,6 +678,7 @@ class _$UpdateCompanyRequestImpl implements _UpdateCompanyRequest {
@JsonKey(name: 'company_types') final List<String>? companyTypes,
@JsonKey(name: 'is_partner') this.isPartner,
@JsonKey(name: 'is_customer') this.isCustomer,
@JsonKey(name: 'parent_company_id') this.parentCompanyId,
this.remark,
@JsonKey(name: 'is_active') this.isActive})
: _companyTypes = companyTypes;
@@ -680,6 +720,9 @@ class _$UpdateCompanyRequestImpl implements _UpdateCompanyRequest {
@JsonKey(name: 'is_customer')
final bool? isCustomer;
@override
@JsonKey(name: 'parent_company_id')
final int? parentCompanyId;
@override
final String? remark;
@override
@JsonKey(name: 'is_active')
@@ -687,7 +730,7 @@ class _$UpdateCompanyRequestImpl implements _UpdateCompanyRequest {
@override
String toString() {
return 'UpdateCompanyRequest(name: $name, address: $address, contactName: $contactName, contactPosition: $contactPosition, contactPhone: $contactPhone, contactEmail: $contactEmail, companyTypes: $companyTypes, isPartner: $isPartner, isCustomer: $isCustomer, remark: $remark, isActive: $isActive)';
return 'UpdateCompanyRequest(name: $name, address: $address, contactName: $contactName, contactPosition: $contactPosition, contactPhone: $contactPhone, contactEmail: $contactEmail, companyTypes: $companyTypes, isPartner: $isPartner, isCustomer: $isCustomer, parentCompanyId: $parentCompanyId, remark: $remark, isActive: $isActive)';
}
@override
@@ -711,6 +754,8 @@ class _$UpdateCompanyRequestImpl implements _UpdateCompanyRequest {
other.isPartner == isPartner) &&
(identical(other.isCustomer, isCustomer) ||
other.isCustomer == isCustomer) &&
(identical(other.parentCompanyId, parentCompanyId) ||
other.parentCompanyId == parentCompanyId) &&
(identical(other.remark, remark) || other.remark == remark) &&
(identical(other.isActive, isActive) ||
other.isActive == isActive));
@@ -729,6 +774,7 @@ class _$UpdateCompanyRequestImpl implements _UpdateCompanyRequest {
const DeepCollectionEquality().hash(_companyTypes),
isPartner,
isCustomer,
parentCompanyId,
remark,
isActive);
@@ -761,6 +807,7 @@ abstract class _UpdateCompanyRequest implements UpdateCompanyRequest {
@JsonKey(name: 'company_types') final List<String>? companyTypes,
@JsonKey(name: 'is_partner') final bool? isPartner,
@JsonKey(name: 'is_customer') final bool? isCustomer,
@JsonKey(name: 'parent_company_id') final int? parentCompanyId,
final String? remark,
@JsonKey(name: 'is_active') final bool? isActive}) =
_$UpdateCompanyRequestImpl;
@@ -794,6 +841,9 @@ abstract class _UpdateCompanyRequest implements UpdateCompanyRequest {
@JsonKey(name: 'is_customer')
bool? get isCustomer;
@override
@JsonKey(name: 'parent_company_id')
int? get parentCompanyId;
@override
String? get remark;
@override
@JsonKey(name: 'is_active')
@@ -834,6 +884,8 @@ mixin _$CompanyResponse {
bool get isPartner => throw _privateConstructorUsedError;
@JsonKey(name: 'is_customer')
bool get isCustomer => throw _privateConstructorUsedError;
@JsonKey(name: 'parent_company_id')
int? get parentCompanyId => throw _privateConstructorUsedError;
@JsonKey(name: 'created_at')
DateTime get createdAt => throw _privateConstructorUsedError;
@JsonKey(name: 'updated_at')
@@ -870,6 +922,7 @@ abstract class $CompanyResponseCopyWith<$Res> {
@JsonKey(name: 'is_active') bool isActive,
@JsonKey(name: 'is_partner') bool isPartner,
@JsonKey(name: 'is_customer') bool isCustomer,
@JsonKey(name: 'parent_company_id') int? parentCompanyId,
@JsonKey(name: 'created_at') DateTime createdAt,
@JsonKey(name: 'updated_at') DateTime? updatedAt,
@JsonKey(name: 'address_id') int? addressId});
@@ -902,6 +955,7 @@ class _$CompanyResponseCopyWithImpl<$Res, $Val extends CompanyResponse>
Object? isActive = null,
Object? isPartner = null,
Object? isCustomer = null,
Object? parentCompanyId = freezed,
Object? createdAt = null,
Object? updatedAt = freezed,
Object? addressId = freezed,
@@ -955,6 +1009,10 @@ class _$CompanyResponseCopyWithImpl<$Res, $Val extends CompanyResponse>
? _value.isCustomer
: isCustomer // ignore: cast_nullable_to_non_nullable
as bool,
parentCompanyId: freezed == parentCompanyId
? _value.parentCompanyId
: parentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
@@ -992,6 +1050,7 @@ abstract class _$$CompanyResponseImplCopyWith<$Res>
@JsonKey(name: 'is_active') bool isActive,
@JsonKey(name: 'is_partner') bool isPartner,
@JsonKey(name: 'is_customer') bool isCustomer,
@JsonKey(name: 'parent_company_id') int? parentCompanyId,
@JsonKey(name: 'created_at') DateTime createdAt,
@JsonKey(name: 'updated_at') DateTime? updatedAt,
@JsonKey(name: 'address_id') int? addressId});
@@ -1022,6 +1081,7 @@ class __$$CompanyResponseImplCopyWithImpl<$Res>
Object? isActive = null,
Object? isPartner = null,
Object? isCustomer = null,
Object? parentCompanyId = freezed,
Object? createdAt = null,
Object? updatedAt = freezed,
Object? addressId = freezed,
@@ -1075,6 +1135,10 @@ class __$$CompanyResponseImplCopyWithImpl<$Res>
? _value.isCustomer
: isCustomer // ignore: cast_nullable_to_non_nullable
as bool,
parentCompanyId: freezed == parentCompanyId
? _value.parentCompanyId
: parentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
@@ -1108,6 +1172,7 @@ class _$CompanyResponseImpl implements _CompanyResponse {
@JsonKey(name: 'is_active') required this.isActive,
@JsonKey(name: 'is_partner') this.isPartner = false,
@JsonKey(name: 'is_customer') this.isCustomer = false,
@JsonKey(name: 'parent_company_id') this.parentCompanyId,
@JsonKey(name: 'created_at') required this.createdAt,
@JsonKey(name: 'updated_at') this.updatedAt,
@JsonKey(name: 'address_id') this.addressId})
@@ -1156,6 +1221,9 @@ class _$CompanyResponseImpl implements _CompanyResponse {
@JsonKey(name: 'is_customer')
final bool isCustomer;
@override
@JsonKey(name: 'parent_company_id')
final int? parentCompanyId;
@override
@JsonKey(name: 'created_at')
final DateTime createdAt;
@override
@@ -1168,7 +1236,7 @@ class _$CompanyResponseImpl implements _CompanyResponse {
@override
String toString() {
return 'CompanyResponse(id: $id, name: $name, address: $address, contactName: $contactName, contactPosition: $contactPosition, contactPhone: $contactPhone, contactEmail: $contactEmail, companyTypes: $companyTypes, remark: $remark, isActive: $isActive, isPartner: $isPartner, isCustomer: $isCustomer, createdAt: $createdAt, updatedAt: $updatedAt, addressId: $addressId)';
return 'CompanyResponse(id: $id, name: $name, address: $address, contactName: $contactName, contactPosition: $contactPosition, contactPhone: $contactPhone, contactEmail: $contactEmail, companyTypes: $companyTypes, remark: $remark, isActive: $isActive, isPartner: $isPartner, isCustomer: $isCustomer, parentCompanyId: $parentCompanyId, createdAt: $createdAt, updatedAt: $updatedAt, addressId: $addressId)';
}
@override
@@ -1196,6 +1264,8 @@ class _$CompanyResponseImpl implements _CompanyResponse {
other.isPartner == isPartner) &&
(identical(other.isCustomer, isCustomer) ||
other.isCustomer == isCustomer) &&
(identical(other.parentCompanyId, parentCompanyId) ||
other.parentCompanyId == parentCompanyId) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.updatedAt, updatedAt) ||
@@ -1220,6 +1290,7 @@ class _$CompanyResponseImpl implements _CompanyResponse {
isActive,
isPartner,
isCustomer,
parentCompanyId,
createdAt,
updatedAt,
addressId);
@@ -1255,6 +1326,7 @@ abstract class _CompanyResponse implements CompanyResponse {
@JsonKey(name: 'is_active') required final bool isActive,
@JsonKey(name: 'is_partner') final bool isPartner,
@JsonKey(name: 'is_customer') final bool isCustomer,
@JsonKey(name: 'parent_company_id') final int? parentCompanyId,
@JsonKey(name: 'created_at') required final DateTime createdAt,
@JsonKey(name: 'updated_at') final DateTime? updatedAt,
@JsonKey(name: 'address_id') final int? addressId}) =
@@ -1296,6 +1368,9 @@ abstract class _CompanyResponse implements CompanyResponse {
@JsonKey(name: 'is_customer')
bool get isCustomer;
@override
@JsonKey(name: 'parent_company_id')
int? get parentCompanyId;
@override
@JsonKey(name: 'created_at')
DateTime get createdAt;
@override

View File

@@ -21,6 +21,7 @@ _$CreateCompanyRequestImpl _$$CreateCompanyRequestImplFromJson(
const [],
isPartner: json['is_partner'] as bool? ?? false,
isCustomer: json['is_customer'] as bool? ?? true,
parentCompanyId: (json['parent_company_id'] as num?)?.toInt(),
remark: json['remark'] as String?,
);
@@ -36,6 +37,7 @@ Map<String, dynamic> _$$CreateCompanyRequestImplToJson(
'company_types': instance.companyTypes,
'is_partner': instance.isPartner,
'is_customer': instance.isCustomer,
'parent_company_id': instance.parentCompanyId,
'remark': instance.remark,
};
@@ -53,6 +55,7 @@ _$UpdateCompanyRequestImpl _$$UpdateCompanyRequestImplFromJson(
.toList(),
isPartner: json['is_partner'] as bool?,
isCustomer: json['is_customer'] as bool?,
parentCompanyId: (json['parent_company_id'] as num?)?.toInt(),
remark: json['remark'] as String?,
isActive: json['is_active'] as bool?,
);
@@ -69,6 +72,7 @@ Map<String, dynamic> _$$UpdateCompanyRequestImplToJson(
'company_types': instance.companyTypes,
'is_partner': instance.isPartner,
'is_customer': instance.isCustomer,
'parent_company_id': instance.parentCompanyId,
'remark': instance.remark,
'is_active': instance.isActive,
};
@@ -91,6 +95,7 @@ _$CompanyResponseImpl _$$CompanyResponseImplFromJson(
isActive: json['is_active'] as bool,
isPartner: json['is_partner'] as bool? ?? false,
isCustomer: json['is_customer'] as bool? ?? false,
parentCompanyId: (json['parent_company_id'] as num?)?.toInt(),
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
@@ -113,6 +118,7 @@ Map<String, dynamic> _$$CompanyResponseImplToJson(
'is_active': instance.isActive,
'is_partner': instance.isPartner,
'is_customer': instance.isCustomer,
'parent_company_id': instance.parentCompanyId,
'created_at': instance.createdAt.toIso8601String(),
'updated_at': instance.updatedAt?.toIso8601String(),
'address_id': instance.addressId,

View File

@@ -1,6 +1,5 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'company_dto.dart';
import 'branch_dto.dart';
part 'company_list_dto.freezed.dart';
part 'company_list_dto.g.dart';
@@ -18,8 +17,9 @@ class CompanyListDto with _$CompanyListDto {
@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') DateTime? createdAt,
@JsonKey(name: 'branch_count') @Default(0) int branchCount,
@JsonKey(name: 'child_count') @Default(0) int childCount,
}) = _CompanyListDto;
factory CompanyListDto.fromJson(Map<String, dynamic> json) =>
@@ -27,12 +27,12 @@ class CompanyListDto with _$CompanyListDto {
}
@freezed
class CompanyWithBranches with _$CompanyWithBranches {
const factory CompanyWithBranches({
class CompanyWithChildren with _$CompanyWithChildren {
const factory CompanyWithChildren({
required CompanyResponse company,
@Default([]) List<BranchListDto> branches,
}) = _CompanyWithBranches;
@Default([]) List<CompanyResponse> children,
}) = _CompanyWithChildren;
factory CompanyWithBranches.fromJson(Map<String, dynamic> json) =>
_$CompanyWithBranchesFromJson(json);
factory CompanyWithChildren.fromJson(Map<String, dynamic> json) =>
_$CompanyWithChildrenFromJson(json);
}

View File

@@ -37,10 +37,12 @@ mixin _$CompanyListDto {
bool get isPartner => throw _privateConstructorUsedError;
@JsonKey(name: 'is_customer')
bool get isCustomer => throw _privateConstructorUsedError;
@JsonKey(name: 'parent_company_id')
int? get parentCompanyId => throw _privateConstructorUsedError;
@JsonKey(name: 'created_at')
DateTime? get createdAt => throw _privateConstructorUsedError;
@JsonKey(name: 'branch_count')
int get branchCount => throw _privateConstructorUsedError;
@JsonKey(name: 'child_count')
int get childCount => throw _privateConstructorUsedError;
/// Serializes this CompanyListDto to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -69,8 +71,9 @@ abstract class $CompanyListDtoCopyWith<$Res> {
@JsonKey(name: 'is_active') bool isActive,
@JsonKey(name: 'is_partner') bool isPartner,
@JsonKey(name: 'is_customer') bool isCustomer,
@JsonKey(name: 'parent_company_id') int? parentCompanyId,
@JsonKey(name: 'created_at') DateTime? createdAt,
@JsonKey(name: 'branch_count') int branchCount});
@JsonKey(name: 'child_count') int childCount});
}
/// @nodoc
@@ -98,8 +101,9 @@ class _$CompanyListDtoCopyWithImpl<$Res, $Val extends CompanyListDto>
Object? isActive = null,
Object? isPartner = null,
Object? isCustomer = null,
Object? parentCompanyId = freezed,
Object? createdAt = freezed,
Object? branchCount = null,
Object? childCount = null,
}) {
return _then(_value.copyWith(
id: null == id
@@ -142,13 +146,17 @@ class _$CompanyListDtoCopyWithImpl<$Res, $Val extends CompanyListDto>
? _value.isCustomer
: isCustomer // ignore: cast_nullable_to_non_nullable
as bool,
parentCompanyId: freezed == parentCompanyId
? _value.parentCompanyId
: parentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
createdAt: freezed == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime?,
branchCount: null == branchCount
? _value.branchCount
: branchCount // ignore: cast_nullable_to_non_nullable
childCount: null == childCount
? _value.childCount
: childCount // ignore: cast_nullable_to_non_nullable
as int,
) as $Val);
}
@@ -173,8 +181,9 @@ abstract class _$$CompanyListDtoImplCopyWith<$Res>
@JsonKey(name: 'is_active') bool isActive,
@JsonKey(name: 'is_partner') bool isPartner,
@JsonKey(name: 'is_customer') bool isCustomer,
@JsonKey(name: 'parent_company_id') int? parentCompanyId,
@JsonKey(name: 'created_at') DateTime? createdAt,
@JsonKey(name: 'branch_count') int branchCount});
@JsonKey(name: 'child_count') int childCount});
}
/// @nodoc
@@ -200,8 +209,9 @@ class __$$CompanyListDtoImplCopyWithImpl<$Res>
Object? isActive = null,
Object? isPartner = null,
Object? isCustomer = null,
Object? parentCompanyId = freezed,
Object? createdAt = freezed,
Object? branchCount = null,
Object? childCount = null,
}) {
return _then(_$CompanyListDtoImpl(
id: null == id
@@ -244,13 +254,17 @@ class __$$CompanyListDtoImplCopyWithImpl<$Res>
? _value.isCustomer
: isCustomer // ignore: cast_nullable_to_non_nullable
as bool,
parentCompanyId: freezed == parentCompanyId
? _value.parentCompanyId
: parentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
createdAt: freezed == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime?,
branchCount: null == branchCount
? _value.branchCount
: branchCount // ignore: cast_nullable_to_non_nullable
childCount: null == childCount
? _value.childCount
: childCount // ignore: cast_nullable_to_non_nullable
as int,
));
}
@@ -270,8 +284,9 @@ class _$CompanyListDtoImpl implements _CompanyListDto {
@JsonKey(name: 'is_active') required this.isActive,
@JsonKey(name: 'is_partner') this.isPartner = false,
@JsonKey(name: 'is_customer') this.isCustomer = false,
@JsonKey(name: 'parent_company_id') this.parentCompanyId,
@JsonKey(name: 'created_at') this.createdAt,
@JsonKey(name: 'branch_count') this.branchCount = 0})
@JsonKey(name: 'child_count') this.childCount = 0})
: _companyTypes = companyTypes;
factory _$CompanyListDtoImpl.fromJson(Map<String, dynamic> json) =>
@@ -313,15 +328,18 @@ class _$CompanyListDtoImpl implements _CompanyListDto {
@JsonKey(name: 'is_customer')
final bool isCustomer;
@override
@JsonKey(name: 'parent_company_id')
final int? parentCompanyId;
@override
@JsonKey(name: 'created_at')
final DateTime? createdAt;
@override
@JsonKey(name: 'branch_count')
final int branchCount;
@JsonKey(name: 'child_count')
final int childCount;
@override
String toString() {
return 'CompanyListDto(id: $id, name: $name, address: $address, contactName: $contactName, contactPhone: $contactPhone, contactEmail: $contactEmail, companyTypes: $companyTypes, isActive: $isActive, isPartner: $isPartner, isCustomer: $isCustomer, createdAt: $createdAt, branchCount: $branchCount)';
return 'CompanyListDto(id: $id, name: $name, address: $address, contactName: $contactName, contactPhone: $contactPhone, contactEmail: $contactEmail, companyTypes: $companyTypes, isActive: $isActive, isPartner: $isPartner, isCustomer: $isCustomer, parentCompanyId: $parentCompanyId, createdAt: $createdAt, childCount: $childCount)';
}
@override
@@ -346,10 +364,12 @@ class _$CompanyListDtoImpl implements _CompanyListDto {
other.isPartner == isPartner) &&
(identical(other.isCustomer, isCustomer) ||
other.isCustomer == isCustomer) &&
(identical(other.parentCompanyId, parentCompanyId) ||
other.parentCompanyId == parentCompanyId) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.branchCount, branchCount) ||
other.branchCount == branchCount));
(identical(other.childCount, childCount) ||
other.childCount == childCount));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -366,8 +386,9 @@ class _$CompanyListDtoImpl implements _CompanyListDto {
isActive,
isPartner,
isCustomer,
parentCompanyId,
createdAt,
branchCount);
childCount);
/// Create a copy of CompanyListDto
/// with the given fields replaced by the non-null parameter values.
@@ -398,8 +419,9 @@ abstract class _CompanyListDto implements CompanyListDto {
@JsonKey(name: 'is_active') required final bool isActive,
@JsonKey(name: 'is_partner') final bool isPartner,
@JsonKey(name: 'is_customer') final bool isCustomer,
@JsonKey(name: 'parent_company_id') final int? parentCompanyId,
@JsonKey(name: 'created_at') final DateTime? createdAt,
@JsonKey(name: 'branch_count') final int branchCount}) =
@JsonKey(name: 'child_count') final int childCount}) =
_$CompanyListDtoImpl;
factory _CompanyListDto.fromJson(Map<String, dynamic> json) =
@@ -433,11 +455,14 @@ abstract class _CompanyListDto implements CompanyListDto {
@JsonKey(name: 'is_customer')
bool get isCustomer;
@override
@JsonKey(name: 'parent_company_id')
int? get parentCompanyId;
@override
@JsonKey(name: 'created_at')
DateTime? get createdAt;
@override
@JsonKey(name: 'branch_count')
int get branchCount;
@JsonKey(name: 'child_count')
int get childCount;
/// Create a copy of CompanyListDto
/// with the given fields replaced by the non-null parameter values.
@@ -447,67 +472,67 @@ abstract class _CompanyListDto implements CompanyListDto {
throw _privateConstructorUsedError;
}
CompanyWithBranches _$CompanyWithBranchesFromJson(Map<String, dynamic> json) {
return _CompanyWithBranches.fromJson(json);
CompanyWithChildren _$CompanyWithChildrenFromJson(Map<String, dynamic> json) {
return _CompanyWithChildren.fromJson(json);
}
/// @nodoc
mixin _$CompanyWithBranches {
mixin _$CompanyWithChildren {
CompanyResponse get company => throw _privateConstructorUsedError;
List<BranchListDto> get branches => throw _privateConstructorUsedError;
List<CompanyResponse> get children => throw _privateConstructorUsedError;
/// Serializes this CompanyWithBranches to a JSON map.
/// Serializes this CompanyWithChildren to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of CompanyWithBranches
/// Create a copy of CompanyWithChildren
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$CompanyWithBranchesCopyWith<CompanyWithBranches> get copyWith =>
$CompanyWithChildrenCopyWith<CompanyWithChildren> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $CompanyWithBranchesCopyWith<$Res> {
factory $CompanyWithBranchesCopyWith(
CompanyWithBranches value, $Res Function(CompanyWithBranches) then) =
_$CompanyWithBranchesCopyWithImpl<$Res, CompanyWithBranches>;
abstract class $CompanyWithChildrenCopyWith<$Res> {
factory $CompanyWithChildrenCopyWith(
CompanyWithChildren value, $Res Function(CompanyWithChildren) then) =
_$CompanyWithChildrenCopyWithImpl<$Res, CompanyWithChildren>;
@useResult
$Res call({CompanyResponse company, List<BranchListDto> branches});
$Res call({CompanyResponse company, List<CompanyResponse> children});
$CompanyResponseCopyWith<$Res> get company;
}
/// @nodoc
class _$CompanyWithBranchesCopyWithImpl<$Res, $Val extends CompanyWithBranches>
implements $CompanyWithBranchesCopyWith<$Res> {
_$CompanyWithBranchesCopyWithImpl(this._value, this._then);
class _$CompanyWithChildrenCopyWithImpl<$Res, $Val extends CompanyWithChildren>
implements $CompanyWithChildrenCopyWith<$Res> {
_$CompanyWithChildrenCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of CompanyWithBranches
/// Create a copy of CompanyWithChildren
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? company = null,
Object? branches = null,
Object? children = null,
}) {
return _then(_value.copyWith(
company: null == company
? _value.company
: company // ignore: cast_nullable_to_non_nullable
as CompanyResponse,
branches: null == branches
? _value.branches
: branches // ignore: cast_nullable_to_non_nullable
as List<BranchListDto>,
children: null == children
? _value.children
: children // ignore: cast_nullable_to_non_nullable
as List<CompanyResponse>,
) as $Val);
}
/// Create a copy of CompanyWithBranches
/// Create a copy of CompanyWithChildren
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
@@ -519,122 +544,122 @@ class _$CompanyWithBranchesCopyWithImpl<$Res, $Val extends CompanyWithBranches>
}
/// @nodoc
abstract class _$$CompanyWithBranchesImplCopyWith<$Res>
implements $CompanyWithBranchesCopyWith<$Res> {
factory _$$CompanyWithBranchesImplCopyWith(_$CompanyWithBranchesImpl value,
$Res Function(_$CompanyWithBranchesImpl) then) =
__$$CompanyWithBranchesImplCopyWithImpl<$Res>;
abstract class _$$CompanyWithChildrenImplCopyWith<$Res>
implements $CompanyWithChildrenCopyWith<$Res> {
factory _$$CompanyWithChildrenImplCopyWith(_$CompanyWithChildrenImpl value,
$Res Function(_$CompanyWithChildrenImpl) then) =
__$$CompanyWithChildrenImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({CompanyResponse company, List<BranchListDto> branches});
$Res call({CompanyResponse company, List<CompanyResponse> children});
@override
$CompanyResponseCopyWith<$Res> get company;
}
/// @nodoc
class __$$CompanyWithBranchesImplCopyWithImpl<$Res>
extends _$CompanyWithBranchesCopyWithImpl<$Res, _$CompanyWithBranchesImpl>
implements _$$CompanyWithBranchesImplCopyWith<$Res> {
__$$CompanyWithBranchesImplCopyWithImpl(_$CompanyWithBranchesImpl _value,
$Res Function(_$CompanyWithBranchesImpl) _then)
class __$$CompanyWithChildrenImplCopyWithImpl<$Res>
extends _$CompanyWithChildrenCopyWithImpl<$Res, _$CompanyWithChildrenImpl>
implements _$$CompanyWithChildrenImplCopyWith<$Res> {
__$$CompanyWithChildrenImplCopyWithImpl(_$CompanyWithChildrenImpl _value,
$Res Function(_$CompanyWithChildrenImpl) _then)
: super(_value, _then);
/// Create a copy of CompanyWithBranches
/// Create a copy of CompanyWithChildren
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? company = null,
Object? branches = null,
Object? children = null,
}) {
return _then(_$CompanyWithBranchesImpl(
return _then(_$CompanyWithChildrenImpl(
company: null == company
? _value.company
: company // ignore: cast_nullable_to_non_nullable
as CompanyResponse,
branches: null == branches
? _value._branches
: branches // ignore: cast_nullable_to_non_nullable
as List<BranchListDto>,
children: null == children
? _value._children
: children // ignore: cast_nullable_to_non_nullable
as List<CompanyResponse>,
));
}
}
/// @nodoc
@JsonSerializable()
class _$CompanyWithBranchesImpl implements _CompanyWithBranches {
const _$CompanyWithBranchesImpl(
{required this.company, final List<BranchListDto> branches = const []})
: _branches = branches;
class _$CompanyWithChildrenImpl implements _CompanyWithChildren {
const _$CompanyWithChildrenImpl(
{required this.company, final List<CompanyResponse> children = const []})
: _children = children;
factory _$CompanyWithBranchesImpl.fromJson(Map<String, dynamic> json) =>
_$$CompanyWithBranchesImplFromJson(json);
factory _$CompanyWithChildrenImpl.fromJson(Map<String, dynamic> json) =>
_$$CompanyWithChildrenImplFromJson(json);
@override
final CompanyResponse company;
final List<BranchListDto> _branches;
final List<CompanyResponse> _children;
@override
@JsonKey()
List<BranchListDto> get branches {
if (_branches is EqualUnmodifiableListView) return _branches;
List<CompanyResponse> get children {
if (_children is EqualUnmodifiableListView) return _children;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_branches);
return EqualUnmodifiableListView(_children);
}
@override
String toString() {
return 'CompanyWithBranches(company: $company, branches: $branches)';
return 'CompanyWithChildren(company: $company, children: $children)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CompanyWithBranchesImpl &&
other is _$CompanyWithChildrenImpl &&
(identical(other.company, company) || other.company == company) &&
const DeepCollectionEquality().equals(other._branches, _branches));
const DeepCollectionEquality().equals(other._children, _children));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, company, const DeepCollectionEquality().hash(_branches));
runtimeType, company, const DeepCollectionEquality().hash(_children));
/// Create a copy of CompanyWithBranches
/// Create a copy of CompanyWithChildren
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$CompanyWithBranchesImplCopyWith<_$CompanyWithBranchesImpl> get copyWith =>
__$$CompanyWithBranchesImplCopyWithImpl<_$CompanyWithBranchesImpl>(
_$$CompanyWithChildrenImplCopyWith<_$CompanyWithChildrenImpl> get copyWith =>
__$$CompanyWithChildrenImplCopyWithImpl<_$CompanyWithChildrenImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$CompanyWithBranchesImplToJson(
return _$$CompanyWithChildrenImplToJson(
this,
);
}
}
abstract class _CompanyWithBranches implements CompanyWithBranches {
const factory _CompanyWithBranches(
abstract class _CompanyWithChildren implements CompanyWithChildren {
const factory _CompanyWithChildren(
{required final CompanyResponse company,
final List<BranchListDto> branches}) = _$CompanyWithBranchesImpl;
final List<CompanyResponse> children}) = _$CompanyWithChildrenImpl;
factory _CompanyWithBranches.fromJson(Map<String, dynamic> json) =
_$CompanyWithBranchesImpl.fromJson;
factory _CompanyWithChildren.fromJson(Map<String, dynamic> json) =
_$CompanyWithChildrenImpl.fromJson;
@override
CompanyResponse get company;
@override
List<BranchListDto> get branches;
List<CompanyResponse> get children;
/// Create a copy of CompanyWithBranches
/// Create a copy of CompanyWithChildren
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$CompanyWithBranchesImplCopyWith<_$CompanyWithBranchesImpl> get copyWith =>
_$$CompanyWithChildrenImplCopyWith<_$CompanyWithChildrenImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -20,10 +20,11 @@ _$CompanyListDtoImpl _$$CompanyListDtoImplFromJson(Map<String, dynamic> json) =>
isActive: json['is_active'] as bool,
isPartner: json['is_partner'] as bool? ?? false,
isCustomer: json['is_customer'] as bool? ?? false,
parentCompanyId: (json['parent_company_id'] as num?)?.toInt(),
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
branchCount: (json['branch_count'] as num?)?.toInt() ?? 0,
childCount: (json['child_count'] as num?)?.toInt() ?? 0,
);
Map<String, dynamic> _$$CompanyListDtoImplToJson(
@@ -39,24 +40,25 @@ Map<String, dynamic> _$$CompanyListDtoImplToJson(
'is_active': instance.isActive,
'is_partner': instance.isPartner,
'is_customer': instance.isCustomer,
'parent_company_id': instance.parentCompanyId,
'created_at': instance.createdAt?.toIso8601String(),
'branch_count': instance.branchCount,
'child_count': instance.childCount,
};
_$CompanyWithBranchesImpl _$$CompanyWithBranchesImplFromJson(
_$CompanyWithChildrenImpl _$$CompanyWithChildrenImplFromJson(
Map<String, dynamic> json) =>
_$CompanyWithBranchesImpl(
_$CompanyWithChildrenImpl(
company:
CompanyResponse.fromJson(json['company'] as Map<String, dynamic>),
branches: (json['branches'] as List<dynamic>?)
?.map((e) => BranchListDto.fromJson(e as Map<String, dynamic>))
children: (json['children'] as List<dynamic>?)
?.map((e) => CompanyResponse.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
);
Map<String, dynamic> _$$CompanyWithBranchesImplToJson(
_$CompanyWithBranchesImpl instance) =>
Map<String, dynamic> _$$CompanyWithChildrenImplToJson(
_$CompanyWithChildrenImpl instance) =>
<String, dynamic>{
'company': instance.company,
'branches': instance.branches,
'children': instance.children,
};