outer 및 inner sequence 동기화 및 한글화

변경 사항:
- 이벤트생성플로우 outer: FE → Gateway → User Service 호출 패턴 추가
- user-로그인 inner: 전화번호 → 이메일 기반 인증으로 변경
- user-회원가입 inner: 국세청 API 제거, 이메일 중복검사 추가
- event-목적선택 inner: Gateway 경유, 요청/응답 한글화
- ai-트렌드분석및추천 inner: 과거 이벤트 데이터 제거, Timeout 5분으로 변경
- analytics-대시보드조회 inner: Redis TTL 5분 → 1시간으로 변경

모든 파일에 Repository CRUD 작업 한글 설명 적용 (SQL 제거)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
cherry2250
2025-10-23 15:36:45 +09:00
parent eea1fff98c
commit edb7045008
6 changed files with 234 additions and 207 deletions
@@ -15,30 +15,30 @@ participant "User DB\n(PostgreSQL)" as UserDB <<E>>
note over Controller, UserDB
**UFR-USER-020: 로그인**
- 입력: 전화번호, 비밀번호
- 입력: 이메일, 비밀번호
- 비밀번호 검증 (bcrypt compare)
- JWT 토큰 발급
- 세션 저장 (Redis)
- 최종 로그인 시각 업데이트
end note
Client -> Controller: POST /api/users/login\n(LoginRequest DTO)
Client -> Controller: POST /api/users/login\n{"email": "user@example.com",\n"password": "password123"}
activate Controller
Controller -> Controller: @Valid 어노테이션 검증\n(필수 필드 확인)
Controller -> Controller: 입력값 검증\n(필수 필드, 이메일 형식 확인)
Controller -> AuthService: authenticate(phoneNumber, password)
Controller -> AuthService: authenticate(email, password)
activate AuthService
== 1단계: 사용자 조회 ==
AuthService -> Service: findByPhoneNumber(phoneNumber)
AuthService -> Service: findByEmail(email)
activate Service
Service -> UserRepo: findByPhoneNumber(phoneNumber)
Service -> UserRepo: findByEmail(email)
activate UserRepo
UserRepo -> UserDB: 전화번호로 사용자 조회\n(사용자ID, 비밀번호해시, 역할,\n이름, 이메일 조회)
UserRepo -> UserDB: 이메일로 사용자 조회\n(사용자ID, 비밀번호해시, 역할,\n이름, 전화번호 조회)
activate UserDB
UserDB --> UserRepo: 사용자 정보 또는 NULL
UserDB --> UserRepo: 사용자 정보 반환 또는 없음
deactivate UserDB
UserRepo --> Service: Optional<User>
deactivate UserRepo
@@ -46,8 +46,8 @@ Service --> AuthService: Optional<User>
deactivate Service
alt 사용자 없음
AuthService --> Controller: throw AuthenticationFailedException\n("전화번호 또는 비밀번호를 확인해주세요")
Controller --> Client: 401 Unauthorized\n{"code": "AUTH_001",\n"error": "전화번호 또는 비밀번호를\n확인해주세요"}
AuthService --> Controller: throw AuthenticationFailedException\n("이메일 또는 비밀번호를 확인해주세요")
Controller --> Client: 401 Unauthorized\n{"code": "AUTH_001",\n"message": "이메일 또는 비밀번호를\n확인해주세요"}
deactivate AuthService
deactivate Controller
@@ -62,8 +62,8 @@ else 사용자 존재
deactivate PwdEncoder
alt 비밀번호 불일치
AuthService --> Controller: throw AuthenticationFailedException\n("전화번호 또는 비밀번호를 확인해주세요")
Controller --> Client: 401 Unauthorized\n{"code": "AUTH_001",\n"error": "전화번호 또는 비밀번호를\n확인해주세요"}
AuthService --> Controller: throw AuthenticationFailedException\n("이메일 또는 비밀번호를 확인해주세요")
Controller --> Client: 401 Unauthorized\n{"code": "AUTH_001",\n"message": "이메일 또는 비밀번호를\n확인해주세요"}
deactivate AuthService
deactivate Controller
@@ -79,9 +79,9 @@ else 사용자 존재
== 4단계: 세션 저장 ==
AuthService -> Redis: SET user:session:{token}\n(userId, role, TTL 7일)
AuthService -> Redis: 세션 정보 저장\nKey: user:session:{token}\nValue: {userId, role}\nTTL: 7일
activate Redis
Redis --> AuthService: 세션 저장 완료
Redis --> AuthService: 저장 완료
deactivate Redis
== 5단계: 최종 로그인 시각 업데이트 (비동기) ==
@@ -96,7 +96,7 @@ else 사용자 존재
end note
Service ->> UserRepo: updateLastLoginAt(userId)
activate UserRepo
UserRepo ->> UserDB: 최종 로그인 시각 업데이트\n(현재 시각으로 갱신)
UserRepo ->> UserDB: 사용자 최종 로그인 시각 갱신\n(현재 시각으로 업데이트)
activate UserDB
UserDB -->> UserRepo: 업데이트 완료
deactivate UserDB
@@ -113,11 +113,11 @@ else 사용자 존재
== 6단계: 응답 반환 ==
AuthService -> AuthService: 응답 DTO 생성\n(LoginResponse)
AuthService --> Controller: LoginResponse\n(token, userId, userName,\nrole, email)
AuthService -> AuthService: 로그인 응답 DTO 생성
AuthService --> Controller: LoginResponse\n{token, userId, userName, role, email}
deactivate AuthService
Controller --> Client: 200 OK\n{"token": "jwt_token",\n"userId": 123,\n"userName": "홍길동",\n"role": "OWNER",\n"email": "hong@example.com"}
Controller --> Client: 200 OK\n{"token": "eyJhbGc...",\n"userId": 123,\n"userName": "홍길동",\n"role": "OWNER",\n"email": "hong@example.com"}
deactivate Controller
end
end
@@ -125,7 +125,7 @@ end
note over Controller, UserDB
**보안 처리**
- 비밀번호: bcrypt compare (원본 노출 안 됨)
- 에러 메시지: 전화번호/비밀번호 구분 없이 동일 메시지 반환 (Timing Attack 방어)
- 에러 메시지: 이메일/비밀번호 구분 없이 동일 메시지 반환 (Timing Attack 방어)
- JWT 토큰: 7일 만료, 서버 세션과 동기화
**보안 강화 (향후 구현)**
@@ -141,7 +141,7 @@ note over Controller, UserDB
- Redis 세션 조회: 0.1초 이내
**에러 코드**
- AUTH_001: 인증 실패 (전화번호 또는 비밀번호 불일치)
- AUTH_001: 인증 실패 (이메일 또는 비밀번호 불일치)
end note
@enduml