Files
superport/lib/core/constants/app_constants.dart
JiWoong Sul 162fe08618
Some checks failed
Flutter Test & Quality Check / Test on macos-latest (push) Has been cancelled
Flutter Test & Quality Check / Test on ubuntu-latest (push) Has been cancelled
Flutter Test & Quality Check / Build APK (push) Has been cancelled
refactor: Clean Architecture 적용 및 코드베이스 전면 리팩토링
## 주요 변경사항

### 아키텍처 개선
- Clean Architecture 패턴 적용 (Domain, Data, Presentation 레이어 분리)
- Use Case 패턴 도입으로 비즈니스 로직 캡슐화
- Repository 패턴으로 데이터 접근 추상화
- 의존성 주입 구조 개선

### 상태 관리 최적화
- 모든 Controller에서 불필요한 상태 관리 로직 제거
- 페이지네이션 로직 통일 및 간소화
- 에러 처리 로직 개선 (에러 메시지 한글화)
- 로딩 상태 관리 최적화

### Mock 서비스 제거
- MockDataService 완전 제거
- 모든 화면을 실제 API 전용으로 전환
- 불필요한 Mock 관련 코드 정리

### UI/UX 개선
- Overview 화면 대시보드 기능 강화
- 라이선스 만료 알림 위젯 추가
- 사이드바 네비게이션 개선
- 일관된 UI 컴포넌트 사용

### 코드 품질
- 중복 코드 제거 및 함수 추출
- 파일별 책임 분리 명확화
- 테스트 코드 업데이트

## 영향 범위
- 모든 화면의 Controller 리팩토링
- API 통신 레이어 구조 개선
- 에러 처리 및 로깅 시스템 개선

## 향후 계획
- 단위 테스트 커버리지 확대
- 통합 테스트 시나리오 추가
- 성능 모니터링 도구 통합
2025-08-11 00:04:28 +09:00

99 lines
3.3 KiB
Dart

/// 앱 전역 상수 정의
class AppConstants {
// API 관련
static const int defaultPageSize = 20;
static const int maxPageSize = 100;
static const Duration cacheTimeout = Duration(minutes: 5);
// API 타임아웃
static const Duration apiConnectTimeout = Duration(seconds: 30);
static const Duration apiReceiveTimeout = Duration(seconds: 30);
static const Duration healthCheckTimeout = Duration(seconds: 10);
static const Duration loginTimeout = Duration(seconds: 10);
// 디바운스 시간
static const Duration searchDebounce = Duration(milliseconds: 500);
static const Duration licenseSearchDebounce = Duration(milliseconds: 300);
// 애니메이션 시간
static const Duration autocompleteAnimation = Duration(milliseconds: 200);
static const Duration formAnimation = Duration(milliseconds: 300);
static const Duration loginAnimation = Duration(milliseconds: 1000);
static const Duration loginSubAnimation = Duration(milliseconds: 800);
// 라이선스 만료 기간
static const int licenseExpiryWarningDays = 30;
static const int licenseExpiryCautionDays = 60;
static const int licenseExpiryInfoDays = 90;
// 헬스체크 주기
static const Duration healthCheckInterval = Duration(seconds: 30);
// 토큰 키
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}$',
);
}