edit all sequence
This commit is contained in:
@@ -9,56 +9,56 @@ participant "EventRepository" as Repo <<R>>
|
||||
participant "Redis Cache" as Cache <<E>>
|
||||
database "Event DB" as DB <<E>>
|
||||
|
||||
note over Controller: GET /api/events?status={status}&keyword={keyword}\n&page={page}&size={size}
|
||||
Controller -> Service: getEventList(userId, filters, pagination)
|
||||
note over Controller: GET /api/events?status={상태}&keyword={검색어}\n&page={페이지}&size={크기}
|
||||
Controller -> Service: 이벤트 목록 조회(사용자ID, 필터, 페이징)
|
||||
activate Service
|
||||
|
||||
Service -> Cache: get("events:" + userId + ":" + filters + ":" + page)
|
||||
Service -> Cache: 캐시 조회("events:" + 사용자ID + ":" + 필터 + ":" + 페이지)
|
||||
activate Cache
|
||||
|
||||
alt 캐시 히트
|
||||
Cache --> Service: Event list data
|
||||
Service --> Controller: EventListResponse
|
||||
Cache --> Service: 이벤트 목록 데이터
|
||||
Service --> Controller: 이벤트 목록 응답
|
||||
|
||||
else 캐시 미스
|
||||
Cache --> Service: null
|
||||
deactivate Cache
|
||||
|
||||
Service -> Repo: findByUserIdWithFilters(userId, filters, pagination)
|
||||
Service -> Repo: 사용자별 필터링 이벤트 조회(사용자ID, 필터, 페이징)
|
||||
activate Repo
|
||||
|
||||
alt 필터 있음 (상태별)
|
||||
Repo -> DB: SELECT e.*, COUNT(p.id) as participant_count\nFROM events e\nLEFT JOIN participants p ON e.id = p.event_id\nWHERE e.user_id = ?\nAND e.status = ?\nGROUP BY e.id\nORDER BY e.created_at DESC\nLIMIT ? OFFSET ?
|
||||
Repo -> DB: 사용자별 특정 상태 이벤트 조회\n(참여자 수 포함, 생성일 기준 내림차순,\n페이징 적용)
|
||||
else 검색 있음 (키워드)
|
||||
Repo -> DB: SELECT e.*, COUNT(p.id) as participant_count\nFROM events e\nLEFT JOIN participants p ON e.id = p.event_id\nWHERE e.user_id = ?\nAND (e.title LIKE ? OR e.description LIKE ?)\nGROUP BY e.id\nORDER BY e.created_at DESC\nLIMIT ? OFFSET ?
|
||||
Repo -> DB: 사용자별 이벤트 키워드 검색\n(제목/설명에서 검색, 참여자 수 포함,\n생성일 기준 내림차순, 페이징 적용)
|
||||
else 필터 없음 (전체)
|
||||
Repo -> DB: SELECT e.*, COUNT(p.id) as participant_count\nFROM events e\nLEFT JOIN participants p ON e.id = p.event_id\nWHERE e.user_id = ?\nGROUP BY e.id\nORDER BY e.created_at DESC\nLIMIT ? OFFSET ?
|
||||
Repo -> DB: 사용자별 전체 이벤트 목록 조회\n(참여자 수 포함, 생성일 기준 내림차순,\n페이징 적용)
|
||||
end
|
||||
|
||||
activate DB
|
||||
note right: 인덱스 활용:\n- user_id\n- status\n- created_at
|
||||
DB --> Repo: Event list with participant count
|
||||
note right: 인덱스 활용:\n- 사용자ID\n- 상태\n- 생성일시
|
||||
DB --> Repo: 이벤트 목록 및 참여자 수
|
||||
deactivate DB
|
||||
|
||||
Repo -> DB: SELECT COUNT(*) FROM events\nWHERE user_id = ? [AND filters]
|
||||
Repo -> DB: 전체 이벤트 개수 조회\n(필터 조건 포함, 페이징용)
|
||||
activate DB
|
||||
DB --> Repo: totalCount
|
||||
DB --> Repo: 전체 개수
|
||||
deactivate DB
|
||||
|
||||
Repo --> Service: PagedResult<Event>
|
||||
Repo --> Service: 페이징된 이벤트 결과
|
||||
deactivate Repo
|
||||
|
||||
Service -> Cache: set("events:" + userId + ":" + filters + ":" + page,\npagedResult, TTL=1분)
|
||||
Service -> Cache: 캐시 저장("events:" + 사용자ID + ":" + 필터 + ":" + 페이지,\n페이징결과, TTL=1분)
|
||||
activate Cache
|
||||
Cache --> Service: OK
|
||||
deactivate Cache
|
||||
end
|
||||
|
||||
Service --> Controller: EventListResponse\n{events: [...], totalCount,\ntotalPages, currentPage}
|
||||
Service --> Controller: 이벤트 목록 응답\n{이벤트목록: [...], 전체개수,\n전체페이지수, 현재페이지}
|
||||
deactivate Service
|
||||
|
||||
Controller --> Client: 200 OK\n{events: [\n {eventId, title, period, status,\n participantCount, roi, createdAt},\n ...\n],\ntotalCount, totalPages, currentPage}
|
||||
Controller --> Client: 200 OK\n{이벤트목록: [\n {이벤트ID, 제목, 기간, 상태,\n 참여자수, ROI, 생성일시},\n ...\n],\n전체개수, 전체페이지수, 현재페이지}
|
||||
|
||||
note over Controller, DB: 필터 옵션:\n- status: DRAFT, ACTIVE, COMPLETED\n- 기간: 최근 1개월/3개월/6개월/1년\n- 정렬: 최신순, 참여자 많은 순,\n ROI 높은 순\n\n페이지네이션:\n- 기본 20개/페이지\n- 페이지 번호 기반
|
||||
note over Controller, DB: 필터 옵션:\n- 상태: 임시저장, 진행중, 완료\n- 기간: 최근 1개월/3개월/6개월/1년\n- 정렬: 최신순, 참여자 많은 순,\n ROI 높은 순\n\n페이지네이션:\n- 기본 20개/페이지\n- 페이지 번호 기반
|
||||
|
||||
@enduml
|
||||
|
||||
Reference in New Issue
Block a user