refactor: 프로젝트 구조 개선 및 테스트 시스템 강화
Some checks failed
Flutter Test & Quality Check / Test on macos-latest (push) Has been cancelled
Flutter Test & Quality Check / Test on ubuntu-latest (push) Has been cancelled
Flutter Test & Quality Check / Build APK (push) Has been cancelled

주요 변경사항:
- CLAUDE.md: 프로젝트 규칙 v2.0으로 업데이트, 아키텍처 명확화
- 불필요한 문서 제거: NEXT_TASKS.md, TEST_PROGRESS.md, test_results 파일들
- 테스트 시스템 개선: 실제 API 테스트 스위트 추가 (15개 새 테스트 파일)
- License 관리: DTO 모델 개선, API 응답 처리 최적화
- 에러 처리: Interceptor 로직 강화, 상세 로깅 추가
- Company/User/Warehouse 테스트: 자동화 테스트 안정성 향상
- Phone Utils: 전화번호 포맷팅 로직 개선
- Overview Controller: 대시보드 데이터 로딩 최적화
- Analysis Options: Flutter 린트 규칙 추가

테스트 개선:
- company_real_api_test.dart: 실제 API 회사 관리 테스트
- equipment_in/out_real_api_test.dart: 장비 입출고 API 테스트
- license_real_api_test.dart: 라이선스 관리 API 테스트
- user_real_api_test.dart: 사용자 관리 API 테스트
- warehouse_location_real_api_test.dart: 창고 위치 API 테스트
- filter_sort_test.dart: 필터링/정렬 기능 테스트
- pagination_test.dart: 페이지네이션 테스트
- interactive_search_test.dart: 검색 기능 테스트
- overview_dashboard_test.dart: 대시보드 통합 테스트

코드 품질:
- 모든 서비스에 에러 처리 강화
- DTO 모델 null safety 개선
- 테스트 커버리지 확대
- 불필요한 로그 파일 제거로 리포지토리 정리

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
JiWoong Sul
2025-08-07 17:16:30 +09:00
parent fe05094392
commit c8dd1ff815
79 changed files with 12558 additions and 9761 deletions

View File

