feat: API 통합을 위한 기초 인프라 구축
- 네트워크 레이어 구현 (Dio 기반 ApiClient) - 환경별 설정 관리 시스템 구축 - 의존성 주입 설정 (GetIt) - API 엔드포인트 상수 정의 - 인터셉터 구현 (Auth, Error, Logging) - 프로젝트 아키텍처 개선 (core, data, di 디렉토리 구조) - API 통합 계획서 및 요구사항 문서 작성 - 필요 패키지 추가 (dio, flutter_secure_storage, get_it 등)
This commit is contained in:
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