refactor: 프로젝트 구조 개선 및 테스트 시스템 강화
주요 변경사항: - 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:
@@ -1,4 +1,5 @@
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:superport/core/errors/exceptions.dart';
|
||||
import 'package:superport/core/errors/failures.dart';
|
||||
@@ -22,6 +23,19 @@ class LicenseService {
|
||||
int? assignedUserId,
|
||||
String? licenseType,
|
||||
}) async {
|
||||
debugPrint('\n╔════════════════════════════════════════════════════════════');
|
||||
debugPrint('║ 📤 LICENSE API REQUEST');
|
||||
debugPrint('╟────────────────────────────────────────────────────────────');
|
||||
debugPrint('║ Endpoint: GET /licenses');
|
||||
debugPrint('║ Parameters:');
|
||||
debugPrint('║ - page: $page');
|
||||
debugPrint('║ - perPage: $perPage');
|
||||
if (isActive != null) debugPrint('║ - isActive: $isActive');
|
||||
if (companyId != null) debugPrint('║ - companyId: $companyId');
|
||||
if (assignedUserId != null) debugPrint('║ - assignedUserId: $assignedUserId');
|
||||
if (licenseType != null) debugPrint('║ - licenseType: $licenseType');
|
||||
debugPrint('╚════════════════════════════════════════════════════════════\n');
|
||||
|
||||
try {
|
||||
final response = await _remoteDataSource.getLicenses(
|
||||
page: page,
|
||||
@@ -32,10 +46,41 @@ class LicenseService {
|
||||
licenseType: licenseType,
|
||||
);
|
||||
|
||||
return response.items.map((dto) => _convertDtoToLicense(dto)).toList();
|
||||
final licenses = response.items.map((dto) => _convertDtoToLicense(dto)).toList();
|
||||
|
||||
debugPrint('\n╔════════════════════════════════════════════════════════════');
|
||||
debugPrint('║ 📥 LICENSE API RESPONSE');
|
||||
debugPrint('╟────────────────────────────────────────────────────────────');
|
||||
debugPrint('║ Status: SUCCESS');
|
||||
debugPrint('║ Total Items: ${response.total}');
|
||||
debugPrint('║ Current Page: ${response.page}');
|
||||
debugPrint('║ Total Pages: ${response.totalPages}');
|
||||
debugPrint('║ Returned Items: ${licenses.length}');
|
||||
if (licenses.isNotEmpty) {
|
||||
debugPrint('║ Sample Data:');
|
||||
final sample = licenses.first;
|
||||
debugPrint('║ - ID: ${sample.id}');
|
||||
debugPrint('║ - Product: ${sample.productName}');
|
||||
debugPrint('║ - Company: ${sample.companyName ?? "N/A"}');
|
||||
}
|
||||
debugPrint('╚════════════════════════════════════════════════════════════\n');
|
||||
|
||||
return licenses;
|
||||
} on ApiException catch (e) {
|
||||
debugPrint('\n╔════════════════════════════════════════════════════════════');
|
||||
debugPrint('║ ❌ LICENSE API ERROR');
|
||||
debugPrint('╟────────────────────────────────────────────────────────────');
|
||||
debugPrint('║ Type: ApiException');
|
||||
debugPrint('║ Message: ${e.message}');
|
||||
debugPrint('╚════════════════════════════════════════════════════════════\n');
|
||||
throw ServerFailure(message: e.message);
|
||||
} catch (e) {
|
||||
debugPrint('\n╔════════════════════════════════════════════════════════════');
|
||||
debugPrint('║ ❌ LICENSE API ERROR');
|
||||
debugPrint('╟────────────────────────────────────────────────────────────');
|
||||
debugPrint('║ Type: Unknown');
|
||||
debugPrint('║ Error: $e');
|
||||
debugPrint('╚════════════════════════════════════════════════════════════\n');
|
||||
throw ServerFailure(message: '라이선스 목록을 불러오는 데 실패했습니다: $e');
|
||||
}
|
||||
}
|
||||
@@ -54,6 +99,18 @@ class LicenseService {
|
||||
|
||||
// 라이선스 생성
|
||||
Future<License> createLicense(License license) async {
|
||||
debugPrint('\n╔════════════════════════════════════════════════════════════');
|
||||
debugPrint('║ 📤 LICENSE CREATE REQUEST');
|
||||
debugPrint('╟────────────────────────────────────────────────────────────');
|
||||
debugPrint('║ Endpoint: POST /licenses');
|
||||
debugPrint('║ Request Data:');
|
||||
debugPrint('║ - licenseKey: ${license.licenseKey}');
|
||||
debugPrint('║ - productName: ${license.productName}');
|
||||
debugPrint('║ - vendor: ${license.vendor}');
|
||||
debugPrint('║ - companyId: ${license.companyId}');
|
||||
debugPrint('║ - expiryDate: ${license.expiryDate?.toIso8601String()}');
|
||||
debugPrint('╚════════════════════════════════════════════════════════════\n');
|
||||
|
||||
try {
|
||||
final request = CreateLicenseRequest(
|
||||
licenseKey: license.licenseKey,
|
||||
@@ -70,10 +127,34 @@ class LicenseService {
|
||||
);
|
||||
|
||||
final dto = await _remoteDataSource.createLicense(request);
|
||||
return _convertDtoToLicense(dto);
|
||||
final createdLicense = _convertDtoToLicense(dto);
|
||||
|
||||
debugPrint('\n╔════════════════════════════════════════════════════════════');
|
||||
debugPrint('║ 📥 LICENSE CREATE RESPONSE');
|
||||
debugPrint('╟────────────────────────────────────────────────────────────');
|
||||
debugPrint('║ Status: SUCCESS');
|
||||
debugPrint('║ Created License:');
|
||||
debugPrint('║ - ID: ${createdLicense.id}');
|
||||
debugPrint('║ - Key: ${createdLicense.licenseKey}');
|
||||
debugPrint('║ - Product: ${createdLicense.productName}');
|
||||
debugPrint('╚════════════════════════════════════════════════════════════\n');
|
||||
|
||||
return createdLicense;
|
||||
} on ApiException catch (e) {
|
||||
debugPrint('\n╔════════════════════════════════════════════════════════════');
|
||||
debugPrint('║ ❌ LICENSE CREATE ERROR');
|
||||
debugPrint('╟────────────────────────────────────────────────────────────');
|
||||
debugPrint('║ Type: ApiException');
|
||||
debugPrint('║ Message: ${e.message}');
|
||||
debugPrint('╚════════════════════════════════════════════════════════════\n');
|
||||
throw ServerFailure(message: e.message);
|
||||
} catch (e) {
|
||||
debugPrint('\n╔════════════════════════════════════════════════════════════');
|
||||
debugPrint('║ ❌ LICENSE CREATE ERROR');
|
||||
debugPrint('╟────────────────────────────────────────────────────────────');
|
||||
debugPrint('║ Type: Unknown');
|
||||
debugPrint('║ Error: $e');
|
||||
debugPrint('╚════════════════════════════════════════════════════════════\n');
|
||||
throw ServerFailure(message: '라이선스 생성에 실패했습니다: $e');
|
||||
}
|
||||
}
|
||||
@@ -180,7 +261,7 @@ class LicenseService {
|
||||
branchId: dto.branchId,
|
||||
assignedUserId: dto.assignedUserId,
|
||||
remark: dto.remark,
|
||||
isActive: dto.isActive,
|
||||
isActive: dto.isActive ?? true,
|
||||
createdAt: dto.createdAt,
|
||||
updatedAt: dto.updatedAt,
|
||||
companyName: dto.companyName,
|
||||
@@ -205,7 +286,7 @@ class LicenseService {
|
||||
branchId: null,
|
||||
assignedUserId: null,
|
||||
remark: null,
|
||||
isActive: dto.isActive,
|
||||
isActive: dto.isActive ?? true,
|
||||
createdAt: null,
|
||||
updatedAt: null,
|
||||
companyName: dto.companyName,
|
||||
|
||||
Reference in New Issue
Block a user