@@ -1,4 +1,5 @@
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:injectable/injectable.dart';
import 'package:superport/core/constants/api_endpoints.dart';
import 'package:superport/core/errors/exceptions.dart';
@@ -116,26 +117,42 @@ class CompanyRemoteDataSourceImpl implements CompanyRemoteDataSource {
@override
Future<CompanyResponse> createCompany(CreateCompanyRequest request) async {
try {
debugPrint('[CompanyRemoteDataSource] Sending POST request to ${ApiEndpoints.companies}');
debugPrint('[CompanyRemoteDataSource] Request data: ${request.toJson()}');
final response = await _apiClient.post(
ApiEndpoints.companies,
data: request.toJson(),
);
if (response.statusCode == 201) {
final apiResponse = ApiResponse<CompanyResponse>.fromJson(
response.data,
(json) => CompanyResponse.fromJson(json as Map<String, dynamic>),
);
return apiResponse.data!;
debugPrint('[CompanyRemoteDataSource] Response status: ${response.statusCode}');
debugPrint('[CompanyRemoteDataSource] Response data: ${response.data}');
if (response.statusCode == 201 || response.statusCode == 200) {
// API 응답 구조 확인
final responseData = response.data;
if (responseData != null && responseData['success'] == true && responseData['data'] != null) {
// 직접 파싱
return CompanyResponse.fromJson(responseData['data'] as Map<String, dynamic>);
} else {
// ApiResponse 형식으로 파싱 시도
final apiResponse = ApiResponse<CompanyResponse>.fromJson(
response.data,
(json) => CompanyResponse.fromJson(json as Map<String, dynamic>),
);
return apiResponse.data!;
}
} else {
throw ApiException(
message: 'Failed to create company',
message: 'Failed to create company - Status: ${response.statusCode}',
statusCode: response.statusCode,
);
}
} catch (e) {
} catch (e, stackTrace) {
debugPrint('[CompanyRemoteDataSource] Error creating company: $e');
debugPrint('[CompanyRemoteDataSource] Stack trace: $stackTrace');
if (e is ApiException) rethrow;
throw ApiException(message: e.toString());
throw ApiException(message: 'Error creating company: $e');
}
}

View File

@@ -18,6 +18,7 @@ abstract class EquipmentRemoteDataSource {
String? status,
int? companyId,
int? warehouseLocationId,
String? search,
});
Future<EquipmentResponse> createEquipment(CreateEquipmentRequest request);
@@ -49,6 +50,7 @@ class EquipmentRemoteDataSourceImpl implements EquipmentRemoteDataSource {
String? status,
int? companyId,
int? warehouseLocationId,
String? search,
}) async {
try {
final queryParams = {
@@ -57,6 +59,7 @@ class EquipmentRemoteDataSourceImpl implements EquipmentRemoteDataSource {
if (status != null) 'status': status,
if (companyId != null) 'company_id': companyId,
if (warehouseLocationId != null) 'warehouse_location_id': warehouseLocationId,
if (search != null && search.isNotEmpty) 'search': search,
};
final response = await _apiClient.get(

View File

@@ -1,5 +1,7 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import '../../../../core/errors/exceptions.dart';
import '../../../../core/constants/app_constants.dart';
@@ -69,9 +71,9 @@ class ErrorInterceptor extends Interceptor {
if (errorMessage.contains('cors') || errorString.contains('cors') ||
errorMessage.contains('xmlhttprequest') || errorString.contains('xmlhttprequest')) {
print('[ErrorInterceptor] CORS 에러 감지됨');
print('[ErrorInterceptor] 요청 URL: ${err.requestOptions.uri}');
print('[ErrorInterceptor] 에러 메시지: ${err.message}');
debugPrint('[ErrorInterceptor] CORS 에러 감지됨');
debugPrint('[ErrorInterceptor] 요청 URL: ${err.requestOptions.uri}');
debugPrint('[ErrorInterceptor] 에러 메시지: ${err.message}');
handler.reject(
DioException(
@@ -84,10 +86,10 @@ class ErrorInterceptor extends Interceptor {
),
);
} else {
print('[ErrorInterceptor] 알 수 없는 에러');
print('[ErrorInterceptor] 에러 타입: ${err.error?.runtimeType}');
print('[ErrorInterceptor] 에러 메시지: ${err.message}');
print('[ErrorInterceptor] 에러 내용: ${err.error}');
debugPrint('[ErrorInterceptor] 알 수 없는 에러');
debugPrint('[ErrorInterceptor] 에러 타입: ${err.error?.runtimeType}');
debugPrint('[ErrorInterceptor] 에러 메시지: ${err.message}');
debugPrint('[ErrorInterceptor] 에러 내용: ${err.error}');
handler.reject(
DioException(

View File

@@ -1,4 +1,5 @@
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
/// API 응답을 정규화하는 인터셉터
///
@@ -6,16 +7,16 @@ import 'package:dio/dio.dart';
class ResponseInterceptor extends Interceptor {
@override
void onResponse(Response response, ResponseInterceptorHandler handler) {
print('[ResponseInterceptor] 응답 수신: ${response.requestOptions.path}');
print('[ResponseInterceptor] 상태 코드: ${response.statusCode}');
print('[ResponseInterceptor] 응답 데이터 타입: ${response.data.runtimeType}');
debugPrint('[ResponseInterceptor] 응답 수신: ${response.requestOptions.path}');
debugPrint('[ResponseInterceptor] 상태 코드: ${response.statusCode}');
debugPrint('[ResponseInterceptor] 응답 데이터 타입: ${response.data.runtimeType}');
// 장비 관련 API 응답 상세 로깅
if (response.requestOptions.path.contains('equipment')) {
print('[ResponseInterceptor] 장비 API 응답 전체: ${response.data}');
debugPrint('[ResponseInterceptor] 장비 API 응답 전체: ${response.data}');
if (response.data is List && (response.data as List).isNotEmpty) {
final firstItem = (response.data as List).first;
print('[ResponseInterceptor] 첫 번째 장비 상태: ${firstItem['status']}');
debugPrint('[ResponseInterceptor] 첫 번째 장비 상태: ${firstItem['status']}');
}
}
@@ -27,7 +28,7 @@ class ResponseInterceptor extends Interceptor {
// 이미 정규화된 형식인지 확인
if (data.containsKey('success') && data.containsKey('data')) {
print('[ResponseInterceptor] 이미 정규화된 응답 형식');
debugPrint('[ResponseInterceptor] 이미 정규화된 응답 형식');
handler.next(response);
return;
}
@@ -35,7 +36,7 @@ class ResponseInterceptor extends Interceptor {
// API 응답이 직접 데이터를 반환하는 경우
// (예: {accessToken: "...", refreshToken: "...", user: {...}})
if (_isDirectDataResponse(data)) {
print('[ResponseInterceptor] 직접 데이터 응답을 정규화된 형식으로 변환');
debugPrint('[ResponseInterceptor] 직접 데이터 응답을 정규화된 형식으로 변환');
// 정규화된 응답으로 변환
response.data = {

View File

@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:injectable/injectable.dart';
import 'package:superport/core/constants/api_endpoints.dart';
import 'package:superport/core/errors/exceptions.dart';
@@ -63,7 +64,53 @@ class LicenseRemoteDataSourceImpl implements LicenseRemoteDataSource {
);
if (response.data != null && response.data['success'] == true && response.data['data'] != null) {
return LicenseListResponseDto.fromJson(response.data['data']);
// API 응답이 배열인 경우와 객체인 경우를 모두 처리
final data = response.data['data'];
if (data is List) {
// 배열 응답을 LicenseListResponseDto 형식으로 변환
final List<LicenseDto> licenses = [];
for (int i = 0; i < data.length; i++) {
try {
final item = data[i];
debugPrint('📑 Parsing license item $i: ${item['license_key']}');
// null 검사 및 기본값 설정
final licenseDto = LicenseDto.fromJson({
...item,
// 필수 필드 보장
'license_key': item['license_key'] ?? '',
'is_active': item['is_active'] ?? true,
'created_at': item['created_at'] ?? DateTime.now().toIso8601String(),
'updated_at': item['updated_at'] ?? DateTime.now().toIso8601String(),
});
licenses.add(licenseDto);
} catch (e, stackTrace) {
debugPrint('❌ Error parsing license item $i: $e');
debugPrint('Item data: ${data[i]}');
debugPrint('Stack trace: $stackTrace');
// 파싱 실패한 항목은 건너뛰고 계속
continue;
}
}
final pagination = response.data['pagination'] ?? {};
return LicenseListResponseDto(
items: licenses,
total: pagination['total'] ?? licenses.length,
page: pagination['page'] ?? page,
perPage: pagination['per_page'] ?? perPage,
totalPages: pagination['total_pages'] ?? 1,
);
} else if (data['items'] != null) {
// 이미 LicenseListResponseDto 형식인 경우
return LicenseListResponseDto.fromJson(data);
} else {
// 예상치 못한 형식인 경우
throw ApiException(
message: 'Unexpected response format for license list',
);
}
} else {
throw ApiException(
message: response.data?['error']?['message'] ?? 'Failed to fetch licenses',
@@ -202,7 +249,35 @@ class LicenseRemoteDataSourceImpl implements LicenseRemoteDataSource {
);
if (response.data != null && response.data['success'] == true && response.data['data'] != null) {
return ExpiringLicenseListDto.fromJson(response.data['data']);
// API 응답이 배열 형태인 경우 처리
final data = response.data['data'];
final pagination = response.data['pagination'] ?? {};
if (data is List) {
// 배열 응답을 ExpiringLicenseListDto 형식으로 변환
final List<ExpiringLicenseDto> licenses = [];
for (var item in data) {
try {
licenses.add(ExpiringLicenseDto.fromJson(item));
} catch (e) {
debugPrint('❌ Error parsing expiring license: $e');
debugPrint('Item data: $item');
continue;
}
}
return ExpiringLicenseListDto(
items: licenses,
total: pagination['total'] ?? licenses.length,
page: pagination['page'] ?? page,
perPage: pagination['per_page'] ?? perPage,
totalPages: pagination['total_pages'] ?? 1,
);
} else {
// 이미 올바른 형식인 경우
return ExpiringLicenseListDto.fromJson(data);
}
} else {
throw ApiException(
message: response.data?['error']?['message'] ?? 'Failed to fetch expiring licenses',

View File

@@ -33,7 +33,34 @@ class UserRemoteDataSource {
);
if (response.data != null && response.data['success'] == true && response.data['data'] != null) {
return UserListDto.fromJson(response.data['data']);
// API 응답이 배열인 경우와 객체인 경우를 모두 처리
final data = response.data['data'];
if (data is List) {
// 배열 응답을 UserListDto 형식으로 변환
// role이 null인 경우 기본값 설정
final users = data.map((json) {
if (json['role'] == null) {
json['role'] = 'staff'; // 기본값
}
return UserDto.fromJson(json);
}).toList();
final pagination = response.data['pagination'] ?? {};
return UserListDto(
users: users,
total: pagination['total'] ?? users.length,
page: pagination['page'] ?? page,
perPage: pagination['per_page'] ?? perPage,
totalPages: pagination['total_pages'] ?? 1,
);
} else if (data['users'] != null) {
// 이미 UserListDto 형식인 경우
return UserListDto.fromJson(data);
} else {
// 예상치 못한 형식인 경우
throw ApiException(
message: 'Unexpected response format for user list',
);
}
} else {
throw ApiException(
message: response.data?['error']?['message'] ?? '사용자 목록을 불러오는데 실패했습니다',

View File

@@ -11,8 +11,8 @@ class CompanyListDto with _$CompanyListDto {
required int id,
required String name,
required String address,
@JsonKey(name: 'contact_name') required String contactName,
@JsonKey(name: 'contact_phone') required String contactPhone,
@JsonKey(name: 'contact_name') String? contactName,
@JsonKey(name: 'contact_phone') String? contactPhone,
@JsonKey(name: 'contact_email') String? contactEmail,
@JsonKey(name: 'is_active') required bool isActive,
@JsonKey(name: 'created_at') DateTime? createdAt,

View File

@@ -24,9 +24,9 @@ mixin _$CompanyListDto {
String get name => throw _privateConstructorUsedError;
String get address => throw _privateConstructorUsedError;
@JsonKey(name: 'contact_name')
String get contactName => throw _privateConstructorUsedError;
String? get contactName => throw _privateConstructorUsedError;
@JsonKey(name: 'contact_phone')
String get contactPhone => throw _privateConstructorUsedError;
String? get contactPhone => throw _privateConstructorUsedError;
@JsonKey(name: 'contact_email')
String? get contactEmail => throw _privateConstructorUsedError;
@JsonKey(name: 'is_active')
@@ -56,8 +56,8 @@ abstract class $CompanyListDtoCopyWith<$Res> {
{int id,
String name,
String address,
@JsonKey(name: 'contact_name') String contactName,
@JsonKey(name: 'contact_phone') String contactPhone,
@JsonKey(name: 'contact_name') String? contactName,
@JsonKey(name: 'contact_phone') String? contactPhone,
@JsonKey(name: 'contact_email') String? contactEmail,
@JsonKey(name: 'is_active') bool isActive,
@JsonKey(name: 'created_at') DateTime? createdAt,
@@ -82,8 +82,8 @@ class _$CompanyListDtoCopyWithImpl<$Res, $Val extends CompanyListDto>
Object? id = null,
Object? name = null,
Object? address = null,
Object? contactName = null,
Object? contactPhone = null,
Object? contactName = freezed,
Object? contactPhone = freezed,
Object? contactEmail = freezed,
Object? isActive = null,
Object? createdAt = freezed,
@@ -102,14 +102,14 @@ class _$CompanyListDtoCopyWithImpl<$Res, $Val extends CompanyListDto>
? _value.address
: address // ignore: cast_nullable_to_non_nullable
as String,
contactName: null == contactName
contactName: freezed == contactName
? _value.contactName
: contactName // ignore: cast_nullable_to_non_nullable
as String,
contactPhone: null == contactPhone
as String?,
contactPhone: freezed == contactPhone
? _value.contactPhone
: contactPhone // ignore: cast_nullable_to_non_nullable
as String,
as String?,
contactEmail: freezed == contactEmail
? _value.contactEmail
: contactEmail // ignore: cast_nullable_to_non_nullable
@@ -142,8 +142,8 @@ abstract class _$$CompanyListDtoImplCopyWith<$Res>
{int id,
String name,
String address,
@JsonKey(name: 'contact_name') String contactName,
@JsonKey(name: 'contact_phone') String contactPhone,
@JsonKey(name: 'contact_name') String? contactName,
@JsonKey(name: 'contact_phone') String? contactPhone,
@JsonKey(name: 'contact_email') String? contactEmail,
@JsonKey(name: 'is_active') bool isActive,
@JsonKey(name: 'created_at') DateTime? createdAt,
@@ -166,8 +166,8 @@ class __$$CompanyListDtoImplCopyWithImpl<$Res>
Object? id = null,
Object? name = null,
Object? address = null,
Object? contactName = null,
Object? contactPhone = null,
Object? contactName = freezed,
Object? contactPhone = freezed,
Object? contactEmail = freezed,
Object? isActive = null,
Object? createdAt = freezed,
@@ -186,14 +186,14 @@ class __$$CompanyListDtoImplCopyWithImpl<$Res>
? _value.address
: address // ignore: cast_nullable_to_non_nullable
as String,
contactName: null == contactName
contactName: freezed == contactName
? _value.contactName
: contactName // ignore: cast_nullable_to_non_nullable
as String,
contactPhone: null == contactPhone
as String?,
contactPhone: freezed == contactPhone
? _value.contactPhone
: contactPhone // ignore: cast_nullable_to_non_nullable
as String,
as String?,
contactEmail: freezed == contactEmail
? _value.contactEmail
: contactEmail // ignore: cast_nullable_to_non_nullable
@@ -221,8 +221,8 @@ class _$CompanyListDtoImpl implements _CompanyListDto {
{required this.id,
required this.name,
required this.address,
@JsonKey(name: 'contact_name') required this.contactName,
@JsonKey(name: 'contact_phone') required this.contactPhone,
@JsonKey(name: 'contact_name') this.contactName,
@JsonKey(name: 'contact_phone') this.contactPhone,
@JsonKey(name: 'contact_email') this.contactEmail,
@JsonKey(name: 'is_active') required this.isActive,
@JsonKey(name: 'created_at') this.createdAt,
@@ -239,10 +239,10 @@ class _$CompanyListDtoImpl implements _CompanyListDto {
final String address;
@override
@JsonKey(name: 'contact_name')
final String contactName;
final String? contactName;
@override
@JsonKey(name: 'contact_phone')
final String contactPhone;
final String? contactPhone;
@override
@JsonKey(name: 'contact_email')
final String? contactEmail;
@@ -310,8 +310,8 @@ abstract class _CompanyListDto implements CompanyListDto {
{required final int id,
required final String name,
required final String address,
@JsonKey(name: 'contact_name') required final String contactName,
@JsonKey(name: 'contact_phone') required final String contactPhone,
@JsonKey(name: 'contact_name') final String? contactName,
@JsonKey(name: 'contact_phone') final String? contactPhone,
@JsonKey(name: 'contact_email') final String? contactEmail,
@JsonKey(name: 'is_active') required final bool isActive,
@JsonKey(name: 'created_at') final DateTime? createdAt,
@@ -329,10 +329,10 @@ abstract class _CompanyListDto implements CompanyListDto {
String get address;
@override
@JsonKey(name: 'contact_name')
String get contactName;
String? get contactName;
@override
@JsonKey(name: 'contact_phone')
String get contactPhone;
String? get contactPhone;
@override
@JsonKey(name: 'contact_email')
String? get contactEmail;

View File

@@ -11,8 +11,8 @@ _$CompanyListDtoImpl _$$CompanyListDtoImplFromJson(Map<String, dynamic> json) =>
id: (json['id'] as num).toInt(),
name: json['name'] as String,
address: json['address'] as String,
contactName: json['contact_name'] as String,
contactPhone: json['contact_phone'] as String,
contactName: json['contact_name'] as String?,
contactPhone: json['contact_phone'] as String?,
contactEmail: json['contact_email'] as String?,
isActive: json['is_active'] as bool,
createdAt: json['created_at'] == null

View File

@@ -3,6 +3,44 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'license_dto.freezed.dart';
part 'license_dto.g.dart';
// 날짜를 YYYY-MM-DD 형식으로 변환하는 헬퍼 함수
String? _dateToJson(DateTime? date) {
if (date == null) return null;
return '${date.year}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}';
}
// YYYY-MM-DD 형식 문자열을 DateTime으로 변환하는 헬퍼 함수
DateTime? _dateFromJson(String? dateStr) {
if (dateStr == null || dateStr.isEmpty) return null;
try {
// YYYY-MM-DD 형식 파싱
if (dateStr.contains('-') && dateStr.length == 10) {
final parts = dateStr.split('-');
return DateTime(int.parse(parts[0]), int.parse(parts[1]), int.parse(parts[2]));
}
// ISO 8601 형식도 지원
return DateTime.parse(dateStr);
} catch (e) {
return null;
}
}
// 필수 날짜 필드용 헬퍼 함수 (항상 non-null DateTime 반환)
DateTime _requiredDateFromJson(String? dateStr) {
if (dateStr == null || dateStr.isEmpty) return DateTime.now();
try {
// YYYY-MM-DD 형식 파싱
if (dateStr.contains('-') && dateStr.length == 10) {
final parts = dateStr.split('-');
return DateTime(int.parse(parts[0]), int.parse(parts[1]), int.parse(parts[2]));
}
// ISO 8601 형식도 지원
return DateTime.parse(dateStr);
} catch (e) {
return DateTime.now();
}
}
/// 라이선스 전체 정보 DTO
@freezed
class LicenseDto with _$LicenseDto {
@@ -13,8 +51,8 @@ class LicenseDto with _$LicenseDto {
String? vendor,
@JsonKey(name: 'license_type') String? licenseType,
@JsonKey(name: 'user_count') int? userCount,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') DateTime? expiryDate,
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson) DateTime? purchaseDate,
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson) DateTime? expiryDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'branch_id') int? branchId,
@@ -54,10 +92,14 @@ class ExpiringLicenseDto with _$ExpiringLicenseDto {
required int id,
@JsonKey(name: 'license_key') required String licenseKey,
@JsonKey(name: 'product_name') String? productName,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'expiry_date') required DateTime expiryDate,
String? vendor,
@JsonKey(name: 'expiry_date', fromJson: _requiredDateFromJson) required DateTime expiryDate,
@JsonKey(name: 'days_until_expiry') required int daysUntilExpiry,
@JsonKey(name: 'is_active') required bool isActive,
@JsonKey(name: 'assigned_user_id') int? assignedUserId,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'assigned_user_name') String? assignedUserName,
@JsonKey(name: 'is_active', defaultValue: true) bool? isActive,
}) = _ExpiringLicenseDto;
factory ExpiringLicenseDto.fromJson(Map<String, dynamic> json) =>

View File

@@ -30,9 +30,9 @@ mixin _$LicenseDto {
String? get licenseType => throw _privateConstructorUsedError;
@JsonKey(name: 'user_count')
int? get userCount => throw _privateConstructorUsedError;
@JsonKey(name: 'purchase_date')
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? get purchaseDate => throw _privateConstructorUsedError;
@JsonKey(name: 'expiry_date')
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? get expiryDate => throw _privateConstructorUsedError;
@JsonKey(name: 'purchase_price')
double? get purchasePrice => throw _privateConstructorUsedError;
@@ -80,8 +80,12 @@ abstract class $LicenseDtoCopyWith<$Res> {
String? vendor,
@JsonKey(name: 'license_type') String? licenseType,
@JsonKey(name: 'user_count') int? userCount,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') DateTime? expiryDate,
@JsonKey(
name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? purchaseDate,
@JsonKey(
name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? expiryDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'branch_id') int? branchId,
@@ -226,8 +230,12 @@ abstract class _$$LicenseDtoImplCopyWith<$Res>
String? vendor,
@JsonKey(name: 'license_type') String? licenseType,
@JsonKey(name: 'user_count') int? userCount,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') DateTime? expiryDate,
@JsonKey(
name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? purchaseDate,
@JsonKey(
name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? expiryDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'branch_id') int? branchId,
@@ -365,8 +373,12 @@ class _$LicenseDtoImpl implements _LicenseDto {
this.vendor,
@JsonKey(name: 'license_type') this.licenseType,
@JsonKey(name: 'user_count') this.userCount,
@JsonKey(name: 'purchase_date') this.purchaseDate,
@JsonKey(name: 'expiry_date') this.expiryDate,
@JsonKey(
name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
this.purchaseDate,
@JsonKey(
name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
this.expiryDate,
@JsonKey(name: 'purchase_price') this.purchasePrice,
@JsonKey(name: 'company_id') this.companyId,
@JsonKey(name: 'branch_id') this.branchId,
@@ -399,10 +411,10 @@ class _$LicenseDtoImpl implements _LicenseDto {
@JsonKey(name: 'user_count')
final int? userCount;
@override
@JsonKey(name: 'purchase_date')
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
final DateTime? purchaseDate;
@override
@JsonKey(name: 'expiry_date')
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
final DateTime? expiryDate;
@override
@JsonKey(name: 'purchase_price')
@@ -534,8 +546,12 @@ abstract class _LicenseDto implements LicenseDto {
final String? vendor,
@JsonKey(name: 'license_type') final String? licenseType,
@JsonKey(name: 'user_count') final int? userCount,
@JsonKey(name: 'purchase_date') final DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') final DateTime? expiryDate,
@JsonKey(
name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
final DateTime? purchaseDate,
@JsonKey(
name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
final DateTime? expiryDate,
@JsonKey(name: 'purchase_price') final double? purchasePrice,
@JsonKey(name: 'company_id') final int? companyId,
@JsonKey(name: 'branch_id') final int? branchId,
@@ -569,10 +585,10 @@ abstract class _LicenseDto implements LicenseDto {
@JsonKey(name: 'user_count')
int? get userCount;
@override
@JsonKey(name: 'purchase_date')
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? get purchaseDate;
@override
@JsonKey(name: 'expiry_date')
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? get expiryDate;
@override
@JsonKey(name: 'purchase_price')
@@ -886,14 +902,21 @@ mixin _$ExpiringLicenseDto {
String get licenseKey => throw _privateConstructorUsedError;
@JsonKey(name: 'product_name')
String? get productName => throw _privateConstructorUsedError;
@JsonKey(name: 'company_name')
String? get companyName => throw _privateConstructorUsedError;
@JsonKey(name: 'expiry_date')
String? get vendor => throw _privateConstructorUsedError;
@JsonKey(name: 'expiry_date', fromJson: _requiredDateFromJson)
DateTime get expiryDate => throw _privateConstructorUsedError;
@JsonKey(name: 'days_until_expiry')
int get daysUntilExpiry => throw _privateConstructorUsedError;
@JsonKey(name: 'is_active')
bool get isActive => throw _privateConstructorUsedError;
@JsonKey(name: 'assigned_user_id')
int? get assignedUserId => throw _privateConstructorUsedError;
@JsonKey(name: 'company_id')
int? get companyId => throw _privateConstructorUsedError;
@JsonKey(name: 'company_name')
String? get companyName => throw _privateConstructorUsedError;
@JsonKey(name: 'assigned_user_name')
String? get assignedUserName => throw _privateConstructorUsedError;
@JsonKey(name: 'is_active', defaultValue: true)
bool? get isActive => throw _privateConstructorUsedError;
/// Serializes this ExpiringLicenseDto to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -915,10 +938,15 @@ abstract class $ExpiringLicenseDtoCopyWith<$Res> {
{int id,
@JsonKey(name: 'license_key') String licenseKey,
@JsonKey(name: 'product_name') String? productName,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'expiry_date') DateTime expiryDate,
String? vendor,
@JsonKey(name: 'expiry_date', fromJson: _requiredDateFromJson)
DateTime expiryDate,
@JsonKey(name: 'days_until_expiry') int daysUntilExpiry,
@JsonKey(name: 'is_active') bool isActive});
@JsonKey(name: 'assigned_user_id') int? assignedUserId,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'assigned_user_name') String? assignedUserName,
@JsonKey(name: 'is_active', defaultValue: true) bool? isActive});
}
/// @nodoc
@@ -939,10 +967,14 @@ class _$ExpiringLicenseDtoCopyWithImpl<$Res, $Val extends ExpiringLicenseDto>
Object? id = null,
Object? licenseKey = null,
Object? productName = freezed,
Object? companyName = freezed,
Object? vendor = freezed,
Object? expiryDate = null,
Object? daysUntilExpiry = null,
Object? isActive = null,
Object? assignedUserId = freezed,
Object? companyId = freezed,
Object? companyName = freezed,
Object? assignedUserName = freezed,
Object? isActive = freezed,
}) {
return _then(_value.copyWith(
id: null == id
@@ -957,9 +989,9 @@ class _$ExpiringLicenseDtoCopyWithImpl<$Res, $Val extends ExpiringLicenseDto>
? _value.productName
: productName // ignore: cast_nullable_to_non_nullable
as String?,
companyName: freezed == companyName
? _value.companyName
: companyName // ignore: cast_nullable_to_non_nullable
vendor: freezed == vendor
? _value.vendor
: vendor // ignore: cast_nullable_to_non_nullable
as String?,
expiryDate: null == expiryDate
? _value.expiryDate
@@ -969,10 +1001,26 @@ class _$ExpiringLicenseDtoCopyWithImpl<$Res, $Val extends ExpiringLicenseDto>
? _value.daysUntilExpiry
: daysUntilExpiry // ignore: cast_nullable_to_non_nullable
as int,
isActive: null == isActive
assignedUserId: freezed == assignedUserId
? _value.assignedUserId
: assignedUserId // ignore: cast_nullable_to_non_nullable
as int?,
companyId: freezed == companyId
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int?,
companyName: freezed == companyName
? _value.companyName
: companyName // ignore: cast_nullable_to_non_nullable
as String?,
assignedUserName: freezed == assignedUserName
? _value.assignedUserName
: assignedUserName // ignore: cast_nullable_to_non_nullable
as String?,
isActive: freezed == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool,
as bool?,
) as $Val);
}
}
@@ -989,10 +1037,15 @@ abstract class _$$ExpiringLicenseDtoImplCopyWith<$Res>
{int id,
@JsonKey(name: 'license_key') String licenseKey,
@JsonKey(name: 'product_name') String? productName,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'expiry_date') DateTime expiryDate,
String? vendor,
@JsonKey(name: 'expiry_date', fromJson: _requiredDateFromJson)
DateTime expiryDate,
@JsonKey(name: 'days_until_expiry') int daysUntilExpiry,
@JsonKey(name: 'is_active') bool isActive});
@JsonKey(name: 'assigned_user_id') int? assignedUserId,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'company_name') String? companyName,
@JsonKey(name: 'assigned_user_name') String? assignedUserName,
@JsonKey(name: 'is_active', defaultValue: true) bool? isActive});
}
/// @nodoc
@@ -1011,10 +1064,14 @@ class __$$ExpiringLicenseDtoImplCopyWithImpl<$Res>
Object? id = null,
Object? licenseKey = null,
Object? productName = freezed,
Object? companyName = freezed,
Object? vendor = freezed,
Object? expiryDate = null,
Object? daysUntilExpiry = null,
Object? isActive = null,
Object? assignedUserId = freezed,
Object? companyId = freezed,
Object? companyName = freezed,
Object? assignedUserName = freezed,
Object? isActive = freezed,
}) {
return _then(_$ExpiringLicenseDtoImpl(
id: null == id
@@ -1029,9 +1086,9 @@ class __$$ExpiringLicenseDtoImplCopyWithImpl<$Res>
? _value.productName
: productName // ignore: cast_nullable_to_non_nullable
as String?,
companyName: freezed == companyName
? _value.companyName
: companyName // ignore: cast_nullable_to_non_nullable
vendor: freezed == vendor
? _value.vendor
: vendor // ignore: cast_nullable_to_non_nullable
as String?,
expiryDate: null == expiryDate
? _value.expiryDate
@@ -1041,10 +1098,26 @@ class __$$ExpiringLicenseDtoImplCopyWithImpl<$Res>
? _value.daysUntilExpiry
: daysUntilExpiry // ignore: cast_nullable_to_non_nullable
as int,
isActive: null == isActive
assignedUserId: freezed == assignedUserId
? _value.assignedUserId
: assignedUserId // ignore: cast_nullable_to_non_nullable
as int?,
companyId: freezed == companyId
? _value.companyId
: companyId // ignore: cast_nullable_to_non_nullable
as int?,
companyName: freezed == companyName
? _value.companyName
: companyName // ignore: cast_nullable_to_non_nullable
as String?,
assignedUserName: freezed == assignedUserName
? _value.assignedUserName
: assignedUserName // ignore: cast_nullable_to_non_nullable
as String?,
isActive: freezed == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool,
as bool?,
));
}
}
@@ -1056,10 +1129,15 @@ class _$ExpiringLicenseDtoImpl implements _ExpiringLicenseDto {
{required this.id,
@JsonKey(name: 'license_key') required this.licenseKey,
@JsonKey(name: 'product_name') this.productName,
@JsonKey(name: 'company_name') this.companyName,
@JsonKey(name: 'expiry_date') required this.expiryDate,
this.vendor,
@JsonKey(name: 'expiry_date', fromJson: _requiredDateFromJson)
required this.expiryDate,
@JsonKey(name: 'days_until_expiry') required this.daysUntilExpiry,
@JsonKey(name: 'is_active') required this.isActive});
@JsonKey(name: 'assigned_user_id') this.assignedUserId,
@JsonKey(name: 'company_id') this.companyId,
@JsonKey(name: 'company_name') this.companyName,
@JsonKey(name: 'assigned_user_name') this.assignedUserName,
@JsonKey(name: 'is_active', defaultValue: true) this.isActive});
factory _$ExpiringLicenseDtoImpl.fromJson(Map<String, dynamic> json) =>
_$$ExpiringLicenseDtoImplFromJson(json);
@@ -1073,21 +1151,32 @@ class _$ExpiringLicenseDtoImpl implements _ExpiringLicenseDto {
@JsonKey(name: 'product_name')
final String? productName;
@override
@JsonKey(name: 'company_name')
final String? companyName;
final String? vendor;
@override
@JsonKey(name: 'expiry_date')
@JsonKey(name: 'expiry_date', fromJson: _requiredDateFromJson)
final DateTime expiryDate;
@override
@JsonKey(name: 'days_until_expiry')
final int daysUntilExpiry;
@override
@JsonKey(name: 'is_active')
final bool isActive;
@JsonKey(name: 'assigned_user_id')
final int? assignedUserId;
@override
@JsonKey(name: 'company_id')
final int? companyId;
@override
@JsonKey(name: 'company_name')
final String? companyName;
@override
@JsonKey(name: 'assigned_user_name')
final String? assignedUserName;
@override
@JsonKey(name: 'is_active', defaultValue: true)
final bool? isActive;
@override
String toString() {
return 'ExpiringLicenseDto(id: $id, licenseKey: $licenseKey, productName: $productName, companyName: $companyName, expiryDate: $expiryDate, daysUntilExpiry: $daysUntilExpiry, isActive: $isActive)';
return 'ExpiringLicenseDto(id: $id, licenseKey: $licenseKey, productName: $productName, vendor: $vendor, expiryDate: $expiryDate, daysUntilExpiry: $daysUntilExpiry, assignedUserId: $assignedUserId, companyId: $companyId, companyName: $companyName, assignedUserName: $assignedUserName, isActive: $isActive)';
}
@override
@@ -1100,20 +1189,38 @@ class _$ExpiringLicenseDtoImpl implements _ExpiringLicenseDto {
other.licenseKey == licenseKey) &&
(identical(other.productName, productName) ||
other.productName == productName) &&
(identical(other.companyName, companyName) ||
other.companyName == companyName) &&
(identical(other.vendor, vendor) || other.vendor == vendor) &&
(identical(other.expiryDate, expiryDate) ||
other.expiryDate == expiryDate) &&
(identical(other.daysUntilExpiry, daysUntilExpiry) ||
other.daysUntilExpiry == daysUntilExpiry) &&
(identical(other.assignedUserId, assignedUserId) ||
other.assignedUserId == assignedUserId) &&
(identical(other.companyId, companyId) ||
other.companyId == companyId) &&
(identical(other.companyName, companyName) ||
other.companyName == companyName) &&
(identical(other.assignedUserName, assignedUserName) ||
other.assignedUserName == assignedUserName) &&
(identical(other.isActive, isActive) ||
other.isActive == isActive));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, licenseKey, productName,
companyName, expiryDate, daysUntilExpiry, isActive);
int get hashCode => Object.hash(
runtimeType,
id,
licenseKey,
productName,
vendor,
expiryDate,
daysUntilExpiry,
assignedUserId,
companyId,
companyName,
assignedUserName,
isActive);
/// Create a copy of ExpiringLicenseDto
/// with the given fields replaced by the non-null parameter values.
@@ -1137,11 +1244,16 @@ abstract class _ExpiringLicenseDto implements ExpiringLicenseDto {
{required final int id,
@JsonKey(name: 'license_key') required final String licenseKey,
@JsonKey(name: 'product_name') final String? productName,
@JsonKey(name: 'company_name') final String? companyName,
@JsonKey(name: 'expiry_date') required final DateTime expiryDate,
final String? vendor,
@JsonKey(name: 'expiry_date', fromJson: _requiredDateFromJson)
required final DateTime expiryDate,
@JsonKey(name: 'days_until_expiry') required final int daysUntilExpiry,
@JsonKey(name: 'is_active')
required final bool isActive}) = _$ExpiringLicenseDtoImpl;
@JsonKey(name: 'assigned_user_id') final int? assignedUserId,
@JsonKey(name: 'company_id') final int? companyId,
@JsonKey(name: 'company_name') final String? companyName,
@JsonKey(name: 'assigned_user_name') final String? assignedUserName,
@JsonKey(name: 'is_active', defaultValue: true)
final bool? isActive}) = _$ExpiringLicenseDtoImpl;
factory _ExpiringLicenseDto.fromJson(Map<String, dynamic> json) =
_$ExpiringLicenseDtoImpl.fromJson;
@@ -1155,17 +1267,28 @@ abstract class _ExpiringLicenseDto implements ExpiringLicenseDto {
@JsonKey(name: 'product_name')
String? get productName;
@override
@JsonKey(name: 'company_name')
String? get companyName;
String? get vendor;
@override
@JsonKey(name: 'expiry_date')
@JsonKey(name: 'expiry_date', fromJson: _requiredDateFromJson)
DateTime get expiryDate;
@override
@JsonKey(name: 'days_until_expiry')
int get daysUntilExpiry;
@override
@JsonKey(name: 'is_active')
bool get isActive;
@JsonKey(name: 'assigned_user_id')
int? get assignedUserId;
@override
@JsonKey(name: 'company_id')
int? get companyId;
@override
@JsonKey(name: 'company_name')
String? get companyName;
@override
@JsonKey(name: 'assigned_user_name')
String? get assignedUserName;
@override
@JsonKey(name: 'is_active', defaultValue: true)
bool? get isActive;
/// Create a copy of ExpiringLicenseDto
/// with the given fields replaced by the non-null parameter values.

View File

@@ -14,12 +14,8 @@ _$LicenseDtoImpl _$$LicenseDtoImplFromJson(Map<String, dynamic> json) =>
vendor: json['vendor'] as String?,
licenseType: json['license_type'] as String?,
userCount: (json['user_count'] as num?)?.toInt(),
purchaseDate: json['purchase_date'] == null
? null
: DateTime.parse(json['purchase_date'] as String),
expiryDate: json['expiry_date'] == null
? null
: DateTime.parse(json['expiry_date'] as String),
purchaseDate: _dateFromJson(json['purchase_date'] as String?),
expiryDate: _dateFromJson(json['expiry_date'] as String?),
purchasePrice: (json['purchase_price'] as num?)?.toDouble(),
companyId: (json['company_id'] as num?)?.toInt(),
branchId: (json['branch_id'] as num?)?.toInt(),
@@ -41,8 +37,8 @@ Map<String, dynamic> _$$LicenseDtoImplToJson(_$LicenseDtoImpl instance) =>
'vendor': instance.vendor,
'license_type': instance.licenseType,
'user_count': instance.userCount,
'purchase_date': instance.purchaseDate?.toIso8601String(),
'expiry_date': instance.expiryDate?.toIso8601String(),
'purchase_date': _dateToJson(instance.purchaseDate),
'expiry_date': _dateToJson(instance.expiryDate),
'purchase_price': instance.purchasePrice,
'company_id': instance.companyId,
'branch_id': instance.branchId,
@@ -84,10 +80,14 @@ _$ExpiringLicenseDtoImpl _$$ExpiringLicenseDtoImplFromJson(
id: (json['id'] as num).toInt(),
licenseKey: json['license_key'] as String,
productName: json['product_name'] as String?,
companyName: json['company_name'] as String?,
expiryDate: DateTime.parse(json['expiry_date'] as String),
vendor: json['vendor'] as String?,
expiryDate: _requiredDateFromJson(json['expiry_date'] as String?),
daysUntilExpiry: (json['days_until_expiry'] as num).toInt(),
isActive: json['is_active'] as bool,
assignedUserId: (json['assigned_user_id'] as num?)?.toInt(),
companyId: (json['company_id'] as num?)?.toInt(),
companyName: json['company_name'] as String?,
assignedUserName: json['assigned_user_name'] as String?,
isActive: json['is_active'] as bool? ?? true,
);
Map<String, dynamic> _$$ExpiringLicenseDtoImplToJson(
@@ -96,9 +96,13 @@ Map<String, dynamic> _$$ExpiringLicenseDtoImplToJson(
'id': instance.id,
'license_key': instance.licenseKey,
'product_name': instance.productName,
'company_name': instance.companyName,
'vendor': instance.vendor,
'expiry_date': instance.expiryDate.toIso8601String(),
'days_until_expiry': instance.daysUntilExpiry,
'assigned_user_id': instance.assignedUserId,
'company_id': instance.companyId,
'company_name': instance.companyName,
'assigned_user_name': instance.assignedUserName,
'is_active': instance.isActive,
};

View File

@@ -3,6 +3,28 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'license_request_dto.freezed.dart';
part 'license_request_dto.g.dart';
// 날짜를 YYYY-MM-DD 형식으로 변환하는 헬퍼 함수
String? _dateToJson(DateTime? date) {
if (date == null) return null;
return '${date.year}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}';
}
// YYYY-MM-DD 형식 문자열을 DateTime으로 변환하는 헬퍼 함수
DateTime? _dateFromJson(String? dateStr) {
if (dateStr == null || dateStr.isEmpty) return null;
try {
// YYYY-MM-DD 형식 파싱
if (dateStr.contains('-') && dateStr.length == 10) {
final parts = dateStr.split('-');
return DateTime(int.parse(parts[0]), int.parse(parts[1]), int.parse(parts[2]));
}
// ISO 8601 형식도 지원
return DateTime.parse(dateStr);
} catch (e) {
return null;
}
}
/// 라이선스 생성 요청 DTO
@freezed
class CreateLicenseRequest with _$CreateLicenseRequest {
@@ -12,8 +34,8 @@ class CreateLicenseRequest with _$CreateLicenseRequest {
String? vendor,
@JsonKey(name: 'license_type') String? licenseType,
@JsonKey(name: 'user_count') int? userCount,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') DateTime? expiryDate,
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson) DateTime? purchaseDate,
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson) DateTime? expiryDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'branch_id') int? branchId,
@@ -32,8 +54,8 @@ class UpdateLicenseRequest with _$UpdateLicenseRequest {
String? vendor,
@JsonKey(name: 'license_type') String? licenseType,
@JsonKey(name: 'user_count') int? userCount,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') DateTime? expiryDate,
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson) DateTime? purchaseDate,
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson) DateTime? expiryDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
String? remark,
@JsonKey(name: 'is_active') bool? isActive,

View File

@@ -29,9 +29,9 @@ mixin _$CreateLicenseRequest {
String? get licenseType => throw _privateConstructorUsedError;
@JsonKey(name: 'user_count')
int? get userCount => throw _privateConstructorUsedError;
@JsonKey(name: 'purchase_date')
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? get purchaseDate => throw _privateConstructorUsedError;
@JsonKey(name: 'expiry_date')
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? get expiryDate => throw _privateConstructorUsedError;
@JsonKey(name: 'purchase_price')
double? get purchasePrice => throw _privateConstructorUsedError;
@@ -63,8 +63,12 @@ abstract class $CreateLicenseRequestCopyWith<$Res> {
String? vendor,
@JsonKey(name: 'license_type') String? licenseType,
@JsonKey(name: 'user_count') int? userCount,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') DateTime? expiryDate,
@JsonKey(
name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? purchaseDate,
@JsonKey(
name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? expiryDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'branch_id') int? branchId,
@@ -162,8 +166,12 @@ abstract class _$$CreateLicenseRequestImplCopyWith<$Res>
String? vendor,
@JsonKey(name: 'license_type') String? licenseType,
@JsonKey(name: 'user_count') int? userCount,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') DateTime? expiryDate,
@JsonKey(
name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? purchaseDate,
@JsonKey(
name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? expiryDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
@JsonKey(name: 'company_id') int? companyId,
@JsonKey(name: 'branch_id') int? branchId,
@@ -253,8 +261,12 @@ class _$CreateLicenseRequestImpl implements _CreateLicenseRequest {
this.vendor,
@JsonKey(name: 'license_type') this.licenseType,
@JsonKey(name: 'user_count') this.userCount,
@JsonKey(name: 'purchase_date') this.purchaseDate,
@JsonKey(name: 'expiry_date') this.expiryDate,
@JsonKey(
name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
this.purchaseDate,
@JsonKey(
name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
this.expiryDate,
@JsonKey(name: 'purchase_price') this.purchasePrice,
@JsonKey(name: 'company_id') this.companyId,
@JsonKey(name: 'branch_id') this.branchId,
@@ -278,10 +290,10 @@ class _$CreateLicenseRequestImpl implements _CreateLicenseRequest {
@JsonKey(name: 'user_count')
final int? userCount;
@override
@JsonKey(name: 'purchase_date')
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
final DateTime? purchaseDate;
@override
@JsonKey(name: 'expiry_date')
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
final DateTime? expiryDate;
@override
@JsonKey(name: 'purchase_price')
@@ -368,8 +380,12 @@ abstract class _CreateLicenseRequest implements CreateLicenseRequest {
final String? vendor,
@JsonKey(name: 'license_type') final String? licenseType,
@JsonKey(name: 'user_count') final int? userCount,
@JsonKey(name: 'purchase_date') final DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') final DateTime? expiryDate,
@JsonKey(
name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
final DateTime? purchaseDate,
@JsonKey(
name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
final DateTime? expiryDate,
@JsonKey(name: 'purchase_price') final double? purchasePrice,
@JsonKey(name: 'company_id') final int? companyId,
@JsonKey(name: 'branch_id') final int? branchId,
@@ -393,10 +409,10 @@ abstract class _CreateLicenseRequest implements CreateLicenseRequest {
@JsonKey(name: 'user_count')
int? get userCount;
@override
@JsonKey(name: 'purchase_date')
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? get purchaseDate;
@override
@JsonKey(name: 'expiry_date')
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? get expiryDate;
@override
@JsonKey(name: 'purchase_price')
@@ -433,9 +449,9 @@ mixin _$UpdateLicenseRequest {
String? get licenseType => throw _privateConstructorUsedError;
@JsonKey(name: 'user_count')
int? get userCount => throw _privateConstructorUsedError;
@JsonKey(name: 'purchase_date')
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? get purchaseDate => throw _privateConstructorUsedError;
@JsonKey(name: 'expiry_date')
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? get expiryDate => throw _privateConstructorUsedError;
@JsonKey(name: 'purchase_price')
double? get purchasePrice => throw _privateConstructorUsedError;
@@ -465,8 +481,12 @@ abstract class $UpdateLicenseRequestCopyWith<$Res> {
String? vendor,
@JsonKey(name: 'license_type') String? licenseType,
@JsonKey(name: 'user_count') int? userCount,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') DateTime? expiryDate,
@JsonKey(
name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? purchaseDate,
@JsonKey(
name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? expiryDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
String? remark,
@JsonKey(name: 'is_active') bool? isActive});
@@ -558,8 +578,12 @@ abstract class _$$UpdateLicenseRequestImplCopyWith<$Res>
String? vendor,
@JsonKey(name: 'license_type') String? licenseType,
@JsonKey(name: 'user_count') int? userCount,
@JsonKey(name: 'purchase_date') DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') DateTime? expiryDate,
@JsonKey(
name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? purchaseDate,
@JsonKey(
name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? expiryDate,
@JsonKey(name: 'purchase_price') double? purchasePrice,
String? remark,
@JsonKey(name: 'is_active') bool? isActive});
@@ -643,8 +667,12 @@ class _$UpdateLicenseRequestImpl implements _UpdateLicenseRequest {
this.vendor,
@JsonKey(name: 'license_type') this.licenseType,
@JsonKey(name: 'user_count') this.userCount,
@JsonKey(name: 'purchase_date') this.purchaseDate,
@JsonKey(name: 'expiry_date') this.expiryDate,
@JsonKey(
name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
this.purchaseDate,
@JsonKey(
name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
this.expiryDate,
@JsonKey(name: 'purchase_price') this.purchasePrice,
this.remark,
@JsonKey(name: 'is_active') this.isActive});
@@ -667,10 +695,10 @@ class _$UpdateLicenseRequestImpl implements _UpdateLicenseRequest {
@JsonKey(name: 'user_count')
final int? userCount;
@override
@JsonKey(name: 'purchase_date')
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
final DateTime? purchaseDate;
@override
@JsonKey(name: 'expiry_date')
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
final DateTime? expiryDate;
@override
@JsonKey(name: 'purchase_price')
@@ -746,17 +774,21 @@ class _$UpdateLicenseRequestImpl implements _UpdateLicenseRequest {
abstract class _UpdateLicenseRequest implements UpdateLicenseRequest {
const factory _UpdateLicenseRequest(
{@JsonKey(name: 'license_key') final String? licenseKey,
@JsonKey(name: 'product_name') final String? productName,
final String? vendor,
@JsonKey(name: 'license_type') final String? licenseType,
@JsonKey(name: 'user_count') final int? userCount,
@JsonKey(name: 'purchase_date') final DateTime? purchaseDate,
@JsonKey(name: 'expiry_date') final DateTime? expiryDate,
@JsonKey(name: 'purchase_price') final double? purchasePrice,
final String? remark,
@JsonKey(name: 'is_active') final bool? isActive}) =
_$UpdateLicenseRequestImpl;
{@JsonKey(name: 'license_key') final String? licenseKey,
@JsonKey(name: 'product_name') final String? productName,
final String? vendor,
@JsonKey(name: 'license_type') final String? licenseType,
@JsonKey(name: 'user_count') final int? userCount,
@JsonKey(
name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
final DateTime? purchaseDate,
@JsonKey(
name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
final DateTime? expiryDate,
@JsonKey(name: 'purchase_price') final double? purchasePrice,
final String? remark,
@JsonKey(name: 'is_active')
final bool? isActive}) = _$UpdateLicenseRequestImpl;
factory _UpdateLicenseRequest.fromJson(Map<String, dynamic> json) =
_$UpdateLicenseRequestImpl.fromJson;
@@ -776,10 +808,10 @@ abstract class _UpdateLicenseRequest implements UpdateLicenseRequest {
@JsonKey(name: 'user_count')
int? get userCount;
@override
@JsonKey(name: 'purchase_date')
@JsonKey(name: 'purchase_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? get purchaseDate;
@override
@JsonKey(name: 'expiry_date')
@JsonKey(name: 'expiry_date', toJson: _dateToJson, fromJson: _dateFromJson)
DateTime? get expiryDate;
@override
@JsonKey(name: 'purchase_price')

View File

@@ -14,12 +14,8 @@ _$CreateLicenseRequestImpl _$$CreateLicenseRequestImplFromJson(
vendor: json['vendor'] as String?,
licenseType: json['license_type'] as String?,
userCount: (json['user_count'] as num?)?.toInt(),
purchaseDate: json['purchase_date'] == null
? null
: DateTime.parse(json['purchase_date'] as String),
expiryDate: json['expiry_date'] == null
? null
: DateTime.parse(json['expiry_date'] as String),
purchaseDate: _dateFromJson(json['purchase_date'] as String?),
expiryDate: _dateFromJson(json['expiry_date'] as String?),
purchasePrice: (json['purchase_price'] as num?)?.toDouble(),
companyId: (json['company_id'] as num?)?.toInt(),
branchId: (json['branch_id'] as num?)?.toInt(),
@@ -34,8 +30,8 @@ Map<String, dynamic> _$$CreateLicenseRequestImplToJson(
'vendor': instance.vendor,
'license_type': instance.licenseType,
'user_count': instance.userCount,
'purchase_date': instance.purchaseDate?.toIso8601String(),
'expiry_date': instance.expiryDate?.toIso8601String(),
'purchase_date': _dateToJson(instance.purchaseDate),
'expiry_date': _dateToJson(instance.expiryDate),
'purchase_price': instance.purchasePrice,
'company_id': instance.companyId,
'branch_id': instance.branchId,
@@ -50,12 +46,8 @@ _$UpdateLicenseRequestImpl _$$UpdateLicenseRequestImplFromJson(
vendor: json['vendor'] as String?,
licenseType: json['license_type'] as String?,
userCount: (json['user_count'] as num?)?.toInt(),
purchaseDate: json['purchase_date'] == null
? null
: DateTime.parse(json['purchase_date'] as String),
expiryDate: json['expiry_date'] == null
? null
: DateTime.parse(json['expiry_date'] as String),
purchaseDate: _dateFromJson(json['purchase_date'] as String?),
expiryDate: _dateFromJson(json['expiry_date'] as String?),
purchasePrice: (json['purchase_price'] as num?)?.toDouble(),
remark: json['remark'] as String?,
isActive: json['is_active'] as bool?,
@@ -69,8 +61,8 @@ Map<String, dynamic> _$$UpdateLicenseRequestImplToJson(
'vendor': instance.vendor,
'license_type': instance.licenseType,
'user_count': instance.userCount,
'purchase_date': instance.purchaseDate?.toIso8601String(),
'expiry_date': instance.expiryDate?.toIso8601String(),
'purchase_date': _dateToJson(instance.purchaseDate),
'expiry_date': _dateToJson(instance.expiryDate),
'purchase_price': instance.purchasePrice,
'remark': instance.remark,
'is_active': instance.isActive,