refactor: Clean Architecture 적용 및 코드베이스 전면 리팩토링
## 주요 변경사항 ### 아키텍처 개선 - Clean Architecture 패턴 적용 (Domain, Data, Presentation 레이어 분리) - Use Case 패턴 도입으로 비즈니스 로직 캡슐화 - Repository 패턴으로 데이터 접근 추상화 - 의존성 주입 구조 개선 ### 상태 관리 최적화 - 모든 Controller에서 불필요한 상태 관리 로직 제거 - 페이지네이션 로직 통일 및 간소화 - 에러 처리 로직 개선 (에러 메시지 한글화) - 로딩 상태 관리 최적화 ### Mock 서비스 제거 - MockDataService 완전 제거 - 모든 화면을 실제 API 전용으로 전환 - 불필요한 Mock 관련 코드 정리 ### UI/UX 개선 - Overview 화면 대시보드 기능 강화 - 라이선스 만료 알림 위젯 추가 - 사이드바 네비게이션 개선 - 일관된 UI 컴포넌트 사용 ### 코드 품질 - 중복 코드 제거 및 함수 추출 - 파일별 책임 분리 명확화 - 테스트 코드 업데이트 ## 영향 범위 - 모든 화면의 Controller 리팩토링 - API 통신 레이어 구조 개선 - 에러 처리 및 로깅 시스템 개선 ## 향후 계획 - 단위 테스트 커버리지 확대 - 통합 테스트 시나리오 추가 - 성능 모니터링 도구 통합
This commit is contained in:
24
lib/data/repositories/license_repository.dart
Normal file
24
lib/data/repositories/license_repository.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
import '../models/license/license_dto.dart';
|
||||
|
||||
/// 라이선스 Repository 인터페이스
|
||||
abstract class LicenseRepository {
|
||||
/// 라이선스 목록 조회
|
||||
Future<LicenseListResponseDto> getLicenses({
|
||||
int page = 1,
|
||||
int perPage = 20,
|
||||
String? search,
|
||||
Map<String, dynamic>? filters,
|
||||
});
|
||||
|
||||
/// 라이선스 상세 조회
|
||||
Future<LicenseDto> getLicenseDetail(int id);
|
||||
|
||||
/// 라이선스 생성
|
||||
Future<LicenseDto> createLicense(Map<String, dynamic> data);
|
||||
|
||||
/// 라이선스 수정
|
||||
Future<LicenseDto> updateLicense(int id, Map<String, dynamic> data);
|
||||
|
||||
/// 라이선스 삭제
|
||||
Future<void> deleteLicense(int id);
|
||||
}
|
||||
58
lib/data/repositories/license_repository_impl.dart
Normal file
58
lib/data/repositories/license_repository_impl.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
import 'package:injectable/injectable.dart';
|
||||
import '../datasources/remote/license_remote_datasource.dart';
|
||||
import '../models/license/license_dto.dart';
|
||||
import '../models/license/license_request_dto.dart';
|
||||
import 'license_repository.dart';
|
||||
|
||||
/// 라이선스 Repository 구현체
|
||||
@Injectable(as: LicenseRepository)
|
||||
class LicenseRepositoryImpl implements LicenseRepository {
|
||||
final LicenseRemoteDataSource remoteDataSource;
|
||||
|
||||
LicenseRepositoryImpl(this.remoteDataSource);
|
||||
|
||||
@override
|
||||
Future<LicenseListResponseDto> getLicenses({
|
||||
int page = 1,
|
||||
int perPage = 20,
|
||||
String? search,
|
||||
Map<String, dynamic>? filters,
|
||||
}) async {
|
||||
// 검색 및 필터 파라미터를 DataSource 형식에 맞게 변환
|
||||
bool? isActive = filters?['is_active'];
|
||||
int? companyId = filters?['company_id'];
|
||||
int? assignedUserId = filters?['assigned_user_id'];
|
||||
String? licenseType = filters?['license_type'];
|
||||
|
||||
return await remoteDataSource.getLicenses(
|
||||
page: page,
|
||||
perPage: perPage,
|
||||
isActive: isActive,
|
||||
companyId: companyId,
|
||||
assignedUserId: assignedUserId,
|
||||
licenseType: licenseType,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LicenseDto> getLicenseDetail(int id) async {
|
||||
return await remoteDataSource.getLicenseById(id);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LicenseDto> createLicense(Map<String, dynamic> data) async {
|
||||
final request = CreateLicenseRequest.fromJson(data);
|
||||
return await remoteDataSource.createLicense(request);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LicenseDto> updateLicense(int id, Map<String, dynamic> data) async {
|
||||
final request = UpdateLicenseRequest.fromJson(data);
|
||||
return await remoteDataSource.updateLicense(id, request);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> deleteLicense(int id) async {
|
||||
await remoteDataSource.deleteLicense(id);
|
||||
}
|
||||
}
|
||||
27
lib/data/repositories/warehouse_location_repository.dart
Normal file
27
lib/data/repositories/warehouse_location_repository.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import '../models/warehouse/warehouse_dto.dart';
|
||||
|
||||
/// 창고 위치 Repository 인터페이스
|
||||
abstract class WarehouseLocationRepository {
|
||||
/// 창고 위치 목록 조회
|
||||
Future<WarehouseLocationListDto> getWarehouseLocations({
|
||||
int page = 1,
|
||||
int perPage = 20,
|
||||
String? search,
|
||||
Map<String, dynamic>? filters,
|
||||
});
|
||||
|
||||
/// 창고 위치 상세 조회
|
||||
Future<WarehouseLocationDto> getWarehouseLocationDetail(int id);
|
||||
|
||||
/// 창고 위치 생성
|
||||
Future<WarehouseLocationDto> createWarehouseLocation(Map<String, dynamic> data);
|
||||
|
||||
/// 창고 위치 수정
|
||||
Future<WarehouseLocationDto> updateWarehouseLocation(int id, Map<String, dynamic> data);
|
||||
|
||||
/// 창고 위치 삭제
|
||||
Future<void> deleteWarehouseLocation(int id);
|
||||
|
||||
/// 창고에 장비가 있는지 확인
|
||||
Future<bool> checkWarehouseHasEquipment(int id);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import 'package:injectable/injectable.dart';
|
||||
import '../datasources/remote/warehouse_location_remote_datasource.dart';
|
||||
import '../models/warehouse/warehouse_dto.dart';
|
||||
import 'warehouse_location_repository.dart';
|
||||
|
||||
/// 창고 위치 Repository 구현체
|
||||
@Injectable(as: WarehouseLocationRepository)
|
||||
class WarehouseLocationRepositoryImpl implements WarehouseLocationRepository {
|
||||
final WarehouseLocationRemoteDataSource remoteDataSource;
|
||||
|
||||
WarehouseLocationRepositoryImpl(this.remoteDataSource);
|
||||
|
||||
@override
|
||||
Future<WarehouseLocationListDto> getWarehouseLocations({
|
||||
int page = 1,
|
||||
int perPage = 20,
|
||||
String? search,
|
||||
Map<String, dynamic>? filters,
|
||||
}) async {
|
||||
return await remoteDataSource.getWarehouseLocations(
|
||||
page: page,
|
||||
perPage: perPage,
|
||||
search: search,
|
||||
filters: filters,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<WarehouseLocationDto> getWarehouseLocationDetail(int id) async {
|
||||
return await remoteDataSource.getWarehouseLocationDetail(id);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<WarehouseLocationDto> createWarehouseLocation(Map<String, dynamic> data) async {
|
||||
final request = CreateWarehouseLocationRequest.fromJson(data);
|
||||
return await remoteDataSource.createWarehouseLocation(request);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<WarehouseLocationDto> updateWarehouseLocation(int id, Map<String, dynamic> data) async {
|
||||
final request = UpdateWarehouseLocationRequest.fromJson(data);
|
||||
return await remoteDataSource.updateWarehouseLocation(id, request);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> deleteWarehouseLocation(int id) async {
|
||||
await remoteDataSource.deleteWarehouseLocation(id);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> checkWarehouseHasEquipment(int id) async {
|
||||
// TODO: API 엔드포인트 구현 필요
|
||||
// 현재는 항상 false 반환
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user