feat: added event dashboard and event states#29
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a real-time (SSE) event dashboard module plus introduces event operational states and exchange-rate sourcing (BCV/paralelo/custom) that affect ticket pricing and sales/access flows across API + Web.
Changes:
- Adds API dashboard module with summary endpoint + SSE stream, plus a shared dashboard contract (
EventDashboardSummary,CheckInEvent). - Adds BCV rate scraping/provider + persistence, and extends exchange-rate/event models to support
rateSource/auto-sync. - Enforces event
statusgating (DRAFT/CANCELLED block sales and door access) and updates Web UX to early-return/lock UI when inactive.
Reviewed changes
Copilot reviewed 70 out of 72 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Locks new dependencies (notably cheerio/undici) used for BCV scraping. |
| packages/web/vite.config.ts | Adjusts dependency optimization config for the web app. |
| packages/web/src/features/events/services/dashboardService.ts | Adds web client for dashboard summary endpoint. |
| packages/web/src/features/events/services/bcvService.ts | Adds web client for BCV rate endpoints. |
| packages/web/src/features/events/pages/TicketTypesPage.tsx | Updates ticket type pricing display/inputs for rateSource + usdPrice. |
| packages/web/src/features/events/pages/SalesPage.tsx | Enhances sales UI (multi-currency, change, incomplete payment warning, inactive-event lock). |
| packages/web/src/features/events/pages/EventDetailPage.tsx | Role-based default sub-route redirects and guards. |
| packages/web/src/features/events/pages/EventConfigPage.tsx | Adds event status controls + BCV rate UI + rateSource selector. |
| packages/web/src/features/events/pages/DoorCheckPage.tsx | Adds early-return lock UI when event is inactive. |
| packages/web/src/features/events/hooks/useCurrentExchangeRate.ts | Adds refetch-on-event and error logging for exchange rate. |
| packages/web/src/components/Layout.tsx | Restricts dashboard nav item to ADMIN/ORGANIZER. |
| packages/shared/src/utils/currency.ts | Adds divisa conversion helpers and EUR/USD derivation helper. |
| packages/shared/src/types/ticketType.types.ts | Extends currency types and adds usdPrice to ticket types. |
| packages/shared/src/types/index.ts | Re-exports new BCV and dashboard types. |
| packages/shared/src/types/exchangeRate.types.ts | Adds source and makes setBy* optional. |
| packages/shared/src/types/event.types.ts | Adds autoSyncBcv and rateSource to event type. |
| packages/shared/src/types/dashboard.types.ts | Introduces dashboard contracts + SSE event naming. |
| packages/shared/src/types/bcv.types.ts | Adds BCV rate DTO contract. |
| packages/shared/src/schemas/ticketType.schemas.ts | Extends currency enum to include EUR. |
| packages/shared/src/schemas/sale.schemas.ts | Improves customer validation and empty-string preprocessing. |
| packages/shared/src/schemas/event.schemas.ts | Adds autoSyncBcv, rateSource, and status to event schemas. |
| packages/api/tsconfig.json | Formatting-only tsconfig include change. |
| packages/api/src/modules/tickets/ticket-crypto.service.ts | Formatting fix in signature verification method. |
| packages/api/src/modules/ticket-types/ticket-types.service.ts | Adds usdPrice handling and rate-aware ticket pricing. |
| packages/api/src/modules/ticket-types/ticket-types.mapper.ts | Maps usdPrice to API type. |
| packages/api/src/modules/ticket-types/index.ts | Injects exchange rate repository into ticket types module. |
| packages/api/src/modules/sales/sales.service.ts | Adds event status gating + multi-currency payment handling + change adjustment. |
| packages/api/src/modules/sales/index.ts | Wires new repositories into sales module. |
| packages/api/src/modules/exchange-rates/exchange-rates.service.ts | Adds optional setBy and exchange-rate source. |
| packages/api/src/modules/exchange-rates/exchange-rates.mapper.ts | Maps source and optional setBy* fields. |
| packages/api/src/modules/events/events.service.ts | Adds rateSource/autoSync/status update handling and ticket type rewrites on CUSTOM. |
| packages/api/src/modules/events/events.mapper.ts | Maps new event fields to shared type. |
| packages/api/src/modules/dashboard/index.ts | Registers dashboard module wiring. |
| packages/api/src/modules/dashboard/dashboard.service.ts | Adds dashboard summary service wrapper. |
| packages/api/src/modules/dashboard/dashboard.routes.ts | Adds dashboard routes + SSE stream route with admin role guard. |
| packages/api/src/modules/dashboard/dashboard.controller.ts | Implements dashboard summary handler + SSE streaming with heartbeat/cleanup. |
| packages/api/src/modules/bcv/index.ts | Registers BCV module wiring. |
| packages/api/src/modules/bcv/bcv.service.ts | Provides BCV rate read/sync service. |
| packages/api/src/modules/bcv/bcv.routes.ts | Adds BCV endpoints + auth/admin protection. |
| packages/api/src/modules/bcv/bcv.mapper.ts | Maps persisted BCV rate to API DTO. |
| packages/api/src/modules/bcv/bcv.controller.ts | Adds controller for BCV read/sync endpoints. |
| packages/api/src/modules/access/index.ts | Injects event repository into access module. |
| packages/api/src/modules/access/access.service.ts | Adds event status gating + publishes check-in SSE events. |
| packages/api/src/modules/access/access.controller.ts | Hardens requestContext usage before calling access service. |
| packages/api/src/infrastructure/repositories/PrismaTicketTypeRepository.ts | Persists/maps new usdPrice field. |
| packages/api/src/infrastructure/repositories/PrismaTicketRepository.ts | Adds countUsedByEvent for attendance recomputation. |
| packages/api/src/infrastructure/repositories/PrismaOrderRepository.ts | Persists order currency based on item currency. |
| packages/api/src/infrastructure/repositories/PrismaExchangeRateRepository.ts | Supports nullable setBy and adds source mapping/persistence. |
| packages/api/src/infrastructure/repositories/PrismaEventRepository.ts | Persists/maps new event fields + adds auto-sync event query. |
| packages/api/src/infrastructure/repositories/PrismaDashboardRepository.ts | Implements dashboard aggregation and payment scaling logic. |
| packages/api/src/infrastructure/repositories/PrismaBcvRateRepository.ts | Adds BCV rate persistence and retrieval. |
| packages/api/src/infrastructure/EventCheckInEmitter.ts | Adds in-memory pub/sub for check-ins. |
| packages/api/src/infrastructure/container.ts | Wires new modules, repositories, and provider initialization. |
| packages/api/src/infrastructure/bcv/scraper.ts | Implements BCV + paralelo rate scraping/fetching. |
| packages/api/src/infrastructure/bcv/provider.ts | Adds cached provider + event auto-sync behavior. |
| packages/api/src/index.ts | Adds auth-specific rate limiter + initializes providers before listen. |
| packages/api/src/core/interfaces/repositories/ITicketTypeRepository.ts | Extends repository contract for usdPrice. |
| packages/api/src/core/interfaces/repositories/ITicketRepository.ts | Adds countUsedByEvent. |
| packages/api/src/core/interfaces/repositories/IExchangeRateRepository.ts | Adds source and optional setBy to create contract. |
| packages/api/src/core/interfaces/repositories/IEventRepository.ts | Extends event repo contract with rateSource/status and auto-sync query. |
| packages/api/src/core/interfaces/repositories/IDashboardRepository.ts | Adds dashboard repository interface. |
| packages/api/src/core/interfaces/repositories/IBcvRateRepository.ts | Adds BCV rate repository interface. |
| packages/api/src/core/errors/BusinessErrors.ts | Adds EventNotActiveError business error. |
| packages/api/src/core/entities/TicketType.ts | Adds usdPrice to domain entity. |
| packages/api/src/core/entities/ExchangeRate.ts | Adds source and nullable setBy* to domain entity. |
| packages/api/src/core/entities/Event.ts | Adds autoSyncBcv and rateSource to domain entity. |
| packages/api/src/core/entities/BcvRate.ts | Adds BCV rate domain entity. |
| packages/api/prisma/schema.prisma | Adds BCV tables/fields and extends Event/TicketType/ExchangeRate schema. |
| packages/api/prisma/migrations/20260604191246_add_rate_source_and_usdt/migration.sql | Adds rateSource/usdtRate/usdPrice columns. |
| packages/api/prisma/migrations/20260602032103_add_bcv/migration.sql | Introduces BCV model and updates ExchangeRate constraints. |
| packages/api/package.json | Adds cheerio/undici dependencies for scraping/fetching. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot stopped work on behalf of
cristian907 due to an error
June 5, 2026 05:19
Abisaac1809
approved these changes
Jun 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: Módulo de Dashboard en Tiempo Real, Ajustes de Estado y Restricciones de Acceso de Eventos
📝 Descripción
Este Pull Request implementa el Módulo de Dashboard del Evento en tiempo real (de solo lectura), la funcionalidad avanzada para Ajustes de Estado del Evento en la vista de configuración general, el control financiero de ajuste de vuelto y advertencias de pago incompleto en taquilla, y un sistema robusto de bloqueo operacional inmediato en los módulos de venta y puerta si el evento no se encuentra activo (
DRAFToCANCELLED).🛠️ Cambios Realizados
1. Capa Compartida (
packages/shared)EventDashboardSummary) y eventos SSE de ingreso (CheckInEvent).DRAFT,ACTIVEyCANCELLED.2. Backend / API (
packages/api)dashboard/):PrismaDashboardRepositorypara KPIs del Dashboard.authorizeEventRole('admin'))./events/:eventId/dashboard/streamcon envío de heartbeats periódicos (pings) y limpieza automatizada de recursos al desconectarse el cliente.EventCheckInEmitter):EventEmitterpara notificar check-ins exitosos a los clientes SSE conectados.AccessServicetras check-ins QR (scanQr) o manuales (manualUse) para recalcular aforo y publicar eventos.sales.service.tspara denegar la creación de ventas (EventNotActiveError) si el evento no estáACTIVE.access.service.tspara rechazar validaciones QR/manuales y búsquedas por cédula si el evento no estáACTIVE.3. Frontend / Web (
packages/web)EventDashboardPage.tsx):EventConfigPage.tsx):BORRADOR,ACTIVOyCANCELADO.CANCELARo el nombre exacto del evento) para confirmación de cancelaciones.SalesPage.tsx):SalesPage.tsxyDoorCheckPage.tsxpara interceptar el renderizado tempranamente si el estado es inactivo.QrScannerView), evitando solicitudes de permisos innecesarios de hardware al estar inactivo.ADMINuORGANIZER(eventRole).🧪 Plan de Verificación
Pruebas Automatizadas
pnpm run linten todos los proyectos del espacio de trabajo.pnpm run type-check.pnpm run build).Verificación Manual (Paso a Paso)
Admine ir a la configuración de un evento para cambiar su estado aBORRADORoCANCELADO.COLLABORATORoSCANNER), el botón para redirigirse a los ajustes generales no aparezca en la tarjeta de bloqueo.close #15