### QR Code Data Structure Examples Source: https://context7_llms Illustrates the expected JSON structures for different types of QR codes used in the system: QR_DINAMICO, E_TICKET, and CANJE. Each structure includes essential fields like type, ticketSecret, and ticketId, with specific fields for validation. ```json { "type": "QR_DINAMICO", "ticketSecret": "564 895", "ticketId": 1 } ``` ```json { "type": "E_TICKET", "ticketSecret": "c3d290542735e352d5a9c2c4ba82ba3c375bf488f7bd70871bb64c906da8b16f", "ticketId": 1 } ``` ```json { "type": "CANJE", "ticketSecret": "5ec146ba753720975bea38985b49b702f2b7939137c54a9b8774320a1f4cceb6", "printVersion": 3, "ticketId": 1 } ``` -------------------------------- ### Validate Ticket Burn Time Logic Source: https://context7_llms Checks if an event is within the allowed date and time window for ticket burning. It considers the event start date and the door open time, with a configurable grace period before the door opens. ```typescript import { MINUTES_BEFORE_DOOR_OPEN } from "@/Common/config/constants.config"; function canBurnTickets(startDateEvent: Date, openDoorTime: Date): boolean { const now = new Date(); const isEventTodayOrPast = now >= startDateEvent; const isBeforeDoorOpenWindow = now <= new Date(openDoorTime.getTime() - MINUTES_BEFORE_DOOR_OPEN * 60000); return isEventTodayOrPast && isBeforeDoorOpenWindow; } ``` -------------------------------- ### Manual Synchronization Trigger Source: https://context7_llms Illustrates the mechanism for manually triggering a data synchronization process. This is essential for ensuring data consistency, especially for the initial sync before scanning can begin. ```typescript import { syncMovements } from "@/Common/Service/SyncMovements/syncMovements.service"; // Triggered by a button in the Drawer Header function handleManualSync() { syncMovements(); } ``` -------------------------------- ### Register Movement Functions Source: https://context7_llms Provides functions for logging successful and erroneous movements within the scanner system. These functions are crucial for tracking ticket usage and potential issues. ```typescript import { registerErrorMovement, registerSuccessfulMovement } from "@/Common/Hooks/Scanner/shared/useMovementLogger"; // Example usage: // registerSuccessfulMovement(ticketId, 'REDEEMED', controllerId, controlDatetime); // registerErrorMovement(ticketId, STATUS_SCANNER.INVALID, controllerId); ``` -------------------------------- ### Movement Status Mapping Source: https://context7_llms Defines the mapping between internal scanner status codes (STATUS_SCANNER) and the control status format used by the backend (ControlStatus). This ensures consistent reporting of movement outcomes. ```typescript const statusMapping = { APROVED: 'VALIDATED', JOINED: 'ALREADY_USED', UNSUSCRIBED: 'CANCELLED', REJECTED: 'REJECTED', UNKNOWN: 'NOT_FOUND', INVALID: 'NOT_FOUND', ENTRY_INCORRECT: 'WRONG_ACCESS' }; function mapStatus(internalStatus: keyof typeof statusMapping): string { return statusMapping[internalStatus]; } ``` -------------------------------- ### Ticket Burning Update Logic Source: https://context7_llms Details the updates applied to a ticket record when its entry is successfully burned. This includes changing the ticket status and recording the controller and timestamp of the action. ```typescript function burnTicket(ticket: any, controllerId: string, controlDatetime: Date) { if (!isVerifyMode) { ticket.ticketStatus = 'REDEEMED'; ticket.controllerId = controllerId; ticket.controlDatetime = controlDatetime; // Save updated ticket } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.