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

@@ -23,7 +23,7 @@ abstract class CompanyRemoteDataSource {
Future<CompanyResponse> getCompanyDetail(int id);
Future<CompanyWithBranches> getCompanyWithBranches(int id);
Future<CompanyWithChildren> getCompanyWithChildren(int id);
Future<CompanyResponse> updateCompany(int id, UpdateCompanyRequest request);
@@ -31,7 +31,7 @@ abstract class CompanyRemoteDataSource {
Future<List<CompanyNameDto>> getCompanyNames();
Future<List<CompanyWithBranches>> getCompaniesWithBranches();
Future<List<CompanyWithChildren>> getCompaniesWithBranches();
Future<bool> checkDuplicateCompany(String name);
@@ -51,6 +51,11 @@ abstract class CompanyRemoteDataSource {
Future<List<BranchListDto>> getCompanyBranches(int companyId);
Future<List<CompanyBranchFlatDto>> getCompanyBranchesFlat();
// Headquarters methods
Future<PaginatedResponse<CompanyListDto>> getHeadquartersWithPagination();
Future<List<CompanyListDto>> getHeadquarters();
Future<List<CompanyListDto>> getAllHeadquarters();
}
@LazySingleton(as: CompanyRemoteDataSource)
@@ -176,13 +181,13 @@ class CompanyRemoteDataSourceImpl implements CompanyRemoteDataSource {
}
@override
Future<CompanyWithBranches> getCompanyWithBranches(int id) async {
Future<CompanyWithChildren> getCompanyWithChildren(int id) async {
try {
final response = await _apiClient.dio.get(
'${ApiEndpoints.companies}/$id/with-branches',
);
return CompanyWithBranches.fromJson(response.data['data']);
return CompanyWithChildren.fromJson(response.data['data']);
} on DioException catch (e) {
throw ServerException(
message: e.response?.data['message'] ?? 'Failed to fetch company with branches',
@@ -322,15 +327,15 @@ class CompanyRemoteDataSourceImpl implements CompanyRemoteDataSource {
}
@override
Future<List<CompanyWithBranches>> getCompaniesWithBranches() async {
Future<List<CompanyWithChildren>> getCompaniesWithBranches() async {
try {
final response = await _apiClient.get('${ApiEndpoints.companies}/branches');
if (response.statusCode == 200) {
final apiResponse = ApiResponse<List<CompanyWithBranches>>.fromJson(
final apiResponse = ApiResponse<List<CompanyWithChildren>>.fromJson(
response.data,
(json) => (json as List)
.map((item) => CompanyWithBranches.fromJson(item))
.map((item) => CompanyWithChildren.fromJson(item))
.toList(),
);
return apiResponse.data!;
@@ -449,4 +454,112 @@ class CompanyRemoteDataSourceImpl implements CompanyRemoteDataSource {
throw ApiException(message: e.toString());
}
}
@override
Future<PaginatedResponse<CompanyListDto>> getHeadquartersWithPagination() async {
try {
final response = await _apiClient.get('${ApiEndpoints.companies}/headquarters');
if (response.statusCode == 200) {
final responseData = response.data;
if (responseData != null && responseData['success'] == true && responseData['data'] != null) {
final List<dynamic> dataList = responseData['data'];
final pagination = responseData['pagination'] ?? {};
// CompanyListDto로 변환
final items = dataList.map((item) =>
CompanyListDto.fromJson(item as Map<String, dynamic>)
).toList();
// PaginatedResponse 생성
return PaginatedResponse<CompanyListDto>(
items: items,
page: pagination['page'] ?? 1,
size: pagination['per_page'] ?? 20,
totalElements: pagination['total'] ?? 0,
totalPages: pagination['total_pages'] ?? 1,
first: !(pagination['has_prev'] ?? false),
last: !(pagination['has_next'] ?? false),
);
} else {
throw ApiException(
message: responseData?['error']?['message'] ?? 'Failed to load headquarters',
statusCode: response.statusCode,
);
}
} else {
throw ApiException(
message: 'Failed to load headquarters',
statusCode: response.statusCode,
);
}
} catch (e) {
if (e is ApiException) rethrow;
throw ApiException(message: e.toString());
}
}
@override
Future<List<CompanyListDto>> getHeadquarters() async {
try {
final response = await _apiClient.get('${ApiEndpoints.companies}/headquarters');
if (response.statusCode == 200) {
final responseData = response.data;
if (responseData != null && responseData['success'] == true && responseData['data'] != null) {
final List<dynamic> dataList = responseData['data'];
return dataList.map((item) =>
CompanyListDto.fromJson(item as Map<String, dynamic>)
).toList();
} else {
throw ApiException(
message: responseData?['error']?['message'] ?? 'Failed to load headquarters',
statusCode: response.statusCode,
);
}
} else {
throw ApiException(
message: 'Failed to load headquarters',
statusCode: response.statusCode,
);
}
} catch (e) {
if (e is ApiException) rethrow;
throw ApiException(message: e.toString());
}
}
@override
Future<List<CompanyListDto>> getAllHeadquarters() async {
try {
// Request all headquarters by setting per_page to a large number
final response = await _apiClient.get('${ApiEndpoints.companies}/headquarters', queryParameters: {
'per_page': 1000, // Large enough to get all headquarters (currently 55)
'page': 1,
});
if (response.statusCode == 200) {
final responseData = response.data;
if (responseData != null && responseData['success'] == true && responseData['data'] != null) {
final List<dynamic> dataList = responseData['data'];
return dataList.map((item) =>
CompanyListDto.fromJson(item as Map<String, dynamic>)
).toList();
} else {
throw ApiException(
message: responseData?['error']?['message'] ?? 'Failed to load all headquarters',
statusCode: response.statusCode,
);
}
} else {
throw ApiException(
message: 'Failed to load all headquarters',
statusCode: response.statusCode,
);
}
} catch (e) {
if (e is ApiException) rethrow;
throw ApiException(message: e.toString());
}
}
}

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,
};

View File

@@ -12,13 +12,11 @@ class EquipmentListDto with _$EquipmentListDto {
@JsonKey(name: 'model_name') String? modelName,
@JsonKey(name: 'serial_number') String? serialNumber,
required String status,
@JsonKey(name: 'current_company_id') int? currentCompanyId,
@JsonKey(name: 'current_branch_id') int? currentBranchId,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
@JsonKey(name: 'created_at') required DateTime createdAt,
// 추가 필드 (조인된 데이터)
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'branch_name') String? branchName,
@JsonKey(name: 'warehouse_name') String? warehouseName,
}) = _EquipmentListDto;

View File

@@ -29,10 +29,8 @@ mixin _$EquipmentListDto {
@JsonKey(name: 'serial_number')
String? get serialNumber => throw _privateConstructorUsedError;
String get status => throw _privateConstructorUsedError;
@JsonKey(name: 'current_company_id')
int? get currentCompanyId => throw _privateConstructorUsedError;
@JsonKey(name: 'current_branch_id')
int? get currentBranchId => throw _privateConstructorUsedError;
@JsonKey(name: 'company_id')
int? get companyId => throw _privateConstructorUsedError;
@JsonKey(name: 'warehouse_location_id')
int? get warehouseLocationId => throw _privateConstructorUsedError;
@JsonKey(name: 'created_at')
@@ -40,8 +38,6 @@ mixin _$EquipmentListDto {
throw _privateConstructorUsedError; // 추가 필드 (조인된 데이터)
@JsonKey(name: 'company_name')
String? get companyName => throw _privateConstructorUsedError;
@JsonKey(name: 'branch_name')
String? get branchName => throw _privateConstructorUsedError;
@JsonKey(name: 'warehouse_name')
String? get warehouseName => throw _privateConstructorUsedError;
@@ -68,12 +64,10 @@ abstract class $EquipmentListDtoCopyWith<$Res> {
@JsonKey(name: 'model_name') String? modelName,
@JsonKey(name: 'serial_number') String? serialNumber,
String status,
@JsonKey(name: 'current_company_id') int? currentCompanyId,
@JsonKey(name: 'current_branch_id') int? currentBranchId,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
@JsonKey(name: 'created_at') DateTime createdAt,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'branch_name') String? branchName,
@JsonKey(name: 'warehouse_name') String? warehouseName});
}
@@ -98,12 +92,10 @@ class _$EquipmentListDtoCopyWithImpl<$Res, $Val extends EquipmentListDto>
Object? modelName = freezed,
Object? serialNumber = freezed,
Object? status = null,
Object? currentCompanyId = freezed,
Object? currentBranchId = freezed,
Object? companyId = freezed,
Object? warehouseLocationId = freezed,
Object? createdAt = null,
Object? companyName = freezed,
Object? branchName = freezed,
Object? warehouseName = freezed,
}) {
return _then(_value.copyWith(
@@ -131,13 +123,9 @@ class _$EquipmentListDtoCopyWithImpl<$Res, $Val extends EquipmentListDto>
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
currentCompanyId: freezed == currentCompanyId
? _value.currentCompanyId
: currentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
currentBranchId: freezed == currentBranchId
? _value.currentBranchId
: currentBranchId // ignore: cast_nullable_to_non_nullable
companyId: freezed == companyId
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int?,
warehouseLocationId: freezed == warehouseLocationId
? _value.warehouseLocationId
@@ -151,10 +139,6 @@ class _$EquipmentListDtoCopyWithImpl<$Res, $Val extends EquipmentListDto>
? _value.companyName
: companyName // ignore: cast_nullable_to_non_nullable
as String?,
branchName: freezed == branchName
? _value.branchName
: branchName // ignore: cast_nullable_to_non_nullable
as String?,
warehouseName: freezed == warehouseName
? _value.warehouseName
: warehouseName // ignore: cast_nullable_to_non_nullable
@@ -178,12 +162,10 @@ abstract class _$$EquipmentListDtoImplCopyWith<$Res>
@JsonKey(name: 'model_name') String? modelName,
@JsonKey(name: 'serial_number') String? serialNumber,
String status,
@JsonKey(name: 'current_company_id') int? currentCompanyId,
@JsonKey(name: 'current_branch_id') int? currentBranchId,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
@JsonKey(name: 'created_at') DateTime createdAt,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'branch_name') String? branchName,
@JsonKey(name: 'warehouse_name') String? warehouseName});
}
@@ -206,12 +188,10 @@ class __$$EquipmentListDtoImplCopyWithImpl<$Res>
Object? modelName = freezed,
Object? serialNumber = freezed,
Object? status = null,
Object? currentCompanyId = freezed,
Object? currentBranchId = freezed,
Object? companyId = freezed,
Object? warehouseLocationId = freezed,
Object? createdAt = null,
Object? companyName = freezed,
Object? branchName = freezed,
Object? warehouseName = freezed,
}) {
return _then(_$EquipmentListDtoImpl(
@@ -239,13 +219,9 @@ class __$$EquipmentListDtoImplCopyWithImpl<$Res>
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
currentCompanyId: freezed == currentCompanyId
? _value.currentCompanyId
: currentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
currentBranchId: freezed == currentBranchId
? _value.currentBranchId
: currentBranchId // ignore: cast_nullable_to_non_nullable
companyId: freezed == companyId
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int?,
warehouseLocationId: freezed == warehouseLocationId
? _value.warehouseLocationId
@@ -259,10 +235,6 @@ class __$$EquipmentListDtoImplCopyWithImpl<$Res>
? _value.companyName
: companyName // ignore: cast_nullable_to_non_nullable
as String?,
branchName: freezed == branchName
? _value.branchName
: branchName // ignore: cast_nullable_to_non_nullable
as String?,
warehouseName: freezed == warehouseName
? _value.warehouseName
: warehouseName // ignore: cast_nullable_to_non_nullable
@@ -281,12 +253,10 @@ class _$EquipmentListDtoImpl implements _EquipmentListDto {
@JsonKey(name: 'model_name') this.modelName,
@JsonKey(name: 'serial_number') this.serialNumber,
required this.status,
@JsonKey(name: 'current_company_id') this.currentCompanyId,
@JsonKey(name: 'current_branch_id') this.currentBranchId,
@JsonKey(name: 'company_id') this.companyId,
@JsonKey(name: 'warehouse_location_id') this.warehouseLocationId,
@JsonKey(name: 'created_at') required this.createdAt,
@JsonKey(name: 'company_name') this.companyName,
@JsonKey(name: 'branch_name') this.branchName,
@JsonKey(name: 'warehouse_name') this.warehouseName});
factory _$EquipmentListDtoImpl.fromJson(Map<String, dynamic> json) =>
@@ -308,11 +278,8 @@ class _$EquipmentListDtoImpl implements _EquipmentListDto {
@override
final String status;
@override
@JsonKey(name: 'current_company_id')
final int? currentCompanyId;
@override
@JsonKey(name: 'current_branch_id')
final int? currentBranchId;
@JsonKey(name: 'company_id')
final int? companyId;
@override
@JsonKey(name: 'warehouse_location_id')
final int? warehouseLocationId;
@@ -324,15 +291,12 @@ class _$EquipmentListDtoImpl implements _EquipmentListDto {
@JsonKey(name: 'company_name')
final String? companyName;
@override
@JsonKey(name: 'branch_name')
final String? branchName;
@override
@JsonKey(name: 'warehouse_name')
final String? warehouseName;
@override
String toString() {
return 'EquipmentListDto(id: $id, equipmentNumber: $equipmentNumber, manufacturer: $manufacturer, modelName: $modelName, serialNumber: $serialNumber, status: $status, currentCompanyId: $currentCompanyId, currentBranchId: $currentBranchId, warehouseLocationId: $warehouseLocationId, createdAt: $createdAt, companyName: $companyName, branchName: $branchName, warehouseName: $warehouseName)';
return 'EquipmentListDto(id: $id, equipmentNumber: $equipmentNumber, manufacturer: $manufacturer, modelName: $modelName, serialNumber: $serialNumber, status: $status, companyId: $companyId, warehouseLocationId: $warehouseLocationId, createdAt: $createdAt, companyName: $companyName, warehouseName: $warehouseName)';
}
@override
@@ -350,18 +314,14 @@ class _$EquipmentListDtoImpl implements _EquipmentListDto {
(identical(other.serialNumber, serialNumber) ||
other.serialNumber == serialNumber) &&
(identical(other.status, status) || other.status == status) &&
(identical(other.currentCompanyId, currentCompanyId) ||
other.currentCompanyId == currentCompanyId) &&
(identical(other.currentBranchId, currentBranchId) ||
other.currentBranchId == currentBranchId) &&
(identical(other.companyId, companyId) ||
other.companyId == companyId) &&
(identical(other.warehouseLocationId, warehouseLocationId) ||
other.warehouseLocationId == warehouseLocationId) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.companyName, companyName) ||
other.companyName == companyName) &&
(identical(other.branchName, branchName) ||
other.branchName == branchName) &&
(identical(other.warehouseName, warehouseName) ||
other.warehouseName == warehouseName));
}
@@ -376,12 +336,10 @@ class _$EquipmentListDtoImpl implements _EquipmentListDto {
modelName,
serialNumber,
status,
currentCompanyId,
currentBranchId,
companyId,
warehouseLocationId,
createdAt,
companyName,
branchName,
warehouseName);
/// Create a copy of EquipmentListDto
@@ -409,12 +367,10 @@ abstract class _EquipmentListDto implements EquipmentListDto {
@JsonKey(name: 'model_name') final String? modelName,
@JsonKey(name: 'serial_number') final String? serialNumber,
required final String status,
@JsonKey(name: 'current_company_id') final int? currentCompanyId,
@JsonKey(name: 'current_branch_id') final int? currentBranchId,
@JsonKey(name: 'company_id') final int? companyId,
@JsonKey(name: 'warehouse_location_id') final int? warehouseLocationId,
@JsonKey(name: 'created_at') required final DateTime createdAt,
@JsonKey(name: 'company_name') final String? companyName,
@JsonKey(name: 'branch_name') final String? branchName,
@JsonKey(name: 'warehouse_name')
final String? warehouseName}) = _$EquipmentListDtoImpl;
@@ -437,11 +393,8 @@ abstract class _EquipmentListDto implements EquipmentListDto {
@override
String get status;
@override
@JsonKey(name: 'current_company_id')
int? get currentCompanyId;
@override
@JsonKey(name: 'current_branch_id')
int? get currentBranchId;
@JsonKey(name: 'company_id')
int? get companyId;
@override
@JsonKey(name: 'warehouse_location_id')
int? get warehouseLocationId;
@@ -452,9 +405,6 @@ abstract class _EquipmentListDto implements EquipmentListDto {
@JsonKey(name: 'company_name')
String? get companyName;
@override
@JsonKey(name: 'branch_name')
String? get branchName;
@override
@JsonKey(name: 'warehouse_name')
String? get warehouseName;

View File

@@ -15,12 +15,10 @@ _$EquipmentListDtoImpl _$$EquipmentListDtoImplFromJson(
modelName: json['model_name'] as String?,
serialNumber: json['serial_number'] as String?,
status: json['status'] as String,
currentCompanyId: (json['current_company_id'] as num?)?.toInt(),
currentBranchId: (json['current_branch_id'] as num?)?.toInt(),
companyId: (json['company_id'] as num?)?.toInt(),
warehouseLocationId: (json['warehouse_location_id'] as num?)?.toInt(),
createdAt: DateTime.parse(json['created_at'] as String),
companyName: json['company_name'] as String?,
branchName: json['branch_name'] as String?,
warehouseName: json['warehouse_name'] as String?,
);
@@ -33,12 +31,10 @@ Map<String, dynamic> _$$EquipmentListDtoImplToJson(
'model_name': instance.modelName,
'serial_number': instance.serialNumber,
'status': instance.status,
'current_company_id': instance.currentCompanyId,
'current_branch_id': instance.currentBranchId,
'company_id': instance.companyId,
'warehouse_location_id': instance.warehouseLocationId,
'created_at': instance.createdAt.toIso8601String(),
'company_name': instance.companyName,
'branch_name': instance.branchName,
'warehouse_name': instance.warehouseName,
};

View File

@@ -9,7 +9,6 @@ class EquipmentOutRequest with _$EquipmentOutRequest {
required int equipmentId,
required int quantity,
required int companyId,
int? branchId,
String? notes,
}) = _EquipmentOutRequest;

View File

@@ -23,7 +23,6 @@ mixin _$EquipmentOutRequest {
int get equipmentId => throw _privateConstructorUsedError;
int get quantity => throw _privateConstructorUsedError;
int get companyId => throw _privateConstructorUsedError;
int? get branchId => throw _privateConstructorUsedError;
String? get notes => throw _privateConstructorUsedError;
/// Serializes this EquipmentOutRequest to a JSON map.
@@ -42,12 +41,7 @@ abstract class $EquipmentOutRequestCopyWith<$Res> {
EquipmentOutRequest value, $Res Function(EquipmentOutRequest) then) =
_$EquipmentOutRequestCopyWithImpl<$Res, EquipmentOutRequest>;
@useResult
$Res call(
{int equipmentId,
int quantity,
int companyId,
int? branchId,
String? notes});
$Res call({int equipmentId, int quantity, int companyId, String? notes});
}
/// @nodoc
@@ -68,7 +62,6 @@ class _$EquipmentOutRequestCopyWithImpl<$Res, $Val extends EquipmentOutRequest>
Object? equipmentId = null,
Object? quantity = null,
Object? companyId = null,
Object? branchId = freezed,
Object? notes = freezed,
}) {
return _then(_value.copyWith(
@@ -84,10 +77,6 @@ class _$EquipmentOutRequestCopyWithImpl<$Res, $Val extends EquipmentOutRequest>
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int,
branchId: freezed == branchId
? _value.branchId
: branchId // ignore: cast_nullable_to_non_nullable
as int?,
notes: freezed == notes
? _value.notes
: notes // ignore: cast_nullable_to_non_nullable
@@ -104,12 +93,7 @@ abstract class _$$EquipmentOutRequestImplCopyWith<$Res>
__$$EquipmentOutRequestImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{int equipmentId,
int quantity,
int companyId,
int? branchId,
String? notes});
$Res call({int equipmentId, int quantity, int companyId, String? notes});
}
/// @nodoc
@@ -128,7 +112,6 @@ class __$$EquipmentOutRequestImplCopyWithImpl<$Res>
Object? equipmentId = null,
Object? quantity = null,
Object? companyId = null,
Object? branchId = freezed,
Object? notes = freezed,
}) {
return _then(_$EquipmentOutRequestImpl(
@@ -144,10 +127,6 @@ class __$$EquipmentOutRequestImplCopyWithImpl<$Res>
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int,
branchId: freezed == branchId
? _value.branchId
: branchId // ignore: cast_nullable_to_non_nullable
as int?,
notes: freezed == notes
? _value.notes
: notes // ignore: cast_nullable_to_non_nullable
@@ -163,7 +142,6 @@ class _$EquipmentOutRequestImpl implements _EquipmentOutRequest {
{required this.equipmentId,
required this.quantity,
required this.companyId,
this.branchId,
this.notes});
factory _$EquipmentOutRequestImpl.fromJson(Map<String, dynamic> json) =>
@@ -176,13 +154,11 @@ class _$EquipmentOutRequestImpl implements _EquipmentOutRequest {
@override
final int companyId;
@override
final int? branchId;
@override
final String? notes;
@override
String toString() {
return 'EquipmentOutRequest(equipmentId: $equipmentId, quantity: $quantity, companyId: $companyId, branchId: $branchId, notes: $notes)';
return 'EquipmentOutRequest(equipmentId: $equipmentId, quantity: $quantity, companyId: $companyId, notes: $notes)';
}
@override
@@ -196,15 +172,13 @@ class _$EquipmentOutRequestImpl implements _EquipmentOutRequest {
other.quantity == quantity) &&
(identical(other.companyId, companyId) ||
other.companyId == companyId) &&
(identical(other.branchId, branchId) ||
other.branchId == branchId) &&
(identical(other.notes, notes) || other.notes == notes));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, equipmentId, quantity, companyId, branchId, notes);
int get hashCode =>
Object.hash(runtimeType, equipmentId, quantity, companyId, notes);
/// Create a copy of EquipmentOutRequest
/// with the given fields replaced by the non-null parameter values.
@@ -228,7 +202,6 @@ abstract class _EquipmentOutRequest implements EquipmentOutRequest {
{required final int equipmentId,
required final int quantity,
required final int companyId,
final int? branchId,
final String? notes}) = _$EquipmentOutRequestImpl;
factory _EquipmentOutRequest.fromJson(Map<String, dynamic> json) =
@@ -241,8 +214,6 @@ abstract class _EquipmentOutRequest implements EquipmentOutRequest {
@override
int get companyId;
@override
int? get branchId;
@override
String? get notes;
/// Create a copy of EquipmentOutRequest

View File

@@ -12,7 +12,6 @@ _$EquipmentOutRequestImpl _$$EquipmentOutRequestImplFromJson(
equipmentId: (json['equipmentId'] as num).toInt(),
quantity: (json['quantity'] as num).toInt(),
companyId: (json['companyId'] as num).toInt(),
branchId: (json['branchId'] as num?)?.toInt(),
notes: json['notes'] as String?,
);
@@ -22,6 +21,5 @@ Map<String, dynamic> _$$EquipmentOutRequestImplToJson(
'equipmentId': instance.equipmentId,
'quantity': instance.quantity,
'companyId': instance.companyId,
'branchId': instance.branchId,
'notes': instance.notes,
};

View File

@@ -4,6 +4,41 @@ import 'package:superport/core/utils/equipment_status_converter.dart';
part 'equipment_request.freezed.dart';
part 'equipment_request.g.dart';
/// NaiveDate 형식으로 변환하는 JsonConverter (날짜만, 시간 제외)
class NaiveDateConverter implements JsonConverter<DateTime?, String?> {
const NaiveDateConverter();
@override
DateTime? fromJson(String? json) {
return json != null ? DateTime.parse(json) : null;
}
@override
String? toJson(DateTime? object) {
// NaiveDate 형식으로 변환: "YYYY-MM-DD"
return object?.toIso8601String().split('T')[0];
}
}
/// Decimal 호환성을 위한 JsonConverter
class DecimalConverter implements JsonConverter<double?, dynamic> {
const DecimalConverter();
@override
double? fromJson(dynamic json) {
if (json == null) return null;
if (json is num) return json.toDouble();
if (json is String) return double.tryParse(json);
return null;
}
@override
dynamic toJson(double? object) {
// Rust Decimal과 호환을 위해 문자열로 전송
return object?.toString();
}
}
@freezed
class CreateEquipmentRequest with _$CreateEquipmentRequest {
const factory CreateEquipmentRequest({
@@ -14,8 +49,13 @@ class CreateEquipmentRequest with _$CreateEquipmentRequest {
required String manufacturer,
@JsonKey(name: 'model_name') String? modelName,
@JsonKey(name: 'serial_number') String? serialNumber,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
String? barcode,
@JsonKey(name: 'purchase_date') @NaiveDateConverter() DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') @DecimalConverter() double? purchasePrice,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date') @NaiveDateConverter() DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date') @NaiveDateConverter() DateTime? nextInspectionDate,
String? remark,
}) = _CreateEquipmentRequest;
@@ -26,22 +66,21 @@ class CreateEquipmentRequest with _$CreateEquipmentRequest {
@freezed
class UpdateEquipmentRequest with _$UpdateEquipmentRequest {
const factory UpdateEquipmentRequest({
String? category1,
String? category2,
String? category3,
String? manufacturer,
@JsonKey(name: 'model_name') String? modelName,
@JsonKey(name: 'serial_number') String? serialNumber,
String? barcode,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
@EquipmentStatusJsonConverter() String? status,
@JsonKey(name: 'current_company_id') int? currentCompanyId,
@JsonKey(name: 'current_branch_id') int? currentBranchId,
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date') DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date') DateTime? nextInspectionDate,
String? remark,
@JsonKey(includeIfNull: false) String? category1,
@JsonKey(includeIfNull: false) String? category2,
@JsonKey(includeIfNull: false) String? category3,
@JsonKey(includeIfNull: false) String? manufacturer,
@JsonKey(name: 'model_name', includeIfNull: false) String? modelName,
@JsonKey(name: 'serial_number', includeIfNull: false) String? serialNumber,
@JsonKey(includeIfNull: false) String? barcode,
@JsonKey(name: 'purchase_date', includeIfNull: false) @NaiveDateConverter() DateTime? purchaseDate,
@JsonKey(name: 'purchase_price', includeIfNull: false) @DecimalConverter() double? purchasePrice,
@JsonKey(includeIfNull: false) String? status,
@JsonKey(name: 'company_id', includeIfNull: false) int? companyId,
@JsonKey(name: 'warehouse_location_id', includeIfNull: false) int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date', includeIfNull: false) @NaiveDateConverter() DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date', includeIfNull: false) @NaiveDateConverter() DateTime? nextInspectionDate,
@JsonKey(includeIfNull: false) String? remark,
}) = _UpdateEquipmentRequest;
factory UpdateEquipmentRequest.fromJson(Map<String, dynamic> json) =>

View File

@@ -31,10 +31,23 @@ mixin _$CreateEquipmentRequest {
String? get modelName => throw _privateConstructorUsedError;
@JsonKey(name: 'serial_number')
String? get serialNumber => throw _privateConstructorUsedError;
String? get barcode => throw _privateConstructorUsedError;
@JsonKey(name: 'purchase_date')
@NaiveDateConverter()
DateTime? get purchaseDate => throw _privateConstructorUsedError;
@JsonKey(name: 'purchase_price')
@DecimalConverter()
double? get purchasePrice => throw _privateConstructorUsedError;
@JsonKey(name: 'company_id')
int? get companyId => throw _privateConstructorUsedError;
@JsonKey(name: 'warehouse_location_id')
int? get warehouseLocationId => throw _privateConstructorUsedError;
@JsonKey(name: 'last_inspection_date')
@NaiveDateConverter()
DateTime? get lastInspectionDate => throw _privateConstructorUsedError;
@JsonKey(name: 'next_inspection_date')
@NaiveDateConverter()
DateTime? get nextInspectionDate => throw _privateConstructorUsedError;
String? get remark => throw _privateConstructorUsedError;
/// Serializes this CreateEquipmentRequest to a JSON map.
@@ -61,8 +74,21 @@ abstract class $CreateEquipmentRequestCopyWith<$Res> {
String manufacturer,
@JsonKey(name: 'model_name') String? modelName,
@JsonKey(name: 'serial_number') String? serialNumber,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
String? barcode,
@JsonKey(name: 'purchase_date')
@NaiveDateConverter()
DateTime? purchaseDate,
@JsonKey(name: 'purchase_price')
@DecimalConverter()
double? purchasePrice,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date')
@NaiveDateConverter()
DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date')
@NaiveDateConverter()
DateTime? nextInspectionDate,
String? remark});
}
@@ -89,8 +115,13 @@ class _$CreateEquipmentRequestCopyWithImpl<$Res,
Object? manufacturer = null,
Object? modelName = freezed,
Object? serialNumber = freezed,
Object? barcode = freezed,
Object? purchaseDate = freezed,
Object? purchasePrice = freezed,
Object? companyId = freezed,
Object? warehouseLocationId = freezed,
Object? lastInspectionDate = freezed,
Object? nextInspectionDate = freezed,
Object? remark = freezed,
}) {
return _then(_value.copyWith(
@@ -122,6 +153,10 @@ class _$CreateEquipmentRequestCopyWithImpl<$Res,
? _value.serialNumber
: serialNumber // ignore: cast_nullable_to_non_nullable
as String?,
barcode: freezed == barcode
? _value.barcode
: barcode // ignore: cast_nullable_to_non_nullable
as String?,
purchaseDate: freezed == purchaseDate
? _value.purchaseDate
: purchaseDate // ignore: cast_nullable_to_non_nullable
@@ -130,6 +165,22 @@ class _$CreateEquipmentRequestCopyWithImpl<$Res,
? _value.purchasePrice
: purchasePrice // ignore: cast_nullable_to_non_nullable
as double?,
companyId: freezed == companyId
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int?,
warehouseLocationId: freezed == warehouseLocationId
? _value.warehouseLocationId
: warehouseLocationId // ignore: cast_nullable_to_non_nullable
as int?,
lastInspectionDate: freezed == lastInspectionDate
? _value.lastInspectionDate
: lastInspectionDate // ignore: cast_nullable_to_non_nullable
as DateTime?,
nextInspectionDate: freezed == nextInspectionDate
? _value.nextInspectionDate
: nextInspectionDate // ignore: cast_nullable_to_non_nullable
as DateTime?,
remark: freezed == remark
? _value.remark
: remark // ignore: cast_nullable_to_non_nullable
@@ -155,8 +206,21 @@ abstract class _$$CreateEquipmentRequestImplCopyWith<$Res>
String manufacturer,
@JsonKey(name: 'model_name') String? modelName,
@JsonKey(name: 'serial_number') String? serialNumber,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
String? barcode,
@JsonKey(name: 'purchase_date')
@NaiveDateConverter()
DateTime? purchaseDate,
@JsonKey(name: 'purchase_price')
@DecimalConverter()
double? purchasePrice,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date')
@NaiveDateConverter()
DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date')
@NaiveDateConverter()
DateTime? nextInspectionDate,
String? remark});
}
@@ -182,8 +246,13 @@ class __$$CreateEquipmentRequestImplCopyWithImpl<$Res>
Object? manufacturer = null,
Object? modelName = freezed,
Object? serialNumber = freezed,
Object? barcode = freezed,
Object? purchaseDate = freezed,
Object? purchasePrice = freezed,
Object? companyId = freezed,
Object? warehouseLocationId = freezed,
Object? lastInspectionDate = freezed,
Object? nextInspectionDate = freezed,
Object? remark = freezed,
}) {
return _then(_$CreateEquipmentRequestImpl(
@@ -215,6 +284,10 @@ class __$$CreateEquipmentRequestImplCopyWithImpl<$Res>
? _value.serialNumber
: serialNumber // ignore: cast_nullable_to_non_nullable
as String?,
barcode: freezed == barcode
? _value.barcode
: barcode // ignore: cast_nullable_to_non_nullable
as String?,
purchaseDate: freezed == purchaseDate
? _value.purchaseDate
: purchaseDate // ignore: cast_nullable_to_non_nullable
@@ -223,6 +296,22 @@ class __$$CreateEquipmentRequestImplCopyWithImpl<$Res>
? _value.purchasePrice
: purchasePrice // ignore: cast_nullable_to_non_nullable
as double?,
companyId: freezed == companyId
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int?,
warehouseLocationId: freezed == warehouseLocationId
? _value.warehouseLocationId
: warehouseLocationId // ignore: cast_nullable_to_non_nullable
as int?,
lastInspectionDate: freezed == lastInspectionDate
? _value.lastInspectionDate
: lastInspectionDate // ignore: cast_nullable_to_non_nullable
as DateTime?,
nextInspectionDate: freezed == nextInspectionDate
? _value.nextInspectionDate
: nextInspectionDate // ignore: cast_nullable_to_non_nullable
as DateTime?,
remark: freezed == remark
? _value.remark
: remark // ignore: cast_nullable_to_non_nullable
@@ -242,8 +331,17 @@ class _$CreateEquipmentRequestImpl implements _CreateEquipmentRequest {
required this.manufacturer,
@JsonKey(name: 'model_name') this.modelName,
@JsonKey(name: 'serial_number') this.serialNumber,
@JsonKey(name: 'purchase_date') this.purchaseDate,
@JsonKey(name: 'purchase_price') this.purchasePrice,
this.barcode,
@JsonKey(name: 'purchase_date') @NaiveDateConverter() this.purchaseDate,
@JsonKey(name: 'purchase_price') @DecimalConverter() this.purchasePrice,
@JsonKey(name: 'company_id') this.companyId,
@JsonKey(name: 'warehouse_location_id') this.warehouseLocationId,
@JsonKey(name: 'last_inspection_date')
@NaiveDateConverter()
this.lastInspectionDate,
@JsonKey(name: 'next_inspection_date')
@NaiveDateConverter()
this.nextInspectionDate,
this.remark});
factory _$CreateEquipmentRequestImpl.fromJson(Map<String, dynamic> json) =>
@@ -267,17 +365,35 @@ class _$CreateEquipmentRequestImpl implements _CreateEquipmentRequest {
@JsonKey(name: 'serial_number')
final String? serialNumber;
@override
final String? barcode;
@override
@JsonKey(name: 'purchase_date')
@NaiveDateConverter()
final DateTime? purchaseDate;
@override
@JsonKey(name: 'purchase_price')
@DecimalConverter()
final double? purchasePrice;
@override
@JsonKey(name: 'company_id')
final int? companyId;
@override
@JsonKey(name: 'warehouse_location_id')
final int? warehouseLocationId;
@override
@JsonKey(name: 'last_inspection_date')
@NaiveDateConverter()
final DateTime? lastInspectionDate;
@override
@JsonKey(name: 'next_inspection_date')
@NaiveDateConverter()
final DateTime? nextInspectionDate;
@override
final String? remark;
@override
String toString() {
return 'CreateEquipmentRequest(equipmentNumber: $equipmentNumber, category1: $category1, category2: $category2, category3: $category3, manufacturer: $manufacturer, modelName: $modelName, serialNumber: $serialNumber, purchaseDate: $purchaseDate, purchasePrice: $purchasePrice, remark: $remark)';
return 'CreateEquipmentRequest(equipmentNumber: $equipmentNumber, category1: $category1, category2: $category2, category3: $category3, manufacturer: $manufacturer, modelName: $modelName, serialNumber: $serialNumber, barcode: $barcode, purchaseDate: $purchaseDate, purchasePrice: $purchasePrice, companyId: $companyId, warehouseLocationId: $warehouseLocationId, lastInspectionDate: $lastInspectionDate, nextInspectionDate: $nextInspectionDate, remark: $remark)';
}
@override
@@ -299,10 +415,19 @@ class _$CreateEquipmentRequestImpl implements _CreateEquipmentRequest {
other.modelName == modelName) &&
(identical(other.serialNumber, serialNumber) ||
other.serialNumber == serialNumber) &&
(identical(other.barcode, barcode) || other.barcode == barcode) &&
(identical(other.purchaseDate, purchaseDate) ||
other.purchaseDate == purchaseDate) &&
(identical(other.purchasePrice, purchasePrice) ||
other.purchasePrice == purchasePrice) &&
(identical(other.companyId, companyId) ||
other.companyId == companyId) &&
(identical(other.warehouseLocationId, warehouseLocationId) ||
other.warehouseLocationId == warehouseLocationId) &&
(identical(other.lastInspectionDate, lastInspectionDate) ||
other.lastInspectionDate == lastInspectionDate) &&
(identical(other.nextInspectionDate, nextInspectionDate) ||
other.nextInspectionDate == nextInspectionDate) &&
(identical(other.remark, remark) || other.remark == remark));
}
@@ -317,8 +442,13 @@ class _$CreateEquipmentRequestImpl implements _CreateEquipmentRequest {
manufacturer,
modelName,
serialNumber,
barcode,
purchaseDate,
purchasePrice,
companyId,
warehouseLocationId,
lastInspectionDate,
nextInspectionDate,
remark);
/// Create a copy of CreateEquipmentRequest
@@ -347,8 +477,21 @@ abstract class _CreateEquipmentRequest implements CreateEquipmentRequest {
required final String manufacturer,
@JsonKey(name: 'model_name') final String? modelName,
@JsonKey(name: 'serial_number') final String? serialNumber,
@JsonKey(name: 'purchase_date') final DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') final double? purchasePrice,
final String? barcode,
@JsonKey(name: 'purchase_date')
@NaiveDateConverter()
final DateTime? purchaseDate,
@JsonKey(name: 'purchase_price')
@DecimalConverter()
final double? purchasePrice,
@JsonKey(name: 'company_id') final int? companyId,
@JsonKey(name: 'warehouse_location_id') final int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date')
@NaiveDateConverter()
final DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date')
@NaiveDateConverter()
final DateTime? nextInspectionDate,
final String? remark}) = _$CreateEquipmentRequestImpl;
factory _CreateEquipmentRequest.fromJson(Map<String, dynamic> json) =
@@ -372,12 +515,30 @@ abstract class _CreateEquipmentRequest implements CreateEquipmentRequest {
@JsonKey(name: 'serial_number')
String? get serialNumber;
@override
String? get barcode;
@override
@JsonKey(name: 'purchase_date')
@NaiveDateConverter()
DateTime? get purchaseDate;
@override
@JsonKey(name: 'purchase_price')
@DecimalConverter()
double? get purchasePrice;
@override
@JsonKey(name: 'company_id')
int? get companyId;
@override
@JsonKey(name: 'warehouse_location_id')
int? get warehouseLocationId;
@override
@JsonKey(name: 'last_inspection_date')
@NaiveDateConverter()
DateTime? get lastInspectionDate;
@override
@JsonKey(name: 'next_inspection_date')
@NaiveDateConverter()
DateTime? get nextInspectionDate;
@override
String? get remark;
/// Create a copy of CreateEquipmentRequest
@@ -395,31 +556,39 @@ UpdateEquipmentRequest _$UpdateEquipmentRequestFromJson(
/// @nodoc
mixin _$UpdateEquipmentRequest {
@JsonKey(includeIfNull: false)
String? get category1 => throw _privateConstructorUsedError;
@JsonKey(includeIfNull: false)
String? get category2 => throw _privateConstructorUsedError;
@JsonKey(includeIfNull: false)
String? get category3 => throw _privateConstructorUsedError;
@JsonKey(includeIfNull: false)
String? get manufacturer => throw _privateConstructorUsedError;
@JsonKey(name: 'model_name')
@JsonKey(name: 'model_name', includeIfNull: false)
String? get modelName => throw _privateConstructorUsedError;
@JsonKey(name: 'serial_number')
@JsonKey(name: 'serial_number', includeIfNull: false)
String? get serialNumber => throw _privateConstructorUsedError;
@JsonKey(includeIfNull: false)
String? get barcode => throw _privateConstructorUsedError;
@JsonKey(name: 'purchase_date')
@JsonKey(name: 'purchase_date', includeIfNull: false)
@NaiveDateConverter()
DateTime? get purchaseDate => throw _privateConstructorUsedError;
@JsonKey(name: 'purchase_price')
@JsonKey(name: 'purchase_price', includeIfNull: false)
@DecimalConverter()
double? get purchasePrice => throw _privateConstructorUsedError;
@EquipmentStatusJsonConverter()
@JsonKey(includeIfNull: false)
String? get status => throw _privateConstructorUsedError;
@JsonKey(name: 'current_company_id')
int? get currentCompanyId => throw _privateConstructorUsedError;
@JsonKey(name: 'current_branch_id')
int? get currentBranchId => throw _privateConstructorUsedError;
@JsonKey(name: 'warehouse_location_id')
@JsonKey(name: 'company_id', includeIfNull: false)
int? get companyId => throw _privateConstructorUsedError;
@JsonKey(name: 'warehouse_location_id', includeIfNull: false)
int? get warehouseLocationId => throw _privateConstructorUsedError;
@JsonKey(name: 'last_inspection_date')
@JsonKey(name: 'last_inspection_date', includeIfNull: false)
@NaiveDateConverter()
DateTime? get lastInspectionDate => throw _privateConstructorUsedError;
@JsonKey(name: 'next_inspection_date')
@JsonKey(name: 'next_inspection_date', includeIfNull: false)
@NaiveDateConverter()
DateTime? get nextInspectionDate => throw _privateConstructorUsedError;
@JsonKey(includeIfNull: false)
String? get remark => throw _privateConstructorUsedError;
/// Serializes this UpdateEquipmentRequest to a JSON map.
@@ -439,22 +608,31 @@ abstract class $UpdateEquipmentRequestCopyWith<$Res> {
_$UpdateEquipmentRequestCopyWithImpl<$Res, UpdateEquipmentRequest>;
@useResult
$Res call(
{String? category1,
String? category2,
String? category3,
String? manufacturer,
@JsonKey(name: 'model_name') String? modelName,
@JsonKey(name: 'serial_number') String? serialNumber,
String? barcode,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
@EquipmentStatusJsonConverter() String? status,
@JsonKey(name: 'current_company_id') int? currentCompanyId,
@JsonKey(name: 'current_branch_id') int? currentBranchId,
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date') DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date') DateTime? nextInspectionDate,
String? remark});
{@JsonKey(includeIfNull: false) String? category1,
@JsonKey(includeIfNull: false) String? category2,
@JsonKey(includeIfNull: false) String? category3,
@JsonKey(includeIfNull: false) String? manufacturer,
@JsonKey(name: 'model_name', includeIfNull: false) String? modelName,
@JsonKey(name: 'serial_number', includeIfNull: false)
String? serialNumber,
@JsonKey(includeIfNull: false) String? barcode,
@JsonKey(name: 'purchase_date', includeIfNull: false)
@NaiveDateConverter()
DateTime? purchaseDate,
@JsonKey(name: 'purchase_price', includeIfNull: false)
@DecimalConverter()
double? purchasePrice,
@JsonKey(includeIfNull: false) String? status,
@JsonKey(name: 'company_id', includeIfNull: false) int? companyId,
@JsonKey(name: 'warehouse_location_id', includeIfNull: false)
int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date', includeIfNull: false)
@NaiveDateConverter()
DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date', includeIfNull: false)
@NaiveDateConverter()
DateTime? nextInspectionDate,
@JsonKey(includeIfNull: false) String? remark});
}
/// @nodoc
@@ -483,8 +661,7 @@ class _$UpdateEquipmentRequestCopyWithImpl<$Res,
Object? purchaseDate = freezed,
Object? purchasePrice = freezed,
Object? status = freezed,
Object? currentCompanyId = freezed,
Object? currentBranchId = freezed,
Object? companyId = freezed,
Object? warehouseLocationId = freezed,
Object? lastInspectionDate = freezed,
Object? nextInspectionDate = freezed,
@@ -531,13 +708,9 @@ class _$UpdateEquipmentRequestCopyWithImpl<$Res,
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String?,
currentCompanyId: freezed == currentCompanyId
? _value.currentCompanyId
: currentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
currentBranchId: freezed == currentBranchId
? _value.currentBranchId
: currentBranchId // ignore: cast_nullable_to_non_nullable
companyId: freezed == companyId
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int?,
warehouseLocationId: freezed == warehouseLocationId
? _value.warehouseLocationId
@@ -569,22 +742,31 @@ abstract class _$$UpdateEquipmentRequestImplCopyWith<$Res>
@override
@useResult
$Res call(
{String? category1,
String? category2,
String? category3,
String? manufacturer,
@JsonKey(name: 'model_name') String? modelName,
@JsonKey(name: 'serial_number') String? serialNumber,
String? barcode,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
@EquipmentStatusJsonConverter() String? status,
@JsonKey(name: 'current_company_id') int? currentCompanyId,
@JsonKey(name: 'current_branch_id') int? currentBranchId,
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date') DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date') DateTime? nextInspectionDate,
String? remark});
{@JsonKey(includeIfNull: false) String? category1,
@JsonKey(includeIfNull: false) String? category2,
@JsonKey(includeIfNull: false) String? category3,
@JsonKey(includeIfNull: false) String? manufacturer,
@JsonKey(name: 'model_name', includeIfNull: false) String? modelName,
@JsonKey(name: 'serial_number', includeIfNull: false)
String? serialNumber,
@JsonKey(includeIfNull: false) String? barcode,
@JsonKey(name: 'purchase_date', includeIfNull: false)
@NaiveDateConverter()
DateTime? purchaseDate,
@JsonKey(name: 'purchase_price', includeIfNull: false)
@DecimalConverter()
double? purchasePrice,
@JsonKey(includeIfNull: false) String? status,
@JsonKey(name: 'company_id', includeIfNull: false) int? companyId,
@JsonKey(name: 'warehouse_location_id', includeIfNull: false)
int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date', includeIfNull: false)
@NaiveDateConverter()
DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date', includeIfNull: false)
@NaiveDateConverter()
DateTime? nextInspectionDate,
@JsonKey(includeIfNull: false) String? remark});
}
/// @nodoc
@@ -612,8 +794,7 @@ class __$$UpdateEquipmentRequestImplCopyWithImpl<$Res>
Object? purchaseDate = freezed,
Object? purchasePrice = freezed,
Object? status = freezed,
Object? currentCompanyId = freezed,
Object? currentBranchId = freezed,
Object? companyId = freezed,
Object? warehouseLocationId = freezed,
Object? lastInspectionDate = freezed,
Object? nextInspectionDate = freezed,
@@ -660,13 +841,9 @@ class __$$UpdateEquipmentRequestImplCopyWithImpl<$Res>
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String?,
currentCompanyId: freezed == currentCompanyId
? _value.currentCompanyId
: currentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
currentBranchId: freezed == currentBranchId
? _value.currentBranchId
: currentBranchId // ignore: cast_nullable_to_non_nullable
companyId: freezed == companyId
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int?,
warehouseLocationId: freezed == warehouseLocationId
? _value.warehouseLocationId
@@ -692,72 +869,87 @@ class __$$UpdateEquipmentRequestImplCopyWithImpl<$Res>
@JsonSerializable()
class _$UpdateEquipmentRequestImpl implements _UpdateEquipmentRequest {
const _$UpdateEquipmentRequestImpl(
{this.category1,
this.category2,
this.category3,
this.manufacturer,
@JsonKey(name: 'model_name') this.modelName,
@JsonKey(name: 'serial_number') this.serialNumber,
this.barcode,
@JsonKey(name: 'purchase_date') this.purchaseDate,
@JsonKey(name: 'purchase_price') this.purchasePrice,
@EquipmentStatusJsonConverter() this.status,
@JsonKey(name: 'current_company_id') this.currentCompanyId,
@JsonKey(name: 'current_branch_id') this.currentBranchId,
@JsonKey(name: 'warehouse_location_id') this.warehouseLocationId,
@JsonKey(name: 'last_inspection_date') this.lastInspectionDate,
@JsonKey(name: 'next_inspection_date') this.nextInspectionDate,
this.remark});
{@JsonKey(includeIfNull: false) this.category1,
@JsonKey(includeIfNull: false) this.category2,
@JsonKey(includeIfNull: false) this.category3,
@JsonKey(includeIfNull: false) this.manufacturer,
@JsonKey(name: 'model_name', includeIfNull: false) this.modelName,
@JsonKey(name: 'serial_number', includeIfNull: false) this.serialNumber,
@JsonKey(includeIfNull: false) this.barcode,
@JsonKey(name: 'purchase_date', includeIfNull: false)
@NaiveDateConverter()
this.purchaseDate,
@JsonKey(name: 'purchase_price', includeIfNull: false)
@DecimalConverter()
this.purchasePrice,
@JsonKey(includeIfNull: false) this.status,
@JsonKey(name: 'company_id', includeIfNull: false) this.companyId,
@JsonKey(name: 'warehouse_location_id', includeIfNull: false)
this.warehouseLocationId,
@JsonKey(name: 'last_inspection_date', includeIfNull: false)
@NaiveDateConverter()
this.lastInspectionDate,
@JsonKey(name: 'next_inspection_date', includeIfNull: false)
@NaiveDateConverter()
this.nextInspectionDate,
@JsonKey(includeIfNull: false) this.remark});
factory _$UpdateEquipmentRequestImpl.fromJson(Map<String, dynamic> json) =>
_$$UpdateEquipmentRequestImplFromJson(json);
@override
@JsonKey(includeIfNull: false)
final String? category1;
@override
@JsonKey(includeIfNull: false)
final String? category2;
@override
@JsonKey(includeIfNull: false)
final String? category3;
@override
@JsonKey(includeIfNull: false)
final String? manufacturer;
@override
@JsonKey(name: 'model_name')
@JsonKey(name: 'model_name', includeIfNull: false)
final String? modelName;
@override
@JsonKey(name: 'serial_number')
@JsonKey(name: 'serial_number', includeIfNull: false)
final String? serialNumber;
@override
@JsonKey(includeIfNull: false)
final String? barcode;
@override
@JsonKey(name: 'purchase_date')
@JsonKey(name: 'purchase_date', includeIfNull: false)
@NaiveDateConverter()
final DateTime? purchaseDate;
@override
@JsonKey(name: 'purchase_price')
@JsonKey(name: 'purchase_price', includeIfNull: false)
@DecimalConverter()
final double? purchasePrice;
@override
@EquipmentStatusJsonConverter()
@JsonKey(includeIfNull: false)
final String? status;
@override
@JsonKey(name: 'current_company_id')
final int? currentCompanyId;
@JsonKey(name: 'company_id', includeIfNull: false)
final int? companyId;
@override
@JsonKey(name: 'current_branch_id')
final int? currentBranchId;
@override
@JsonKey(name: 'warehouse_location_id')
@JsonKey(name: 'warehouse_location_id', includeIfNull: false)
final int? warehouseLocationId;
@override
@JsonKey(name: 'last_inspection_date')
@JsonKey(name: 'last_inspection_date', includeIfNull: false)
@NaiveDateConverter()
final DateTime? lastInspectionDate;
@override
@JsonKey(name: 'next_inspection_date')
@JsonKey(name: 'next_inspection_date', includeIfNull: false)
@NaiveDateConverter()
final DateTime? nextInspectionDate;
@override
@JsonKey(includeIfNull: false)
final String? remark;
@override
String toString() {
return 'UpdateEquipmentRequest(category1: $category1, category2: $category2, category3: $category3, manufacturer: $manufacturer, modelName: $modelName, serialNumber: $serialNumber, barcode: $barcode, purchaseDate: $purchaseDate, purchasePrice: $purchasePrice, status: $status, currentCompanyId: $currentCompanyId, currentBranchId: $currentBranchId, warehouseLocationId: $warehouseLocationId, lastInspectionDate: $lastInspectionDate, nextInspectionDate: $nextInspectionDate, remark: $remark)';
return 'UpdateEquipmentRequest(category1: $category1, category2: $category2, category3: $category3, manufacturer: $manufacturer, modelName: $modelName, serialNumber: $serialNumber, barcode: $barcode, purchaseDate: $purchaseDate, purchasePrice: $purchasePrice, status: $status, companyId: $companyId, warehouseLocationId: $warehouseLocationId, lastInspectionDate: $lastInspectionDate, nextInspectionDate: $nextInspectionDate, remark: $remark)';
}
@override
@@ -783,10 +975,8 @@ class _$UpdateEquipmentRequestImpl implements _UpdateEquipmentRequest {
(identical(other.purchasePrice, purchasePrice) ||
other.purchasePrice == purchasePrice) &&
(identical(other.status, status) || other.status == status) &&
(identical(other.currentCompanyId, currentCompanyId) ||
other.currentCompanyId == currentCompanyId) &&
(identical(other.currentBranchId, currentBranchId) ||
other.currentBranchId == currentBranchId) &&
(identical(other.companyId, companyId) ||
other.companyId == companyId) &&
(identical(other.warehouseLocationId, warehouseLocationId) ||
other.warehouseLocationId == warehouseLocationId) &&
(identical(other.lastInspectionDate, lastInspectionDate) ||
@@ -810,8 +1000,7 @@ class _$UpdateEquipmentRequestImpl implements _UpdateEquipmentRequest {
purchaseDate,
purchasePrice,
status,
currentCompanyId,
currentBranchId,
companyId,
warehouseLocationId,
lastInspectionDate,
nextInspectionDate,
@@ -836,67 +1025,85 @@ class _$UpdateEquipmentRequestImpl implements _UpdateEquipmentRequest {
abstract class _UpdateEquipmentRequest implements UpdateEquipmentRequest {
const factory _UpdateEquipmentRequest(
{final String? category1,
final String? category2,
final String? category3,
final String? manufacturer,
@JsonKey(name: 'model_name') final String? modelName,
@JsonKey(name: 'serial_number') final String? serialNumber,
final String? barcode,
@JsonKey(name: 'purchase_date') final DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') final double? purchasePrice,
@EquipmentStatusJsonConverter() final String? status,
@JsonKey(name: 'current_company_id') final int? currentCompanyId,
@JsonKey(name: 'current_branch_id') final int? currentBranchId,
@JsonKey(name: 'warehouse_location_id') final int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date') final DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date') final DateTime? nextInspectionDate,
{@JsonKey(includeIfNull: false) final String? category1,
@JsonKey(includeIfNull: false) final String? category2,
@JsonKey(includeIfNull: false) final String? category3,
@JsonKey(includeIfNull: false) final String? manufacturer,
@JsonKey(name: 'model_name', includeIfNull: false)
final String? modelName,
@JsonKey(name: 'serial_number', includeIfNull: false)
final String? serialNumber,
@JsonKey(includeIfNull: false) final String? barcode,
@JsonKey(name: 'purchase_date', includeIfNull: false)
@NaiveDateConverter()
final DateTime? purchaseDate,
@JsonKey(name: 'purchase_price', includeIfNull: false)
@DecimalConverter()
final double? purchasePrice,
@JsonKey(includeIfNull: false) final String? status,
@JsonKey(name: 'company_id', includeIfNull: false) final int? companyId,
@JsonKey(name: 'warehouse_location_id', includeIfNull: false)
final int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date', includeIfNull: false)
@NaiveDateConverter()
final DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date', includeIfNull: false)
@NaiveDateConverter()
final DateTime? nextInspectionDate,
@JsonKey(includeIfNull: false)
final String? remark}) = _$UpdateEquipmentRequestImpl;
factory _UpdateEquipmentRequest.fromJson(Map<String, dynamic> json) =
_$UpdateEquipmentRequestImpl.fromJson;
@override
@JsonKey(includeIfNull: false)
String? get category1;
@override
@JsonKey(includeIfNull: false)
String? get category2;
@override
@JsonKey(includeIfNull: false)
String? get category3;
@override
@JsonKey(includeIfNull: false)
String? get manufacturer;
@override
@JsonKey(name: 'model_name')
@JsonKey(name: 'model_name', includeIfNull: false)
String? get modelName;
@override
@JsonKey(name: 'serial_number')
@JsonKey(name: 'serial_number', includeIfNull: false)
String? get serialNumber;
@override
@JsonKey(includeIfNull: false)
String? get barcode;
@override
@JsonKey(name: 'purchase_date')
@JsonKey(name: 'purchase_date', includeIfNull: false)
@NaiveDateConverter()
DateTime? get purchaseDate;
@override
@JsonKey(name: 'purchase_price')
@JsonKey(name: 'purchase_price', includeIfNull: false)
@DecimalConverter()
double? get purchasePrice;
@override
@EquipmentStatusJsonConverter()
@JsonKey(includeIfNull: false)
String? get status;
@override
@JsonKey(name: 'current_company_id')
int? get currentCompanyId;
@JsonKey(name: 'company_id', includeIfNull: false)
int? get companyId;
@override
@JsonKey(name: 'current_branch_id')
int? get currentBranchId;
@override
@JsonKey(name: 'warehouse_location_id')
@JsonKey(name: 'warehouse_location_id', includeIfNull: false)
int? get warehouseLocationId;
@override
@JsonKey(name: 'last_inspection_date')
@JsonKey(name: 'last_inspection_date', includeIfNull: false)
@NaiveDateConverter()
DateTime? get lastInspectionDate;
@override
@JsonKey(name: 'next_inspection_date')
@JsonKey(name: 'next_inspection_date', includeIfNull: false)
@NaiveDateConverter()
DateTime? get nextInspectionDate;
@override
@JsonKey(includeIfNull: false)
String? get remark;
/// Create a copy of UpdateEquipmentRequest

View File

@@ -16,10 +16,16 @@ _$CreateEquipmentRequestImpl _$$CreateEquipmentRequestImplFromJson(
manufacturer: json['manufacturer'] as String,
modelName: json['model_name'] as String?,
serialNumber: json['serial_number'] as String?,
purchaseDate: json['purchase_date'] == null
? null
: DateTime.parse(json['purchase_date'] as String),
purchasePrice: (json['purchase_price'] as num?)?.toDouble(),
barcode: json['barcode'] as String?,
purchaseDate:
const NaiveDateConverter().fromJson(json['purchase_date'] as String?),
purchasePrice: const DecimalConverter().fromJson(json['purchase_price']),
companyId: (json['company_id'] as num?)?.toInt(),
warehouseLocationId: (json['warehouse_location_id'] as num?)?.toInt(),
lastInspectionDate: const NaiveDateConverter()
.fromJson(json['last_inspection_date'] as String?),
nextInspectionDate: const NaiveDateConverter()
.fromJson(json['next_inspection_date'] as String?),
remark: json['remark'] as String?,
);
@@ -33,8 +39,15 @@ Map<String, dynamic> _$$CreateEquipmentRequestImplToJson(
'manufacturer': instance.manufacturer,
'model_name': instance.modelName,
'serial_number': instance.serialNumber,
'purchase_date': instance.purchaseDate?.toIso8601String(),
'purchase_price': instance.purchasePrice,
'barcode': instance.barcode,
'purchase_date': const NaiveDateConverter().toJson(instance.purchaseDate),
'purchase_price': const DecimalConverter().toJson(instance.purchasePrice),
'company_id': instance.companyId,
'warehouse_location_id': instance.warehouseLocationId,
'last_inspection_date':
const NaiveDateConverter().toJson(instance.lastInspectionDate),
'next_inspection_date':
const NaiveDateConverter().toJson(instance.nextInspectionDate),
'remark': instance.remark,
};
@@ -48,54 +61,44 @@ _$UpdateEquipmentRequestImpl _$$UpdateEquipmentRequestImplFromJson(
modelName: json['model_name'] as String?,
serialNumber: json['serial_number'] as String?,
barcode: json['barcode'] as String?,
purchaseDate: json['purchase_date'] == null
? null
: DateTime.parse(json['purchase_date'] as String),
purchasePrice: (json['purchase_price'] as num?)?.toDouble(),
status: _$JsonConverterFromJson<String, String>(
json['status'], const EquipmentStatusJsonConverter().fromJson),
currentCompanyId: (json['current_company_id'] as num?)?.toInt(),
currentBranchId: (json['current_branch_id'] as num?)?.toInt(),
purchaseDate:
const NaiveDateConverter().fromJson(json['purchase_date'] as String?),
purchasePrice: const DecimalConverter().fromJson(json['purchase_price']),
status: json['status'] as String?,
companyId: (json['company_id'] as num?)?.toInt(),
warehouseLocationId: (json['warehouse_location_id'] as num?)?.toInt(),
lastInspectionDate: json['last_inspection_date'] == null
? null
: DateTime.parse(json['last_inspection_date'] as String),
nextInspectionDate: json['next_inspection_date'] == null
? null
: DateTime.parse(json['next_inspection_date'] as String),
lastInspectionDate: const NaiveDateConverter()
.fromJson(json['last_inspection_date'] as String?),
nextInspectionDate: const NaiveDateConverter()
.fromJson(json['next_inspection_date'] as String?),
remark: json['remark'] as String?,
);
Map<String, dynamic> _$$UpdateEquipmentRequestImplToJson(
_$UpdateEquipmentRequestImpl instance) =>
<String, dynamic>{
'category1': instance.category1,
'category2': instance.category2,
'category3': instance.category3,
'manufacturer': instance.manufacturer,
'model_name': instance.modelName,
'serial_number': instance.serialNumber,
'barcode': instance.barcode,
'purchase_date': instance.purchaseDate?.toIso8601String(),
'purchase_price': instance.purchasePrice,
'status': _$JsonConverterToJson<String, String>(
instance.status, const EquipmentStatusJsonConverter().toJson),
'current_company_id': instance.currentCompanyId,
'current_branch_id': instance.currentBranchId,
'warehouse_location_id': instance.warehouseLocationId,
'last_inspection_date': instance.lastInspectionDate?.toIso8601String(),
'next_inspection_date': instance.nextInspectionDate?.toIso8601String(),
'remark': instance.remark,
if (instance.category1 case final value?) 'category1': value,
if (instance.category2 case final value?) 'category2': value,
if (instance.category3 case final value?) 'category3': value,
if (instance.manufacturer case final value?) 'manufacturer': value,
if (instance.modelName case final value?) 'model_name': value,
if (instance.serialNumber case final value?) 'serial_number': value,
if (instance.barcode case final value?) 'barcode': value,
if (const NaiveDateConverter().toJson(instance.purchaseDate)
case final value?)
'purchase_date': value,
if (const DecimalConverter().toJson(instance.purchasePrice)
case final value?)
'purchase_price': value,
if (instance.status case final value?) 'status': value,
if (instance.companyId case final value?) 'company_id': value,
if (instance.warehouseLocationId case final value?)
'warehouse_location_id': value,
if (const NaiveDateConverter().toJson(instance.lastInspectionDate)
case final value?)
'last_inspection_date': value,
if (const NaiveDateConverter().toJson(instance.nextInspectionDate)
case final value?)
'next_inspection_date': value,
if (instance.remark case final value?) 'remark': value,
};
Value? _$JsonConverterFromJson<Json, Value>(
Object? json,
Value? Function(Json json) fromJson,
) =>
json == null ? null : fromJson(json as Json);
Json? _$JsonConverterToJson<Json, Value>(
Value? value,
Json? Function(Value value) toJson,
) =>
value == null ? null : toJson(value);

View File

@@ -19,8 +19,7 @@ class EquipmentResponse with _$EquipmentResponse {
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') String? purchasePrice,
@EquipmentStatusJsonConverter() required String status,
@JsonKey(name: 'current_company_id') int? currentCompanyId,
@JsonKey(name: 'current_branch_id') int? currentBranchId,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date') DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date') DateTime? nextInspectionDate,
@@ -29,7 +28,6 @@ class EquipmentResponse with _$EquipmentResponse {
@JsonKey(name: 'updated_at') required DateTime updatedAt,
// 추가 필드 (조인된 데이터)
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'branch_name') String? branchName,
@JsonKey(name: 'warehouse_name') String? warehouseName,
}) = _EquipmentResponse;

View File

@@ -38,10 +38,8 @@ mixin _$EquipmentResponse {
String? get purchasePrice => throw _privateConstructorUsedError;
@EquipmentStatusJsonConverter()
String get status => throw _privateConstructorUsedError;
@JsonKey(name: 'current_company_id')
int? get currentCompanyId => throw _privateConstructorUsedError;
@JsonKey(name: 'current_branch_id')
int? get currentBranchId => throw _privateConstructorUsedError;
@JsonKey(name: 'company_id')
int? get companyId => throw _privateConstructorUsedError;
@JsonKey(name: 'warehouse_location_id')
int? get warehouseLocationId => throw _privateConstructorUsedError;
@JsonKey(name: 'last_inspection_date')
@@ -56,8 +54,6 @@ mixin _$EquipmentResponse {
throw _privateConstructorUsedError; // 추가 필드 (조인된 데이터)
@JsonKey(name: 'company_name')
String? get companyName => throw _privateConstructorUsedError;
@JsonKey(name: 'branch_name')
String? get branchName => throw _privateConstructorUsedError;
@JsonKey(name: 'warehouse_name')
String? get warehouseName => throw _privateConstructorUsedError;
@@ -90,8 +86,7 @@ abstract class $EquipmentResponseCopyWith<$Res> {
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') String? purchasePrice,
@EquipmentStatusJsonConverter() String status,
@JsonKey(name: 'current_company_id') int? currentCompanyId,
@JsonKey(name: 'current_branch_id') int? currentBranchId,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date') DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date') DateTime? nextInspectionDate,
@@ -99,7 +94,6 @@ abstract class $EquipmentResponseCopyWith<$Res> {
@JsonKey(name: 'created_at') DateTime createdAt,
@JsonKey(name: 'updated_at') DateTime updatedAt,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'branch_name') String? branchName,
@JsonKey(name: 'warehouse_name') String? warehouseName});
}
@@ -130,8 +124,7 @@ class _$EquipmentResponseCopyWithImpl<$Res, $Val extends EquipmentResponse>
Object? purchaseDate = freezed,
Object? purchasePrice = freezed,
Object? status = null,
Object? currentCompanyId = freezed,
Object? currentBranchId = freezed,
Object? companyId = freezed,
Object? warehouseLocationId = freezed,
Object? lastInspectionDate = freezed,
Object? nextInspectionDate = freezed,
@@ -139,7 +132,6 @@ class _$EquipmentResponseCopyWithImpl<$Res, $Val extends EquipmentResponse>
Object? createdAt = null,
Object? updatedAt = null,
Object? companyName = freezed,
Object? branchName = freezed,
Object? warehouseName = freezed,
}) {
return _then(_value.copyWith(
@@ -191,13 +183,9 @@ class _$EquipmentResponseCopyWithImpl<$Res, $Val extends EquipmentResponse>
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
currentCompanyId: freezed == currentCompanyId
? _value.currentCompanyId
: currentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
currentBranchId: freezed == currentBranchId
? _value.currentBranchId
: currentBranchId // ignore: cast_nullable_to_non_nullable
companyId: freezed == companyId
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int?,
warehouseLocationId: freezed == warehouseLocationId
? _value.warehouseLocationId
@@ -227,10 +215,6 @@ class _$EquipmentResponseCopyWithImpl<$Res, $Val extends EquipmentResponse>
? _value.companyName
: companyName // ignore: cast_nullable_to_non_nullable
as String?,
branchName: freezed == branchName
? _value.branchName
: branchName // ignore: cast_nullable_to_non_nullable
as String?,
warehouseName: freezed == warehouseName
? _value.warehouseName
: warehouseName // ignore: cast_nullable_to_non_nullable
@@ -260,8 +244,7 @@ abstract class _$$EquipmentResponseImplCopyWith<$Res>
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') String? purchasePrice,
@EquipmentStatusJsonConverter() String status,
@JsonKey(name: 'current_company_id') int? currentCompanyId,
@JsonKey(name: 'current_branch_id') int? currentBranchId,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'warehouse_location_id') int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date') DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date') DateTime? nextInspectionDate,
@@ -269,7 +252,6 @@ abstract class _$$EquipmentResponseImplCopyWith<$Res>
@JsonKey(name: 'created_at') DateTime createdAt,
@JsonKey(name: 'updated_at') DateTime updatedAt,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'branch_name') String? branchName,
@JsonKey(name: 'warehouse_name') String? warehouseName});
}
@@ -298,8 +280,7 @@ class __$$EquipmentResponseImplCopyWithImpl<$Res>
Object? purchaseDate = freezed,
Object? purchasePrice = freezed,
Object? status = null,
Object? currentCompanyId = freezed,
Object? currentBranchId = freezed,
Object? companyId = freezed,
Object? warehouseLocationId = freezed,
Object? lastInspectionDate = freezed,
Object? nextInspectionDate = freezed,
@@ -307,7 +288,6 @@ class __$$EquipmentResponseImplCopyWithImpl<$Res>
Object? createdAt = null,
Object? updatedAt = null,
Object? companyName = freezed,
Object? branchName = freezed,
Object? warehouseName = freezed,
}) {
return _then(_$EquipmentResponseImpl(
@@ -359,13 +339,9 @@ class __$$EquipmentResponseImplCopyWithImpl<$Res>
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
currentCompanyId: freezed == currentCompanyId
? _value.currentCompanyId
: currentCompanyId // ignore: cast_nullable_to_non_nullable
as int?,
currentBranchId: freezed == currentBranchId
? _value.currentBranchId
: currentBranchId // ignore: cast_nullable_to_non_nullable
companyId: freezed == companyId
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int?,
warehouseLocationId: freezed == warehouseLocationId
? _value.warehouseLocationId
@@ -395,10 +371,6 @@ class __$$EquipmentResponseImplCopyWithImpl<$Res>
? _value.companyName
: companyName // ignore: cast_nullable_to_non_nullable
as String?,
branchName: freezed == branchName
? _value.branchName
: branchName // ignore: cast_nullable_to_non_nullable
as String?,
warehouseName: freezed == warehouseName
? _value.warehouseName
: warehouseName // ignore: cast_nullable_to_non_nullable
@@ -423,8 +395,7 @@ class _$EquipmentResponseImpl implements _EquipmentResponse {
@JsonKey(name: 'purchase_date') this.purchaseDate,
@JsonKey(name: 'purchase_price') this.purchasePrice,
@EquipmentStatusJsonConverter() required this.status,
@JsonKey(name: 'current_company_id') this.currentCompanyId,
@JsonKey(name: 'current_branch_id') this.currentBranchId,
@JsonKey(name: 'company_id') this.companyId,
@JsonKey(name: 'warehouse_location_id') this.warehouseLocationId,
@JsonKey(name: 'last_inspection_date') this.lastInspectionDate,
@JsonKey(name: 'next_inspection_date') this.nextInspectionDate,
@@ -432,7 +403,6 @@ class _$EquipmentResponseImpl implements _EquipmentResponse {
@JsonKey(name: 'created_at') required this.createdAt,
@JsonKey(name: 'updated_at') required this.updatedAt,
@JsonKey(name: 'company_name') this.companyName,
@JsonKey(name: 'branch_name') this.branchName,
@JsonKey(name: 'warehouse_name') this.warehouseName});
factory _$EquipmentResponseImpl.fromJson(Map<String, dynamic> json) =>
@@ -469,11 +439,8 @@ class _$EquipmentResponseImpl implements _EquipmentResponse {
@EquipmentStatusJsonConverter()
final String status;
@override
@JsonKey(name: 'current_company_id')
final int? currentCompanyId;
@override
@JsonKey(name: 'current_branch_id')
final int? currentBranchId;
@JsonKey(name: 'company_id')
final int? companyId;
@override
@JsonKey(name: 'warehouse_location_id')
final int? warehouseLocationId;
@@ -496,15 +463,12 @@ class _$EquipmentResponseImpl implements _EquipmentResponse {
@JsonKey(name: 'company_name')
final String? companyName;
@override
@JsonKey(name: 'branch_name')
final String? branchName;
@override
@JsonKey(name: 'warehouse_name')
final String? warehouseName;
@override
String toString() {
return 'EquipmentResponse(id: $id, equipmentNumber: $equipmentNumber, category1: $category1, category2: $category2, category3: $category3, manufacturer: $manufacturer, modelName: $modelName, serialNumber: $serialNumber, barcode: $barcode, purchaseDate: $purchaseDate, purchasePrice: $purchasePrice, status: $status, currentCompanyId: $currentCompanyId, currentBranchId: $currentBranchId, warehouseLocationId: $warehouseLocationId, lastInspectionDate: $lastInspectionDate, nextInspectionDate: $nextInspectionDate, remark: $remark, createdAt: $createdAt, updatedAt: $updatedAt, companyName: $companyName, branchName: $branchName, warehouseName: $warehouseName)';
return 'EquipmentResponse(id: $id, equipmentNumber: $equipmentNumber, category1: $category1, category2: $category2, category3: $category3, manufacturer: $manufacturer, modelName: $modelName, serialNumber: $serialNumber, barcode: $barcode, purchaseDate: $purchaseDate, purchasePrice: $purchasePrice, status: $status, companyId: $companyId, warehouseLocationId: $warehouseLocationId, lastInspectionDate: $lastInspectionDate, nextInspectionDate: $nextInspectionDate, remark: $remark, createdAt: $createdAt, updatedAt: $updatedAt, companyName: $companyName, warehouseName: $warehouseName)';
}
@override
@@ -533,10 +497,8 @@ class _$EquipmentResponseImpl implements _EquipmentResponse {
(identical(other.purchasePrice, purchasePrice) ||
other.purchasePrice == purchasePrice) &&
(identical(other.status, status) || other.status == status) &&
(identical(other.currentCompanyId, currentCompanyId) ||
other.currentCompanyId == currentCompanyId) &&
(identical(other.currentBranchId, currentBranchId) ||
other.currentBranchId == currentBranchId) &&
(identical(other.companyId, companyId) ||
other.companyId == companyId) &&
(identical(other.warehouseLocationId, warehouseLocationId) ||
other.warehouseLocationId == warehouseLocationId) &&
(identical(other.lastInspectionDate, lastInspectionDate) ||
@@ -550,8 +512,6 @@ class _$EquipmentResponseImpl implements _EquipmentResponse {
other.updatedAt == updatedAt) &&
(identical(other.companyName, companyName) ||
other.companyName == companyName) &&
(identical(other.branchName, branchName) ||
other.branchName == branchName) &&
(identical(other.warehouseName, warehouseName) ||
other.warehouseName == warehouseName));
}
@@ -572,8 +532,7 @@ class _$EquipmentResponseImpl implements _EquipmentResponse {
purchaseDate,
purchasePrice,
status,
currentCompanyId,
currentBranchId,
companyId,
warehouseLocationId,
lastInspectionDate,
nextInspectionDate,
@@ -581,7 +540,6 @@ class _$EquipmentResponseImpl implements _EquipmentResponse {
createdAt,
updatedAt,
companyName,
branchName,
warehouseName
]);
@@ -616,8 +574,7 @@ abstract class _EquipmentResponse implements EquipmentResponse {
@JsonKey(name: 'purchase_date') final DateTime? purchaseDate,
@JsonKey(name: 'purchase_price') final String? purchasePrice,
@EquipmentStatusJsonConverter() required final String status,
@JsonKey(name: 'current_company_id') final int? currentCompanyId,
@JsonKey(name: 'current_branch_id') final int? currentBranchId,
@JsonKey(name: 'company_id') final int? companyId,
@JsonKey(name: 'warehouse_location_id') final int? warehouseLocationId,
@JsonKey(name: 'last_inspection_date') final DateTime? lastInspectionDate,
@JsonKey(name: 'next_inspection_date') final DateTime? nextInspectionDate,
@@ -625,7 +582,6 @@ abstract class _EquipmentResponse implements EquipmentResponse {
@JsonKey(name: 'created_at') required final DateTime createdAt,
@JsonKey(name: 'updated_at') required final DateTime updatedAt,
@JsonKey(name: 'company_name') final String? companyName,
@JsonKey(name: 'branch_name') final String? branchName,
@JsonKey(name: 'warehouse_name')
final String? warehouseName}) = _$EquipmentResponseImpl;
@@ -663,11 +619,8 @@ abstract class _EquipmentResponse implements EquipmentResponse {
@EquipmentStatusJsonConverter()
String get status;
@override
@JsonKey(name: 'current_company_id')
int? get currentCompanyId;
@override
@JsonKey(name: 'current_branch_id')
int? get currentBranchId;
@JsonKey(name: 'company_id')
int? get companyId;
@override
@JsonKey(name: 'warehouse_location_id')
int? get warehouseLocationId;
@@ -689,9 +642,6 @@ abstract class _EquipmentResponse implements EquipmentResponse {
@JsonKey(name: 'company_name')
String? get companyName;
@override
@JsonKey(name: 'branch_name')
String? get branchName;
@override
@JsonKey(name: 'warehouse_name')
String? get warehouseName;

View File

@@ -24,8 +24,7 @@ _$EquipmentResponseImpl _$$EquipmentResponseImplFromJson(
purchasePrice: json['purchase_price'] as String?,
status: const EquipmentStatusJsonConverter()
.fromJson(json['status'] as String),
currentCompanyId: (json['current_company_id'] as num?)?.toInt(),
currentBranchId: (json['current_branch_id'] as num?)?.toInt(),
companyId: (json['company_id'] as num?)?.toInt(),
warehouseLocationId: (json['warehouse_location_id'] as num?)?.toInt(),
lastInspectionDate: json['last_inspection_date'] == null
? null
@@ -37,7 +36,6 @@ _$EquipmentResponseImpl _$$EquipmentResponseImplFromJson(
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
companyName: json['company_name'] as String?,
branchName: json['branch_name'] as String?,
warehouseName: json['warehouse_name'] as String?,
);
@@ -56,8 +54,7 @@ Map<String, dynamic> _$$EquipmentResponseImplToJson(
'purchase_date': instance.purchaseDate?.toIso8601String(),
'purchase_price': instance.purchasePrice,
'status': const EquipmentStatusJsonConverter().toJson(instance.status),
'current_company_id': instance.currentCompanyId,
'current_branch_id': instance.currentBranchId,
'company_id': instance.companyId,
'warehouse_location_id': instance.warehouseLocationId,
'last_inspection_date': instance.lastInspectionDate?.toIso8601String(),
'next_inspection_date': instance.nextInspectionDate?.toIso8601String(),
@@ -65,6 +62,5 @@ Map<String, dynamic> _$$EquipmentResponseImplToJson(
'created_at': instance.createdAt.toIso8601String(),
'updated_at': instance.updatedAt.toIso8601String(),
'company_name': instance.companyName,
'branch_name': instance.branchName,
'warehouse_name': instance.warehouseName,
};

View File

@@ -59,7 +59,7 @@ class CompanyRepositoryImpl implements CompanyRepository {
@override
Future<Either<Failure, Company>> getCompanyById(int id) async {
try {
final result = await remoteDataSource.getCompanyWithBranches(id);
final result = await remoteDataSource.getCompanyWithChildren(id);
final company = _mapDetailDtoToDomain(result);
return Right(company);
} catch (e) {
@@ -321,7 +321,7 @@ class CompanyRepositoryImpl implements CompanyRepository {
);
}
Company _mapDetailDtoToDomain(CompanyWithBranches dto) {
Company _mapDetailDtoToDomain(CompanyWithChildren dto) {
return Company(
id: dto.company.id,
name: dto.company.name,
@@ -332,7 +332,7 @@ class CompanyRepositoryImpl implements CompanyRepository {
contactEmail: dto.company.contactEmail,
companyTypes: _parseCompanyTypes(dto.company.companyTypes),
remark: dto.company.remark,
branches: dto.branches.map((branch) => _mapBranchDtoToDomain(branch)).toList(),
branches: [], // TODO: 계층형 구조로 변경됨. children은 자회사를 의미하므로 branches는 빈 리스트로 설정
);
}

View File

@@ -277,7 +277,6 @@ class EquipmentRepositoryImpl implements EquipmentRepository {
equipmentId: equipmentOut.equipment.id ?? 0,
quantity: equipmentOut.equipment.quantity,
companyId: 0, // TODO: company string을 ID로 변환 필요
branchId: null,
notes: equipmentOut.remark,
);
@@ -313,8 +312,7 @@ class EquipmentRepositoryImpl implements EquipmentRepository {
Future<Either<Failure, EquipmentOut>> updateEquipmentOut(int id, EquipmentOut equipmentOut) async {
try {
final request = UpdateEquipmentRequest(
currentCompanyId: 0, // TODO: company string을 ID로 변환 필요
currentBranchId: null,
companyId: 0, // TODO: company string을 ID로 변환 필요
remark: equipmentOut.remark,
);
@@ -371,7 +369,6 @@ class EquipmentRepositoryImpl implements EquipmentRepository {
equipmentId: equipmentOut.equipment.id ?? 0,
quantity: equipmentOut.equipment.quantity,
companyId: 0, // TODO: company string을 ID로 변환 필요
branchId: null,
notes: equipmentOut.remark,
);