사용하지 않는 파일 정리 전 백업 (Phase 10 완료 후 상태)

This commit is contained in:
JiWoong Sul
2025-08-29 15:11:59 +09:00
parent a740ff10c8
commit d916b281a7
333 changed files with 53617 additions and 22574 deletions

View File

@@ -5,22 +5,18 @@ import '../../../core/errors/failures.dart';
import '../../repositories/user_repository.dart';
import '../base_usecase.dart';
/// 사용자 생성 파라미터 (서버 API v0.2.1 대응)
/// 사용자 생성 파라미터 (백엔드 API v1 대응)
class CreateUserParams {
final String username;
final String email;
final String password;
final String name;
final UserRole role;
final String? email;
final String? phone;
final int companiesId;
const CreateUserParams({
required this.username,
required this.email,
required this.password,
required this.name,
required this.role,
this.email,
this.phone,
required this.companiesId,
});
}
@@ -41,45 +37,38 @@ class CreateUserUseCase extends UseCase<User, CreateUserParams> {
}
return await _userRepository.createUser(
username: params.username,
email: params.email,
password: params.password,
name: params.name,
email: params.email,
phone: params.phone,
role: params.role,
companiesId: params.companiesId,
);
}
/// 입력값 유효성 검증 (서버 API v0.2.1 규칙 적용)
/// 입력값 유효성 검증 (백엔드 API v1 규칙 적용)
ValidationFailure? _validateUserInput(CreateUserParams params) {
final errors = <String, String>{};
// 사용자명 검증 (3자 이상, 영문/숫자/언더스코어만)
if (params.username.length < 3) {
errors['username'] = '사용자명은 3자 이상이어야 합니다.';
}
if (!RegExp(r'^[a-zA-Z0-9_]+$').hasMatch(params.username)) {
errors['username'] = '사용자명은 영문, 숫자, 언더스코어만 사용 가능합니다.';
}
// 이메일 검증 (기본 이메일 형식)
if (!RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(params.email)) {
errors['email'] = '올바른 이메일 형식이 아닙니다.';
}
// 비밀번호 검증 (서버 API: 6자 이상)
if (params.password.length < 6) {
errors['password'] = '비밀번호는 6자 이상이어야 합니다.';
}
// 이름 검증 (필수)
if (params.name.trim().isEmpty) {
errors['name'] = '이름을 입력해주세요.';
}
// 이메일 검증 (선택적, 입력시 형식 검증)
if (params.email != null && params.email!.isNotEmpty) {
if (!RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(params.email!)) {
errors['email'] = '올바른 이메일 형식이 아닙니다.';
}
}
// 회사 ID 검증 (필수)
if (params.companiesId <= 0) {
errors['companiesId'] = '회사를 선택해주세요.';
}
// 전화번호 검증 (선택적, "010-1234-5678" 형식)
if (params.phone != null && params.phone!.isNotEmpty) {
if (!PhoneNumberUtil.isValidFormat(params.phone!)) {
// PhoneNumberUtil import 필요시 추가
if (!RegExp(r'^010-\d{4}-\d{4}$').hasMatch(params.phone!)) {
errors['phone'] = '전화번호는 "010-1234-5678" 형식으로 입력해주세요.';
}
}

View File

@@ -1,4 +1,5 @@
/// User 도메인 UseCase 모음
library;
export 'get_users_usecase.dart';
export 'create_user_usecase.dart';
export 'update_user_usecase.dart';