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,6 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
@@ -47,16 +49,16 @@ class AuthServiceImpl implements AuthService {
|
||||
@override
|
||||
Future<Either<Failure, LoginResponse>> login(LoginRequest request) async {
|
||||
try {
|
||||
print('[AuthService] login 시작 - useApi: ${env.Environment.useApi}');
|
||||
debugPrint('[AuthService] login 시작 - useApi: ${env.Environment.useApi}');
|
||||
|
||||
// Mock 모드일 때
|
||||
if (!env.Environment.useApi) {
|
||||
print('[AuthService] Mock 모드로 로그인 처리');
|
||||
debugPrint('[AuthService] Mock 모드로 로그인 처리');
|
||||
return _mockLogin(request);
|
||||
}
|
||||
|
||||
// API 모드일 때
|
||||
print('[AuthService] API 모드로 로그인 처리');
|
||||
debugPrint('[AuthService] API 모드로 로그인 처리');
|
||||
final result = await _authRemoteDataSource.login(request);
|
||||
|
||||
return await result.fold(
|
||||
@@ -77,8 +79,8 @@ class AuthServiceImpl implements AuthService {
|
||||
},
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
print('[AuthService] login 예외 발생: $e');
|
||||
print('[AuthService] Stack trace: $stackTrace');
|
||||
debugPrint('[AuthService] login 예외 발생: $e');
|
||||
debugPrint('[AuthService] Stack trace: $stackTrace');
|
||||
return Left(ServerFailure(message: '로그인 처리 중 오류가 발생했습니다.'));
|
||||
}
|
||||
}
|
||||
@@ -130,10 +132,10 @@ class AuthServiceImpl implements AuthService {
|
||||
// 인증 상태 변경 알림
|
||||
_authStateController.add(true);
|
||||
|
||||
print('[AuthService] Mock 로그인 성공');
|
||||
debugPrint('[AuthService] Mock 로그인 성공');
|
||||
return Right(loginResponse);
|
||||
} catch (e) {
|
||||
print('[AuthService] Mock 로그인 실패: $e');
|
||||
debugPrint('[AuthService] Mock 로그인 실패: $e');
|
||||
return Left(ServerFailure(message: '로그인 처리 중 오류가 발생했습니다.'));
|
||||
}
|
||||
}
|
||||
@@ -235,15 +237,15 @@ class AuthServiceImpl implements AuthService {
|
||||
try {
|
||||
final token = await _secureStorage.read(key: _accessTokenKey);
|
||||
if (token != null && token.length > 20) {
|
||||
print('[AuthService] getAccessToken: Found (${token.substring(0, 20)}...)');
|
||||
debugPrint('[AuthService] getAccessToken: Found (${token.substring(0, 20)}...)');
|
||||
} else if (token != null) {
|
||||
print('[AuthService] getAccessToken: Found (${token})');
|
||||
debugPrint('[AuthService] getAccessToken: Found (${token})');
|
||||
} else {
|
||||
print('[AuthService] getAccessToken: Not found');
|
||||
debugPrint('[AuthService] getAccessToken: Not found');
|
||||
}
|
||||
return token;
|
||||
} catch (e) {
|
||||
print('[AuthService] getAccessToken error: $e');
|
||||
debugPrint('[AuthService] getAccessToken error: $e');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -277,12 +279,12 @@ class AuthServiceImpl implements AuthService {
|
||||
String refreshToken,
|
||||
int expiresIn,
|
||||
) async {
|
||||
print('[AuthService] Saving tokens...');
|
||||
debugPrint('[AuthService] Saving tokens...');
|
||||
final accessTokenPreview = accessToken.length > 20 ? '${accessToken.substring(0, 20)}...' : accessToken;
|
||||
final refreshTokenPreview = refreshToken.length > 20 ? '${refreshToken.substring(0, 20)}...' : refreshToken;
|
||||
print('[AuthService] Access token: $accessTokenPreview');
|
||||
print('[AuthService] Refresh token: $refreshTokenPreview');
|
||||
print('[AuthService] Expires in: $expiresIn seconds');
|
||||
debugPrint('[AuthService] Access token: $accessTokenPreview');
|
||||
debugPrint('[AuthService] Refresh token: $refreshTokenPreview');
|
||||
debugPrint('[AuthService] Expires in: $expiresIn seconds');
|
||||
|
||||
await _secureStorage.write(key: _accessTokenKey, value: accessToken);
|
||||
await _secureStorage.write(key: _refreshTokenKey, value: refreshToken);
|
||||
@@ -294,7 +296,7 @@ class AuthServiceImpl implements AuthService {
|
||||
value: expiry.toIso8601String(),
|
||||
);
|
||||
|
||||
print('[AuthService] Tokens saved successfully');
|
||||
debugPrint('[AuthService] Tokens saved successfully');
|
||||
}
|
||||
|
||||
Future<void> _saveUser(AuthUser user) async {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:superport/core/errors/exceptions.dart';
|
||||
import 'package:superport/core/errors/failures.dart';
|
||||
@@ -31,11 +32,11 @@ class CompanyService {
|
||||
|
||||
return response.items.map((dto) => _convertListDtoToCompany(dto)).toList();
|
||||
} on ApiException catch (e) {
|
||||
print('[CompanyService] ApiException: ${e.message}');
|
||||
debugPrint('[CompanyService] ApiException: ${e.message}');
|
||||
throw ServerFailure(message: e.message);
|
||||
} catch (e, stackTrace) {
|
||||
print('[CompanyService] Error loading companies: $e');
|
||||
print('[CompanyService] Stack trace: $stackTrace');
|
||||
debugPrint('[CompanyService] Error loading companies: $e');
|
||||
debugPrint('[CompanyService] Stack trace: $stackTrace');
|
||||
throw ServerFailure(message: 'Failed to fetch company list: $e');
|
||||
}
|
||||
}
|
||||
@@ -54,11 +55,16 @@ class CompanyService {
|
||||
remark: company.remark,
|
||||
);
|
||||
|
||||
debugPrint('[CompanyService] Creating company with request: ${request.toJson()}');
|
||||
final response = await _remoteDataSource.createCompany(request);
|
||||
debugPrint('[CompanyService] Company created with ID: ${response.id}');
|
||||
return _convertResponseToCompany(response);
|
||||
} on ApiException catch (e) {
|
||||
debugPrint('[CompanyService] ApiException during company creation: ${e.message}');
|
||||
throw ServerFailure(message: e.message);
|
||||
} catch (e) {
|
||||
} catch (e, stackTrace) {
|
||||
debugPrint('[CompanyService] Unexpected error during company creation: $e');
|
||||
debugPrint('[CompanyService] Stack trace: $stackTrace');
|
||||
throw ServerFailure(message: 'Failed to create company: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ class EquipmentService {
|
||||
String? status,
|
||||
int? companyId,
|
||||
int? warehouseLocationId,
|
||||
String? search,
|
||||
}) async {
|
||||
try {
|
||||
final dtoList = await _remoteDataSource.getEquipments(
|
||||
@@ -29,6 +30,7 @@ class EquipmentService {
|
||||
status: status,
|
||||
companyId: companyId,
|
||||
warehouseLocationId: warehouseLocationId,
|
||||
search: search,
|
||||
);
|
||||
|
||||
return dtoList;
|
||||
@@ -46,6 +48,7 @@ class EquipmentService {
|
||||
String? status,
|
||||
int? companyId,
|
||||
int? warehouseLocationId,
|
||||
String? search,
|
||||
}) async {
|
||||
try {
|
||||
final dtoList = await _remoteDataSource.getEquipments(
|
||||
@@ -54,6 +57,7 @@ class EquipmentService {
|
||||
status: status,
|
||||
companyId: companyId,
|
||||
warehouseLocationId: warehouseLocationId,
|
||||
search: search,
|
||||
);
|
||||
|
||||
return dtoList.map((dto) => _convertListDtoToEquipment(dto)).toList();
|
||||
|
||||
@@ -20,14 +20,14 @@ class HealthCheckService {
|
||||
/// 헬스체크 API 호출
|
||||
Future<Map<String, dynamic>> checkHealth() async {
|
||||
try {
|
||||
print('=== 헬스체크 시작 ===');
|
||||
print('API Base URL: ${Environment.apiBaseUrl}');
|
||||
print('Full URL: ${Environment.apiBaseUrl}/health');
|
||||
debugPrint('=== 헬스체크 시작 ===');
|
||||
debugPrint('API Base URL: ${Environment.apiBaseUrl}');
|
||||
debugPrint('Full URL: ${Environment.apiBaseUrl}/health');
|
||||
|
||||
final response = await _apiClient.get('/health');
|
||||
|
||||
print('응답 상태 코드: ${response.statusCode}');
|
||||
print('응답 데이터: ${response.data}');
|
||||
debugPrint('응답 상태 코드: ${response.statusCode}');
|
||||
debugPrint('응답 데이터: ${response.data}');
|
||||
|
||||
return {
|
||||
'success': true,
|
||||
@@ -35,16 +35,16 @@ class HealthCheckService {
|
||||
'statusCode': response.statusCode,
|
||||
};
|
||||
} on DioException catch (e) {
|
||||
print('=== DioException 발생 ===');
|
||||
print('에러 타입: ${e.type}');
|
||||
print('에러 메시지: ${e.message}');
|
||||
print('에러 응답: ${e.response?.data}');
|
||||
print('에러 상태 코드: ${e.response?.statusCode}');
|
||||
debugPrint('=== DioException 발생 ===');
|
||||
debugPrint('에러 타입: ${e.type}');
|
||||
debugPrint('에러 메시지: ${e.message}');
|
||||
debugPrint('에러 응답: ${e.response?.data}');
|
||||
debugPrint('에러 상태 코드: ${e.response?.statusCode}');
|
||||
|
||||
// CORS 에러인지 확인
|
||||
if (e.type == DioExceptionType.connectionError ||
|
||||
e.type == DioExceptionType.unknown) {
|
||||
print('⚠️ CORS 또는 네트워크 연결 문제일 가능성이 있습니다.');
|
||||
debugPrint('⚠️ CORS 또는 네트워크 연결 문제일 가능성이 있습니다.');
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -55,8 +55,8 @@ class HealthCheckService {
|
||||
'responseData': e.response?.data,
|
||||
};
|
||||
} catch (e) {
|
||||
print('=== 일반 에러 발생 ===');
|
||||
print('에러: $e');
|
||||
debugPrint('=== 일반 에러 발생 ===');
|
||||
debugPrint('에러: $e');
|
||||
|
||||
return {
|
||||
'success': false,
|
||||
@@ -68,7 +68,7 @@ class HealthCheckService {
|
||||
/// 직접 Dio로 테스트 (인터셉터 없이)
|
||||
Future<Map<String, dynamic>> checkHealthDirect() async {
|
||||
try {
|
||||
print('=== 직접 Dio 헬스체크 시작 ===');
|
||||
debugPrint('=== 직접 Dio 헬스체크 시작 ===');
|
||||
|
||||
final dio = Dio(BaseOptions(
|
||||
baseUrl: Environment.apiBaseUrl,
|
||||
@@ -97,7 +97,7 @@ class HealthCheckService {
|
||||
'statusCode': response.statusCode,
|
||||
};
|
||||
} catch (e) {
|
||||
print('직접 Dio 에러: $e');
|
||||
debugPrint('직접 Dio 에러: $e');
|
||||
return {
|
||||
'success': false,
|
||||
'error': e.toString(),
|
||||
@@ -109,7 +109,7 @@ class HealthCheckService {
|
||||
void startPeriodicHealthCheck() {
|
||||
if (_isMonitoring) return;
|
||||
|
||||
print('=== 주기적 헬스체크 모니터링 시작 ===');
|
||||
debugPrint('=== 주기적 헬스체크 모니터링 시작 ===');
|
||||
_isMonitoring = true;
|
||||
|
||||
// 즉시 한 번 체크
|
||||
@@ -123,7 +123,7 @@ class HealthCheckService {
|
||||
|
||||
/// 주기적인 헬스체크 중지
|
||||
void stopPeriodicHealthCheck() {
|
||||
print('=== 주기적 헬스체크 모니터링 중지 ===');
|
||||
debugPrint('=== 주기적 헬스체크 모니터링 중지 ===');
|
||||
_isMonitoring = false;
|
||||
_healthCheckTimer?.cancel();
|
||||
_healthCheckTimer = null;
|
||||
@@ -146,9 +146,9 @@ class HealthCheckService {
|
||||
final status = result['data']?['status'] ?? 'unreachable';
|
||||
final message = result['error'] ?? 'Server status: $status';
|
||||
|
||||
print('=== 브라우저 알림 표시 ===');
|
||||
print('상태: $status');
|
||||
print('메시지: $message');
|
||||
debugPrint('=== 브라우저 알림 표시 ===');
|
||||
debugPrint('상태: $status');
|
||||
debugPrint('메시지: $message');
|
||||
|
||||
// 플랫폼별 알림 처리
|
||||
platform.showNotification(
|
||||
@@ -157,7 +157,7 @@ class HealthCheckService {
|
||||
status,
|
||||
);
|
||||
} catch (e) {
|
||||
print('브라우저 알림 표시 실패: $e');
|
||||
debugPrint('브라우저 알림 표시 실패: $e');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
/// 웹이 아닌 플랫폼을 위한 스텁 구현
|
||||
void showNotification(String title, String message, String status) {
|
||||
// 웹이 아닌 플랫폼에서는 아무것도 하지 않음
|
||||
print('Notification (non-web): $title - $message - $status');
|
||||
debugPrint('Notification (non-web): $title - $message - $status');
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'dart:js' as js;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
/// 웹 플랫폼을 위한 알림 구현
|
||||
void showNotification(String title, String message, String status) {
|
||||
try {
|
||||
@@ -10,6 +12,6 @@ void showNotification(String title, String message, String status) {
|
||||
status,
|
||||
]);
|
||||
} catch (e) {
|
||||
print('웹 알림 표시 실패: $e');
|
||||
debugPrint('웹 알림 표시 실패: $e');
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -209,7 +209,9 @@ class UserService {
|
||||
}
|
||||
|
||||
/// API 권한을 앱 형식으로 변환
|
||||
String _mapRoleFromApi(String role) {
|
||||
String _mapRoleFromApi(String? role) {
|
||||
if (role == null) return 'M'; // null인 경우 기본값
|
||||
|
||||
switch (role) {
|
||||
case 'admin':
|
||||
return 'S';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:superport/core/errors/exceptions.dart';
|
||||
@@ -26,11 +27,11 @@ class WarehouseService {
|
||||
|
||||
return response.items.map((dto) => _convertDtoToWarehouseLocation(dto)).toList();
|
||||
} on ApiException catch (e) {
|
||||
print('[WarehouseService] ApiException: ${e.message}');
|
||||
debugPrint('[WarehouseService] ApiException: ${e.message}');
|
||||
throw ServerFailure(message: e.message);
|
||||
} catch (e, stackTrace) {
|
||||
print('[WarehouseService] Error loading warehouse locations: $e');
|
||||
print('[WarehouseService] Stack trace: $stackTrace');
|
||||
debugPrint('[WarehouseService] Error loading warehouse locations: $e');
|
||||
debugPrint('[WarehouseService] Stack trace: $stackTrace');
|
||||
throw ServerFailure(message: '창고 위치 목록을 불러오는 데 실패했습니다: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user