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:
@@ -1,6 +1,7 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:superport/core/constants/api_endpoints.dart';
|
||||
import 'package:superport/core/constants/app_constants.dart';
|
||||
import 'package:superport/data/datasources/remote/api_client.dart';
|
||||
import 'package:superport/data/models/zipcode_dto.dart';
|
||||
|
||||
@@ -8,20 +9,17 @@ abstract class ZipcodeRepository {
|
||||
/// 우편번호 검색 (페이지네이션 지원)
|
||||
Future<ZipcodeListResponse> search({
|
||||
int page = 1,
|
||||
int limit = 20,
|
||||
int limit = AppConstants.defaultPageSize,
|
||||
String? search,
|
||||
String? sido,
|
||||
String? gu,
|
||||
});
|
||||
|
||||
/// 우편번호로 정확한 주소 조회
|
||||
Future<ZipcodeDto?> getByZipcode(int zipcode);
|
||||
|
||||
/// 시도별 구 목록 조회
|
||||
Future<List<String>> getGuBySido(String sido);
|
||||
|
||||
/// 전체 시도 목록 조회
|
||||
Future<List<String>> getAllSido();
|
||||
|
||||
/// Hierarchy API - 시도 목록 조회
|
||||
Future<HierarchyResponse> getHierarchySidos();
|
||||
|
||||
/// Hierarchy API - 특정 시도의 구/군 목록 조회
|
||||
Future<HierarchyResponse> getHierarchyGusBySido(String sido);
|
||||
}
|
||||
|
||||
@Injectable(as: ZipcodeRepository)
|
||||
@@ -33,7 +31,7 @@ class ZipcodeRepositoryImpl implements ZipcodeRepository {
|
||||
@override
|
||||
Future<ZipcodeListResponse> search({
|
||||
int page = 1,
|
||||
int limit = 20,
|
||||
int limit = AppConstants.defaultPageSize,
|
||||
String? search,
|
||||
String? sido,
|
||||
String? gu,
|
||||
@@ -82,111 +80,43 @@ class ZipcodeRepositoryImpl implements ZipcodeRepository {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ZipcodeDto?> getByZipcode(int zipcode) async {
|
||||
try {
|
||||
final response = await _apiClient.dio.get(
|
||||
ApiEndpoints.zipcodes,
|
||||
queryParameters: {
|
||||
'zipcode': zipcode,
|
||||
'limit': 1,
|
||||
},
|
||||
);
|
||||
|
||||
if (response.data is Map<String, dynamic>) {
|
||||
final listResponse = ZipcodeListResponse.fromJson(response.data);
|
||||
return listResponse.items.isNotEmpty ? listResponse.items.first : null;
|
||||
}
|
||||
|
||||
return null;
|
||||
} on DioException catch (e) {
|
||||
throw _handleError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> getGuBySido(String sido) async {
|
||||
Future<HierarchyResponse> getHierarchySidos() async {
|
||||
try {
|
||||
final response = await _apiClient.dio.get(
|
||||
ApiEndpoints.zipcodes,
|
||||
queryParameters: {
|
||||
'page': 1,
|
||||
'sido': sido,
|
||||
'limit': 1000, // 충분히 큰 값으로 모든 구 가져오기
|
||||
},
|
||||
ApiEndpoints.zipcodeHierarchySidos,
|
||||
);
|
||||
|
||||
if (response.data is Map<String, dynamic>) {
|
||||
final listResponse = ZipcodeListResponse.fromJson(response.data);
|
||||
|
||||
// 중복 제거하고 구 목록만 추출
|
||||
final guSet = <String>{};
|
||||
for (final zipcode in listResponse.items) {
|
||||
guSet.add(zipcode.gu);
|
||||
}
|
||||
|
||||
final guList = guSet.toList()..sort();
|
||||
return guList;
|
||||
}
|
||||
|
||||
return [];
|
||||
} on DioException catch (e) {
|
||||
throw _handleError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> getAllSido() async {
|
||||
try {
|
||||
final response = await _apiClient.dio.get(
|
||||
ApiEndpoints.zipcodes,
|
||||
queryParameters: {
|
||||
'page': 1,
|
||||
'limit': 1000, // 충분히 큰 값으로 모든 시도 가져오기
|
||||
},
|
||||
);
|
||||
|
||||
print('=== getAllSido API 응답 ===');
|
||||
print('Status Code: ${response.statusCode}');
|
||||
print('Response Type: ${response.data.runtimeType}');
|
||||
|
||||
if (response.data is Map<String, dynamic>) {
|
||||
print('Response Data Keys: ${(response.data as Map).keys.toList()}');
|
||||
final listResponse = ZipcodeListResponse.fromJson(response.data);
|
||||
print('총 우편번호 데이터 개수: ${listResponse.items.length}');
|
||||
print('전체 카운트: ${listResponse.totalCount}');
|
||||
print('현재 페이지: ${listResponse.currentPage}');
|
||||
print('총 페이지: ${listResponse.totalPages}');
|
||||
|
||||
// 첫 3개 아이템 출력
|
||||
if (listResponse.items.isNotEmpty) {
|
||||
print('첫 3개 우편번호 데이터:');
|
||||
for (int i = 0; i < 3 && i < listResponse.items.length; i++) {
|
||||
final item = listResponse.items[i];
|
||||
print(' [$i] 우편번호: ${item.zipcode}, 시도: "${item.sido}", 구: "${item.gu}", 기타: "${item.etc}"');
|
||||
}
|
||||
}
|
||||
|
||||
// 중복 제거하고 시도 목록만 추출
|
||||
final sidoSet = <String>{};
|
||||
for (final zipcode in listResponse.items) {
|
||||
sidoSet.add(zipcode.sido);
|
||||
}
|
||||
|
||||
final sidoList = sidoSet.toList()..sort();
|
||||
print('추출된 시도 목록: $sidoList');
|
||||
print('시도 개수: ${sidoList.length}');
|
||||
return sidoList;
|
||||
return HierarchyResponse.fromJson(response.data);
|
||||
} else {
|
||||
throw Exception('예상치 못한 응답 형식입니다.');
|
||||
}
|
||||
|
||||
print('예상치 못한 응답 형식');
|
||||
return [];
|
||||
} on DioException catch (e) {
|
||||
print('getAllSido API 오류: ${e.message}');
|
||||
throw _handleError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<HierarchyResponse> getHierarchyGusBySido(String sido) async {
|
||||
try {
|
||||
final response = await _apiClient.dio.get(
|
||||
ApiEndpoints.zipcodeHierarchyGus,
|
||||
queryParameters: {'sido': sido},
|
||||
);
|
||||
|
||||
if (response.data is Map<String, dynamic>) {
|
||||
return HierarchyResponse.fromJson(response.data);
|
||||
} else {
|
||||
throw Exception('예상치 못한 응답 형식입니다.');
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
throw _handleError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Exception _handleError(DioException e) {
|
||||
switch (e.type) {
|
||||
case DioExceptionType.connectionTimeout:
|
||||
|
||||
Reference in New Issue
Block a user