* feat: Add infrastructure for no-show audit integration - Add Prisma migrations for SYSTEM source and NO_SHOW_UPDATED audit action - Add NoShowUpdatedAuditActionService with array-based attendeesNoShow schema - Update BookingAuditActionServiceRegistry to include NO_SHOW_UPDATED - Update BookingAuditTaskConsumer and BookingAuditViewerService - Add AttendeeRepository methods for no-show queries - Update IAuditActionService interface with values array support - Update locales with no-show audit translation keys Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Add NO_SHOW_UPDATED to BookingAuditAction and SYSTEM to ActionSource types Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Remove HOST_NO_SHOW_UPDATED and ATTENDEE_NO_SHOW_UPDATED from BookingAuditAction type to match Prisma schema Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Update BookingAuditActionSchema to use NO_SHOW_UPDATED instead of HOST_NO_SHOW_UPDATED and ATTENDEE_NO_SHOW_UPDATED Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * refactor: Remove deprecated no-show audit services and unify to NoShowUpdatedAuditActionService - Delete HostNoShowUpdatedAuditActionService and AttendeeNoShowUpdatedAuditActionService - Update BookingAuditProducerService.interface.ts to use queueNoShowUpdatedAudit - Update BookingAuditTaskerProducerService.ts to use queueNoShowUpdatedAudit - Update BookingEventHandlerService.ts to use onNoShowUpdated - Add integration tests for NoShowUpdatedAuditActionService Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Add data migration step for deprecated no-show enum values Addresses Cubic AI review feedback (confidence 9/10): The migration now includes an UPDATE statement to convert existing records using the deprecated 'host_no_show_updated' or 'attendee_no_show_updated' enum values to the new unified 'no_show_updated' value before the type cast. This prevents migration failures if any existing data uses the old values. Co-Authored-By: unknown <> * fix: Use CASE expression in USING clause for enum migration Fixes PostgreSQL error 'unsafe use of new value of enum type' by avoiding the ADD VALUE statement and instead using a CASE expression in the ALTER TABLE USING clause to convert deprecated enum values (host_no_show_updated, attendee_no_show_updated) to the new unified value (no_show_updated) during the type conversion. Co-Authored-By: unknown <> * fix: Replace hardcoded color with semantic text-success class Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: Remove color class completely from display fields Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
227 lines
7.4 KiB
TypeScript
227 lines
7.4 KiB
TypeScript
import { z } from "zod";
|
|
|
|
import type { Actor, BookingAuditContext } from "../dto/types";
|
|
import type { ActionSource } from "../types/actionSource";
|
|
import { AcceptedAuditActionService } from "../actions/AcceptedAuditActionService";
|
|
import { AttendeeAddedAuditActionService } from "../actions/AttendeeAddedAuditActionService";
|
|
import { AttendeeRemovedAuditActionService } from "../actions/AttendeeRemovedAuditActionService";
|
|
import { CancelledAuditActionService } from "../actions/CancelledAuditActionService";
|
|
import { CreatedAuditActionService } from "../actions/CreatedAuditActionService";
|
|
import { LocationChangedAuditActionService } from "../actions/LocationChangedAuditActionService";
|
|
import { NoShowUpdatedAuditActionService } from "../actions/NoShowUpdatedAuditActionService";
|
|
import { ReassignmentAuditActionService } from "../actions/ReassignmentAuditActionService";
|
|
import { RejectedAuditActionService } from "../actions/RejectedAuditActionService";
|
|
import { RescheduleRequestedAuditActionService } from "../actions/RescheduleRequestedAuditActionService";
|
|
import { RescheduledAuditActionService } from "../actions/RescheduledAuditActionService";
|
|
import { SeatBookedAuditActionService } from "../actions/SeatBookedAuditActionService";
|
|
import { SeatRescheduledAuditActionService } from "../actions/SeatRescheduledAuditActionService";
|
|
|
|
/**
|
|
* BookingAuditProducerService Interface
|
|
*
|
|
* Producer abstraction for queueing booking audit tasks.
|
|
* Allows for multiple implementations (e.g., Tasker, Trigger.dev).
|
|
*
|
|
* Uses specialized methods per action type for better TypeScript performance
|
|
* and type safety, avoiding large discriminated unions.
|
|
*
|
|
* Implementations:
|
|
* - BookingAuditTaskerProducerService: Uses Tasker for local/background jobs
|
|
* - BookingAuditTriggerProducerService: (Future) Uses Trigger.dev for cloud jobs
|
|
*/
|
|
export interface BookingAuditProducerService {
|
|
queueCreatedAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof CreatedAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueRescheduledAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof RescheduledAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueAcceptedAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof AcceptedAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueCancelledAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof CancelledAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueRescheduleRequestedAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof RescheduleRequestedAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueAttendeeAddedAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof AttendeeAddedAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueNoShowUpdatedAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof NoShowUpdatedAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueRejectedAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof RejectedAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueAttendeeRemovedAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof AttendeeRemovedAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueReassignmentAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof ReassignmentAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueLocationChangedAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof LocationChangedAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueSeatBookedAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof SeatBookedAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueSeatRescheduledAudit(params: {
|
|
bookingUid: string;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
data: z.infer<typeof SeatRescheduledAuditActionService.latestFieldsSchema>;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
/**
|
|
* Queues a bulk accepted audit task for multiple bookings
|
|
*/
|
|
queueBulkAcceptedAudit(params: {
|
|
bookings: Array<{
|
|
bookingUid: string;
|
|
data: z.infer<typeof AcceptedAuditActionService.latestFieldsSchema>;
|
|
}>;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
/**
|
|
* Queues a bulk cancelled audit task for multiple bookings
|
|
*/
|
|
queueBulkCancelledAudit(params: {
|
|
bookings: Array<{
|
|
bookingUid: string;
|
|
data: z.infer<typeof CancelledAuditActionService.latestFieldsSchema>;
|
|
}>;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
|
|
queueBulkCreatedAudit(params: {
|
|
bookings: Array<{
|
|
bookingUid: string;
|
|
data: z.infer<typeof CreatedAuditActionService.latestFieldsSchema>;
|
|
}>;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
}): Promise<void>;
|
|
|
|
queueBulkRescheduledAudit(params: {
|
|
bookings: Array<{
|
|
bookingUid: string;
|
|
data: z.infer<typeof RescheduledAuditActionService.latestFieldsSchema>;
|
|
}>;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
}): Promise<void>;
|
|
|
|
queueBulkRejectedAudit(params: {
|
|
bookings: Array<{
|
|
bookingUid: string;
|
|
data: z.infer<typeof RejectedAuditActionService.latestFieldsSchema>;
|
|
}>;
|
|
actor: Actor;
|
|
organizationId: number | null;
|
|
source: ActionSource;
|
|
operationId?: string | null;
|
|
context?: BookingAuditContext;
|
|
}): Promise<void>;
|
|
}
|