feat: API 통합을 위한 기초 인프라 구축
- 네트워크 레이어 구현 (Dio 기반 ApiClient) - 환경별 설정 관리 시스템 구축 - 의존성 주입 설정 (GetIt) - API 엔드포인트 상수 정의 - 인터셉터 구현 (Auth, Error, Logging) - 프로젝트 아키텍처 개선 (core, data, di 디렉토리 구조) - API 통합 계획서 및 요구사항 문서 작성 - 필요 패키지 추가 (dio, flutter_secure_storage, get_it 등)
This commit is contained in:
77
lib/core/constants/api_endpoints.dart
Normal file
77
lib/core/constants/api_endpoints.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
/// API 엔드포인트 상수 정의
|
||||
class ApiEndpoints {
|
||||
// 인증
|
||||
static const String login = '/auth/login';
|
||||
static const String logout = '/auth/logout';
|
||||
static const String refresh = '/auth/refresh';
|
||||
static const String me = '/me';
|
||||
|
||||
// 장비 관리
|
||||
static const String equipment = '/equipment';
|
||||
static const String equipmentSearch = '/equipment/search';
|
||||
static const String equipmentIn = '/equipment/in';
|
||||
static const String equipmentOut = '/equipment/out';
|
||||
static const String equipmentBatchOut = '/equipment/batch-out';
|
||||
static const String equipmentManufacturers = '/equipment/manufacturers';
|
||||
static const String equipmentNames = '/equipment/names';
|
||||
static const String equipmentHistory = '/equipment/history';
|
||||
static const String equipmentRentals = '/equipment/rentals';
|
||||
static const String equipmentRepairs = '/equipment/repairs';
|
||||
static const String equipmentDisposals = '/equipment/disposals';
|
||||
|
||||
// 회사 관리
|
||||
static const String companies = '/companies';
|
||||
static const String companiesSearch = '/companies/search';
|
||||
static const String companiesNames = '/companies/names';
|
||||
static const String companiesCheckDuplicate = '/companies/check-duplicate';
|
||||
static const String companiesWithBranches = '/companies/with-branches';
|
||||
static const String companiesBranches = '/companies/{id}/branches';
|
||||
|
||||
// 사용자 관리
|
||||
static const String users = '/users';
|
||||
static const String usersSearch = '/users/search';
|
||||
static const String usersChangePassword = '/users/{id}/change-password';
|
||||
static const String usersStatus = '/users/{id}/status';
|
||||
|
||||
// 라이선스 관리
|
||||
static const String licenses = '/licenses';
|
||||
static const String licensesExpiring = '/licenses/expiring';
|
||||
static const String licensesAssign = '/licenses/{id}/assign';
|
||||
static const String licensesUnassign = '/licenses/{id}/unassign';
|
||||
|
||||
// 창고 위치 관리
|
||||
static const String warehouseLocations = '/warehouse-locations';
|
||||
static const String warehouseLocationsSearch = '/warehouse-locations/search';
|
||||
static const String warehouseEquipment = '/warehouse-locations/{id}/equipment';
|
||||
static const String warehouseCapacity = '/warehouse-locations/{id}/capacity';
|
||||
|
||||
// 파일 관리
|
||||
static const String filesUpload = '/files/upload';
|
||||
static const String filesDownload = '/files/{id}';
|
||||
|
||||
// 보고서
|
||||
static const String reports = '/reports';
|
||||
static const String reportsPdf = '/reports/{type}/pdf';
|
||||
static const String reportsExcel = '/reports/{type}/excel';
|
||||
|
||||
// 대시보드 및 통계
|
||||
static const String overviewStats = '/overview/stats';
|
||||
static const String overviewRecentActivities = '/overview/recent-activities';
|
||||
static const String overviewEquipmentStatus = '/overview/equipment-status';
|
||||
static const String overviewLicenseExpiry = '/overview/license-expiry';
|
||||
|
||||
// 대량 처리
|
||||
static const String bulkUpload = '/bulk/upload';
|
||||
static const String bulkUpdate = '/bulk/update';
|
||||
|
||||
// 감사 로그
|
||||
static const String auditLogs = '/audit-logs';
|
||||
|
||||
// 백업
|
||||
static const String backupCreate = '/backup/create';
|
||||
static const String backupRestore = '/backup/restore';
|
||||
|
||||
// 검색 및 조회
|
||||
static const String lookups = '/lookups';
|
||||
static const String categories = '/lookups/categories';
|
||||
}
|
||||
75
lib/core/constants/app_constants.dart
Normal file
75
lib/core/constants/app_constants.dart
Normal file
@@ -0,0 +1,75 @@
|
||||
/// 앱 전역 상수 정의
|
||||
class AppConstants {
|
||||
// API 관련
|
||||
static const int defaultPageSize = 20;
|
||||
static const int maxPageSize = 100;
|
||||
static const Duration cacheTimeout = Duration(minutes: 5);
|
||||
|
||||
// 토큰 키
|
||||
static const String accessTokenKey = 'access_token';
|
||||
static const String refreshTokenKey = 'refresh_token';
|
||||
static const String tokenTypeKey = 'token_type';
|
||||
static const String expiresInKey = 'expires_in';
|
||||
|
||||
// 사용자 권한 매핑
|
||||
static const Map<String, String> flutterToBackendRole = {
|
||||
'S': 'admin', // Super user
|
||||
'M': 'manager', // Manager
|
||||
'U': 'staff', // User
|
||||
'V': 'viewer', // Viewer
|
||||
};
|
||||
|
||||
static const Map<String, String> backendToFlutterRole = {
|
||||
'admin': 'S',
|
||||
'manager': 'M',
|
||||
'staff': 'U',
|
||||
'viewer': 'V',
|
||||
};
|
||||
|
||||
// 장비 상태
|
||||
static const Map<String, String> equipmentStatus = {
|
||||
'available': '사용가능',
|
||||
'in_use': '사용중',
|
||||
'maintenance': '유지보수',
|
||||
'disposed': '폐기',
|
||||
'rented': '대여중',
|
||||
};
|
||||
|
||||
// 정렬 옵션
|
||||
static const Map<String, String> sortOptions = {
|
||||
'created_at': '생성일',
|
||||
'updated_at': '수정일',
|
||||
'name': '이름',
|
||||
'status': '상태',
|
||||
};
|
||||
|
||||
// 날짜 형식
|
||||
static const String dateFormat = 'yyyy-MM-dd';
|
||||
static const String dateTimeFormat = 'yyyy-MM-dd HH:mm:ss';
|
||||
|
||||
// 파일 업로드
|
||||
static const int maxFileSize = 10 * 1024 * 1024; // 10MB
|
||||
static const List<String> allowedFileExtensions = [
|
||||
'jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx'
|
||||
];
|
||||
|
||||
// 에러 메시지
|
||||
static const String networkError = '네트워크 연결을 확인해주세요.';
|
||||
static const String timeoutError = '요청 시간이 초과되었습니다.';
|
||||
static const String unauthorizedError = '인증이 필요합니다.';
|
||||
static const String serverError = '서버 오류가 발생했습니다.';
|
||||
static const String unknownError = '알 수 없는 오류가 발생했습니다.';
|
||||
|
||||
// 정규식 패턴
|
||||
static final RegExp emailRegex = RegExp(
|
||||
r'^[a-zA-Z0-9.]+@[a-zA-Z0-9]+\.[a-zA-Z]+',
|
||||
);
|
||||
|
||||
static final RegExp phoneRegex = RegExp(
|
||||
r'^01[0-9]{1}-?[0-9]{4}-?[0-9]{4}$',
|
||||
);
|
||||
|
||||
static final RegExp businessNumberRegex = RegExp(
|
||||
r'^[0-9]{3}-?[0-9]{2}-?[0-9]{5}$',
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user