backup: 사용하지 않는 파일 삭제 전 복구 지점

- 전체 371개 파일 중 82개 미사용 파일 식별
- Phase 1: 33개 파일 삭제 예정 (100% 안전)
- Phase 2: 30개 파일 삭제 검토 예정
- Phase 3: 19개 파일 수동 검토 예정

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
JiWoong Sul
2025-09-02 19:51:40 +09:00
parent 650cd4be55
commit c419f8f458
149 changed files with 12934 additions and 3644 deletions

View File

@@ -1,6 +1,7 @@
import 'package:dio/dio.dart';
import 'package:injectable/injectable.dart';
import '../../core/constants/api_endpoints.dart';
import '../../core/constants/app_constants.dart';
import '../../core/errors/exceptions.dart';
import '../../domain/repositories/rent_repository.dart';
import '../models/rent_dto.dart';
@@ -14,27 +15,37 @@ class RentRepositoryImpl implements RentRepository {
@override
Future<RentListResponse> getRents({
int page = 1,
int pageSize = 10,
String? search,
String? status,
int? equipmentHistoryId,
int perPage = AppConstants.rentPageSize,
int? equipmentId,
int? companyId,
bool? isActive,
DateTime? dateFrom,
DateTime? dateTo,
}) async {
try {
final queryParameters = <String, dynamic>{
'page': page,
'page_size': pageSize,
'per_page': perPage,
};
if (search != null && search.isNotEmpty) {
queryParameters['search'] = search;
if (equipmentId != null) {
queryParameters['equipment_id'] = equipmentId;
}
if (status != null && status.isNotEmpty) {
queryParameters['status'] = status;
if (companyId != null) {
queryParameters['company_id'] = companyId;
}
if (equipmentHistoryId != null) {
queryParameters['equipment_history_id'] = equipmentHistoryId;
if (isActive != null) {
queryParameters['is_active'] = isActive;
}
if (dateFrom != null) {
queryParameters['date_from'] = dateFrom.toIso8601String().split('T')[0];
}
if (dateTo != null) {
queryParameters['date_to'] = dateTo.toIso8601String().split('T')[0];
}
final response = await dio.get(
@@ -103,34 +114,40 @@ class RentRepositoryImpl implements RentRepository {
}
}
Future<RentListResponse> getActiveRents({
int page = 1,
int pageSize = 10,
}) async {
// 백엔드 호환: status 필터로 진행 중인 임대 조회
return getRents(
page: page,
pageSize: pageSize,
status: 'active',
);
@override
Future<List<RentDto>> getActiveRents() async {
try {
final response = await dio.get('${ApiEndpoints.rents}/active');
// Backend returns List<RentDto> directly for /active endpoint
final List<dynamic> dataList = response.data as List<dynamic>;
return dataList.map((json) => RentDto.fromJson(json)).toList();
} on DioException catch (e) {
throw ServerException(message: _handleError(e));
} catch (e) {
throw ServerException(message: '진행중인 임대를 가져오는 중 오류가 발생했습니다: $e');
}
}
Future<RentListResponse> getOverdueRents({
Future<List<RentDto>> getOverdueRents({
int page = 1,
int pageSize = 10,
int perPage = AppConstants.rentPageSize,
}) async {
// 백엔드 호환: status 필터로 연체된 임대 조회
return getRents(
page: page,
pageSize: pageSize,
status: 'overdue',
// 백엔드 호환: 비활성 임대 중 만료일이 과거인 것들
final response = await getRents(
page: page,
perPage: perPage,
isActive: false, // 비활성 임대
dateTo: DateTime.now(), // 오늘까지의 날짜
);
return response.items;
}
Future<Map<String, dynamic>> getRentStats() async {
try {
// 백엔드 호환: 클라이언트 측에서 통계 계산
final allRents = await getRents(pageSize: 1000); // 충분히 큰 페이지 사이즈
final allRents = await getRents(perPage: AppConstants.maxBulkPageSize); // 충분히 큰 페이지 사이즈
int totalRents = allRents.totalCount ?? 0;
int activeRents = 0;
@@ -159,23 +176,7 @@ class RentRepositoryImpl implements RentRepository {
}
}
@override
Future<RentDto> returnRent(int id, String returnDate) async {
try {
final response = await dio.put(
'${ApiEndpoints.rents}/$id',
data: {
'actual_return_date': returnDate,
'status': 'returned',
},
);
return RentDto.fromJson(response.data);
} on DioException catch (e) {
throw ServerException(message: _handleError(e));
} catch (e) {
throw ServerException(message: '장비 반납 처리 중 오류가 발생했습니다: $e');
}
}
// returnRent() 메서드 제거 - 백엔드에 해당 API 엔드포인트 없음
// 에러 처리 메서드
String _handleError(DioException e) {