추천안선택생성

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Hyowon Yang 2025-10-23 13:50:58 +09:00
parent ae6e593a7a
commit 36e7e60ae3

View File

@ -0,0 +1,53 @@
@startuml event-추천안선택
!theme mono
title Event Service - 선택한 AI 추천안 저장 (UFR-EVENT-040)
participant "EventController" as Controller <<C>>
participant "EventService" as Service <<S>>
participant "EventRepository" as Repo <<R>>
participant "Redis Cache" as Cache <<E>>
database "Event DB" as DB <<E>>
note over Controller: PUT /api/events/drafts/{id}/recommendation
Controller -> Service: updateEventRecommendation(eventDraftId, userId,\nselectedRecommendation)
activate Service
Service -> Repo: findById(eventDraftId)
activate Repo
Repo -> DB: 이벤트 초안 조회\n(초안ID와 사용자ID로 조회)
activate DB
DB --> Repo: EventDraft
deactivate DB
Repo --> Service: EventDraft entity
deactivate Repo
Service -> Service: validateOwnership(userId, eventDraft)
Service -> Service: validateRecommendation(selectedRecommendation)
note right: 선택한 추천안\n유효성 검증
Service -> Service: applyRecommendation(eventDraft, selectedRecommendation)
note right: 추천안 적용:\n- 이벤트 제목\n- 경품 정보\n- 참여 방법\n- 예상 비용\n- 예상 ROI
Service -> Repo: update(eventDraft)
activate Repo
Repo -> DB: 이벤트 초안 업데이트\n(선택된 추천안 정보,\n제목, 경품, 참여방법,\n예상비용, 예상ROI,\n수정일시를 업데이트)
activate DB
DB --> Repo: OK
deactivate DB
Repo --> Service: EventDraft entity
deactivate Repo
Service -> Cache: delete("ai:recommendation:" + eventDraftId)
activate Cache
note right: Redis 캐시 무효화\n(AI 추천 결과)
Cache --> Service: OK
deactivate Cache
Service --> Controller: EventRecommendationResponse\n{eventDraftId, selectedRecommendation}
deactivate Service
Controller --> Client: 200 OK\n{eventDraftId}
note over Controller, Cache: 최종 선택된 추천안만\nEvent DB에 저장됨\n\nRedis에 저장된 3가지 추천안은\n선택 후 삭제됨
@enduml