mirror of
https://github.com/ktds-dg0501/kt-event-marketing.git
synced 2025-12-06 22:46:24 +00:00
65 lines
2.7 KiB
Plaintext
65 lines
2.7 KiB
Plaintext
@startuml event-목록조회
|
|
!theme mono
|
|
|
|
title Event Service - 이벤트 목록 조회 (필터/검색) (UFR-EVENT-070)
|
|
|
|
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: GET /api/events?status={status}&keyword={keyword}\n&page={page}&size={size}
|
|
Controller -> Service: getEventList(userId, filters, pagination)
|
|
activate Service
|
|
|
|
Service -> Cache: get("events:" + userId + ":" + filters + ":" + page)
|
|
activate Cache
|
|
|
|
alt 캐시 히트
|
|
Cache --> Service: Event list data
|
|
Service --> Controller: EventListResponse
|
|
|
|
else 캐시 미스
|
|
Cache --> Service: null
|
|
deactivate Cache
|
|
|
|
Service -> Repo: findByUserIdWithFilters(userId, filters, pagination)
|
|
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 ?
|
|
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 ?
|
|
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 ?
|
|
end
|
|
|
|
activate DB
|
|
note right: 인덱스 활용:\n- user_id\n- status\n- created_at
|
|
DB --> Repo: Event list with participant count
|
|
deactivate DB
|
|
|
|
Repo -> DB: SELECT COUNT(*) FROM events\nWHERE user_id = ? [AND filters]
|
|
activate DB
|
|
DB --> Repo: totalCount
|
|
deactivate DB
|
|
|
|
Repo --> Service: PagedResult<Event>
|
|
deactivate Repo
|
|
|
|
Service -> Cache: set("events:" + userId + ":" + filters + ":" + page,\npagedResult, TTL=1분)
|
|
activate Cache
|
|
Cache --> Service: OK
|
|
deactivate Cache
|
|
end
|
|
|
|
Service --> Controller: EventListResponse\n{events: [...], totalCount,\ntotalPages, currentPage}
|
|
deactivate Service
|
|
|
|
Controller --> Client: 200 OK\n{events: [\n {eventId, title, period, status,\n participantCount, roi, createdAt},\n ...\n],\ntotalCount, totalPages, currentPage}
|
|
|
|
note over Controller, DB: 필터 옵션:\n- status: DRAFT, ACTIVE, COMPLETED\n- 기간: 최근 1개월/3개월/6개월/1년\n- 정렬: 최신순, 참여자 많은 순,\n ROI 높은 순\n\n페이지네이션:\n- 기본 20개/페이지\n- 페이지 번호 기반
|
|
|
|
@enduml
|