refactor: migrate event creation flow to use centralized eventStore#77
Conversation
- Removed the event-create-store.ts file and replaced its functionality with a new eventStore. - Updated event detail types to remove is_seat_pickable property. - Refactored seatmap and shows creation pages to utilize the new eventStore for session management. - Enhanced seatmap creation logic to handle draft data more effectively. - Implemented PUT method for updating shows while preserving existing sections and seats. - Cleaned up unused code and improved overall structure for better maintainability.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (19)
📝 WalkthroughWalkthroughThis PR removes the Changes
Sequence Diagram(s)sequenceDiagram
participant Admin as Admin User
participant UI as Shows Edit UI
participant API as PUT /api/events/create/shows
participant Service as eventService.updateShows()
participant DB as Database (Transaction)
Admin->>UI: Submit updated shows list
UI->>API: PUT request with shows array
API->>Service: updateShows(adminId, data)
Service->>DB: BEGIN TRANSACTION
Service->>DB: Validate event ownership & status
Service->>DB: SELECT existing shows by id
alt Update existing show
Service->>DB: UPDATE eventShow (by index)
else Insert new show
Service->>DB: INSERT new eventShow
end
Service->>DB: Track kept show IDs
Service->>DB: DELETE excess shows & cascade seats/seatSections
Service->>DB: COMMIT TRANSACTION
DB-->>Service: Transaction complete
Service-->>API: Return updated shows metadata
API-->>UI: json({ data: [...shows] })
UI->>UI: Update local state, notify user
Note over Admin,DB: Sections & seats preserved for updated shows
sequenceDiagram
participant User as Customer
participant EventPage as Event Detail Page
participant Store as SeatmapPreview Component
participant SVG as SVG Canvas
User->>EventPage: Load event detail
EventPage->>Store: Render SeatmapPreview with mapConfig, stageLayout, sections
Store->>Store: Initialize container ResizeObserver
Store->>Store: Set up zoom/pan state, tooltip tracking
Store->>SVG: Render stage elements & section polygons
alt Zoom Level ≥ threshold (assigned sections)
Store->>SVG: Render individual seat dots (LOD detail)
else Zoom < threshold
Store->>SVG: Render section label, availability %, price tag
end
User->>SVG: Scroll/wheel to zoom
Store->>Store: Update zoom level (bounded)
Store->>SVG: Re-render with LOD
User->>SVG: Hover over section
Store->>Store: Update tooltip (section name, price, available)
Store->>SVG: Show tooltip overlay
Note over User,SVG: Interactive pan/zoom with responsive LOD rendering
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes The diff spans multiple architectural layers (store, service, schemas, UI components) with heterogeneous changes ranging from field removals to new complex components (SeatmapPreview with 658 lines and stateful SVG rendering). While many changes are straightforward removals or wiring updates, the new show-update transaction logic, reactive store implementation, intricate seatmap preview with LOD rendering, and validation enhancements across multiple pages require careful reasoning for correctness and integration consistency. Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Mô tả
Sửa lỗi khi tạo sự kiện mới do logic chưa đúng đắn.
Cải thiện lại UI và logic render seat map.
Closes #57
Loại thay đổi
Screenshots / Demo
Checklist
bun run dev)bun run check)bun run lint)bun run format)feat:,fix:,chore:,...)Summary by CodeRabbit
Release Notes
New Features
Improvements