* Integrate creation/rescheduling booking audit * fix: add missing hostUserUuid to booking audit test data Co-Authored-By: [email protected] <[email protected]> * fix-ci * feat: enhance booking audit with seat reference - Added support for seat reference in booking audit actions. - Updated localization for booking creation to include seat information. - Modified relevant services to pass attendee seat ID during booking creation. * fix: update test data to match schema requirements - Add seatReferenceUid: null to default mock audit log data - Add seatReferenceUid: null to multiple audit logs test case - Convert SEAT_RESCHEDULED test data to use numeric timestamps instead of ISO strings Co-Authored-By: [email protected] <[email protected]> * Allow nullish seatReferenceUid * feat: enhance booking audit to support rescheduledBy information - Updated booking audit actions to include rescheduledBy details, allowing tracking of who rescheduled a booking. - Refactored related services to accommodate the new rescheduledBy parameter in booking events. - Adjusted type definitions and function signatures to reflect the changes in the booking audit context. * Avoid possible run time issue * Fix imoport path * fix failing test due to merge from main\ * Pass useruuid * Refactor getDisplayTitle method signatures to use _params for consistency across audit action services. Update IAuditActionService to include dbStore in GetDisplayTitleParams for improved data handling during title retrieval. * fix: extend bulk-fetching optimization to actor and impersonator enrichment - Collect actor userUuids (for USER type actors) in collectDataRequirements - Collect impersonator UUIDs from log.context.impersonatedBy - Update enrichActorInformation to use dbStore.getUserByUuid() for USER actors - Update enrichImpersonator to use dbStore.getUserByUuid() - Update tests to verify findByUuids is called with correct aggregated UUIDs Co-Authored-By: [email protected] <[email protected]> * 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: [email protected] <[email protected]> * fix: Add NO_SHOW_UPDATED to BookingAuditAction and SYSTEM to ActionSource types Co-Authored-By: [email protected] <[email protected]> * fix: Remove HOST_NO_SHOW_UPDATED and ATTENDEE_NO_SHOW_UPDATED from BookingAuditAction type to match Prisma schema Co-Authored-By: [email protected] <[email protected]> * fix: Update BookingAuditActionSchema to use NO_SHOW_UPDATED instead of HOST_NO_SHOW_UPDATED and ATTENDEE_NO_SHOW_UPDATED Co-Authored-By: [email protected] <[email protected]> * 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: [email protected] <[email protected]> * 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: Remove dbStore usage from audit action services after merge - Update CreatedAuditActionService to use userRepository.findByUuid directly - Remove unused dbStore parameter from RescheduledAuditActionService - Sync test file with prepare-for-no-show-audit branch Co-Authored-By: [email protected] <[email protected]> * fix: Restore dbStore bulk-fetching optimization pattern - Add dbStore parameter and getDataRequirements method to IAuditActionService interface - Update CreatedAuditActionService to use dbStore.getUserByUuid() for bulk-fetched data - Update RescheduledAuditActionService to accept dbStore parameter - Update BookingAuditViewerService to: - Collect data requirements from all audit logs - Bulk-fetch users with findByUuids() before enrichment - Pass dbStore to action services and enrichment methods - Update tests to verify findByUuids is called for bulk-fetching optimization Co-Authored-By: [email protected] <[email protected]> * fix: Remove duplicate fireBookingEvents method in RecurringBookingService Co-Authored-By: [email protected] <[email protected]> * revert: Remove formatting-only changes in audit action services Co-Authored-By: [email protected] <[email protected]> * feat: Make getDataRequirements required and fetch rescheduled logs early - Make getDataRequirements a required method in IAuditActionService interface - Add getDataRequirements to all action services that didn't have it - Fetch rescheduled logs early to include their data requirements in bulk fetch - Update ReassignmentAuditActionService to use dbStore pattern instead of repository - Update NoShowUpdatedAuditActionService to use dbStore pattern - Update tests to use new dbStore pattern - Handle invalid data gracefully in collectDataRequirements Co-Authored-By: [email protected] <[email protected]> * Remve unncessary variable * feat: Implement Actor Strategy pattern for bulk-fetching attendees and credentials - Add ActorStrategies.ts with strategy pattern for all 5 actor types - Extend EnrichmentDataStore with StoredAttendee and StoredCredential types - Add findByIds method to CredentialRepository for bulk-fetching - Update BookingAuditViewerService to use strategy pattern: - Replace switch statement in enrichActorInformation with strategy dispatch - Update collectDataRequirements to collect attendeeIds and credentialIds - Update buildEnrichmentDataStore to bulk-fetch in parallel - Update tests to use findByIds mock and reflect graceful handling of missing data Co-Authored-By: [email protected] <[email protected]> * fix: Restore error-throwing for actors with missing required IDs - USER actor now throws error when userUuid is missing - ATTENDEE actor now throws error when attendeeId is missing - Updated tests to expect hasError: true for fallback logs Co-Authored-By: [email protected] <[email protected]> * fix: Restore original test assertions, only update mocks for bulk methods Co-Authored-By: [email protected] <[email protected]> * test: Add contract verification tests for getDataRequirements Co-Authored-By: [email protected] <[email protected]> * refactor: Clean up imports and improve type definitions in BookingAuditTaskConsumer and BookingAuditViewerService - Consolidated import statements for better readability - Enhanced type definitions for clarity and consistency - Updated method signatures to use destructured parameters for improved maintainability Co-Authored-By: [email protected] <[email protected]> * test: Split contract verification tests into separate files per action service Co-Authored-By: [email protected] <[email protected]> * test: Rename contract test files to .test.ts and merge into existing test file Co-Authored-By: [email protected] <[email protected]> * feat: Add runtime validation to EnrichmentDataStore for undeclared data access Co-Authored-By: [email protected] <[email protected]> * refactor: Make declaredRequirements required and add ensureFetched helper Co-Authored-By: [email protected] <[email protected]> * refactor: Simplify EnrichmentDataStore with constructor + fetch() pattern - Remove unused userIds and bookingUids from DataRequirements - Remove unused getUserById and getBookingByUid methods - Refactor constructor to accept requirements and repositories - Add fetch() method that fetches data and populates maps - Use Map keys as source of truth for declared requirements - Update getters to throw when accessing undeclared data - Add comprehensive unit tests for EnrichmentDataStore - Update BookingAuditViewerService to use new API - Update contractVerification.ts to remove unused tracking Co-Authored-By: [email protected] <[email protected]> * refactor: Clean up imports and improve type definitions in BookingAuditTaskConsumer and BookingAuditViewerService - Consolidated import statements for better readability - Enhanced type definitions for clarity and consistency - Updated method signatures to use destructured parameters for improved maintainability Co-Authored-By: [email protected] <[email protected]> * fix: Include contextRequirements in mergeDataRequirements and add accessedData assertions - Fix bug where contextRequirements (impersonator UUIDs) were not merged - Add accessedData assertions to CreatedAuditActionService.test.ts - Add accessedData assertions to ReassignmentAuditActionService.test.ts Co-Authored-By: [email protected] <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
409 lines
14 KiB
TypeScript
409 lines
14 KiB
TypeScript
import type { BookingRepository } from "@calcom/features/bookings/repositories/BookingRepository";
|
|
import type { IAttendeeRepository } from "@calcom/features/bookings/repositories/IAttendeeRepository";
|
|
import type { CredentialRepository } from "@calcom/features/credentials/repositories/CredentialRepository";
|
|
import type { ISimpleLogger } from "@calcom/features/di/shared/services/logger.service";
|
|
import type { MembershipRepository } from "@calcom/features/membership/repositories/MembershipRepository";
|
|
import type { UserRepository } from "@calcom/features/users/repositories/UserRepository";
|
|
import type { TranslationWithParams } from "../actions/IAuditActionService";
|
|
import { RescheduledAuditActionService } from "../actions/RescheduledAuditActionService";
|
|
import type { BookingAuditContext } from "../dto/types";
|
|
import type { AuditActorType } from "../repository/IAuditActorRepository";
|
|
import type {
|
|
BookingAuditAction,
|
|
BookingAuditType,
|
|
BookingAuditWithActor,
|
|
IBookingAuditRepository,
|
|
} from "../repository/IBookingAuditRepository";
|
|
import type { ActionSource } from "../types/actionSource";
|
|
import { enrichActor, getActorDataRequirements } from "./ActorStrategies";
|
|
import { BookingAuditAccessService } from "./BookingAuditAccessService";
|
|
import { BookingAuditActionServiceRegistry } from "./BookingAuditActionServiceRegistry";
|
|
import { type DataRequirements, EnrichmentDataStore } from "./EnrichmentDataStore";
|
|
|
|
interface BookingAuditViewerServiceDeps {
|
|
bookingAuditRepository: IBookingAuditRepository;
|
|
userRepository: UserRepository;
|
|
bookingRepository: BookingRepository;
|
|
membershipRepository: MembershipRepository;
|
|
attendeeRepository: IAttendeeRepository;
|
|
log: ISimpleLogger;
|
|
credentialRepository: CredentialRepository;
|
|
}
|
|
|
|
type EnrichedAuditLog = {
|
|
id: string;
|
|
bookingUid: string;
|
|
type: BookingAuditType;
|
|
action: BookingAuditAction;
|
|
timestamp: string;
|
|
createdAt: string;
|
|
source: ActionSource;
|
|
operationId: string;
|
|
displayJson?: Record<string, unknown> | null;
|
|
actionDisplayTitle: TranslationWithParams;
|
|
displayFields?: Array<{ labelKey: string; valueKey?: string; value?: string; values?: string[] }> | null;
|
|
actor: {
|
|
id: string;
|
|
type: AuditActorType;
|
|
userUuid: string | null;
|
|
attendeeId: number | null;
|
|
name: string | null;
|
|
createdAt: Date;
|
|
displayName: string;
|
|
displayEmail: string | null;
|
|
displayAvatar: string | null;
|
|
};
|
|
impersonatedBy?: {
|
|
displayName: string;
|
|
displayEmail: string | null;
|
|
displayAvatar: string | null;
|
|
} | null;
|
|
hasError?: boolean;
|
|
};
|
|
|
|
export type DisplayBookingAuditLog = EnrichedAuditLog;
|
|
|
|
/**
|
|
* BookingAuditViewerService - Service for viewing and formatting booking audit logs
|
|
*/
|
|
export class BookingAuditViewerService {
|
|
private readonly actionServiceRegistry: BookingAuditActionServiceRegistry;
|
|
private readonly bookingAuditRepository: IBookingAuditRepository;
|
|
private readonly userRepository: UserRepository;
|
|
private readonly bookingRepository: BookingRepository;
|
|
private readonly membershipRepository: MembershipRepository;
|
|
private readonly attendeeRepository: IAttendeeRepository;
|
|
private readonly credentialRepository: CredentialRepository;
|
|
private readonly rescheduledAuditActionService: RescheduledAuditActionService;
|
|
private readonly accessService: BookingAuditAccessService;
|
|
private readonly log: BookingAuditViewerServiceDeps["log"];
|
|
|
|
constructor(private readonly deps: BookingAuditViewerServiceDeps) {
|
|
this.bookingAuditRepository = deps.bookingAuditRepository;
|
|
this.userRepository = deps.userRepository;
|
|
this.bookingRepository = deps.bookingRepository;
|
|
this.membershipRepository = deps.membershipRepository;
|
|
this.attendeeRepository = deps.attendeeRepository;
|
|
this.credentialRepository = deps.credentialRepository;
|
|
this.log = deps.log;
|
|
this.rescheduledAuditActionService = new RescheduledAuditActionService();
|
|
this.accessService = new BookingAuditAccessService({
|
|
bookingRepository: this.bookingRepository,
|
|
membershipRepository: this.membershipRepository,
|
|
});
|
|
this.actionServiceRegistry = new BookingAuditActionServiceRegistry();
|
|
}
|
|
|
|
/**
|
|
* Get audit logs for a booking with full enrichment and formatting
|
|
* Handles permission checks, fetches logs, enriches actors, and formats display
|
|
*
|
|
* For bookings created from a reschedule (has fromReschedule field), this also
|
|
* fetches the last RESCHEDULED log from the previous booking and includes it
|
|
* as the first log entry with "rescheduled from" context.
|
|
*/
|
|
async getAuditLogsForBooking(params: {
|
|
bookingUid: string;
|
|
userId: number;
|
|
userEmail: string;
|
|
userTimeZone: string;
|
|
organizationId: number | null;
|
|
}): Promise<{ bookingUid: string; auditLogs: DisplayBookingAuditLog[] }> {
|
|
const { bookingUid, userId, userTimeZone, organizationId } = params;
|
|
await this.accessService.assertPermissions({
|
|
bookingUid,
|
|
userId,
|
|
organizationId,
|
|
});
|
|
|
|
const auditLogs = await this.bookingAuditRepository.findAllForBooking(bookingUid);
|
|
|
|
// Check if this booking was created from a reschedule - fetch early for data requirements
|
|
const fromRescheduleUid = await this.bookingRepository.getFromRescheduleUid(bookingUid);
|
|
const rescheduledLogs = fromRescheduleUid
|
|
? await this.bookingAuditRepository.findRescheduledLogsOfBooking(fromRescheduleUid)
|
|
: [];
|
|
|
|
const dataRequirements = this.collectDataRequirements([...auditLogs, ...rescheduledLogs]);
|
|
const dbStore = await this.buildEnrichmentDataStore(dataRequirements);
|
|
|
|
const enrichedAuditLogs = await Promise.all(
|
|
auditLogs.map(async (log) => {
|
|
try {
|
|
return await this.enrichAuditLog(log, userTimeZone, dbStore);
|
|
} catch (error) {
|
|
this.log.error(
|
|
`Failed to enrich audit log ${log.id}: ${error instanceof Error ? error.message : String(error)}`
|
|
);
|
|
return this.buildFallbackAuditLog(log);
|
|
}
|
|
})
|
|
);
|
|
|
|
// Build rescheduled from log if applicable
|
|
if (fromRescheduleUid && rescheduledLogs.length > 0) {
|
|
const rescheduledFromLog = await this.buildRescheduledFromLog({
|
|
fromRescheduleUid,
|
|
currentBookingUid: bookingUid,
|
|
userTimeZone,
|
|
dbStore,
|
|
rescheduledLogs,
|
|
});
|
|
if (rescheduledFromLog) {
|
|
enrichedAuditLogs.push(rescheduledFromLog);
|
|
}
|
|
}
|
|
|
|
return {
|
|
bookingUid: params.bookingUid,
|
|
auditLogs: enrichedAuditLogs,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Enriches a single audit log with actor information and formatted display data
|
|
*/
|
|
private async enrichAuditLog(
|
|
log: BookingAuditWithActor,
|
|
userTimeZone: string,
|
|
dbStore: EnrichmentDataStore
|
|
): Promise<EnrichedAuditLog> {
|
|
const enrichedActor = enrichActor(log.actor, dbStore);
|
|
|
|
const actionService = this.actionServiceRegistry.getActionService(log.action);
|
|
const parsedData = actionService.parseStored(log.data);
|
|
|
|
const actionDisplayTitle = await actionService.getDisplayTitle({
|
|
storedData: parsedData,
|
|
userTimeZone,
|
|
dbStore,
|
|
});
|
|
|
|
const displayJson = actionService.getDisplayJson
|
|
? actionService.getDisplayJson({ storedData: parsedData, userTimeZone })
|
|
: null;
|
|
|
|
const displayFields = actionService.getDisplayFields
|
|
? await actionService.getDisplayFields({ storedData: parsedData, dbStore })
|
|
: null;
|
|
|
|
const impersonatedBy = this.enrichImpersonator({ context: log.context, dbStore });
|
|
|
|
return {
|
|
id: log.id,
|
|
bookingUid: log.bookingUid,
|
|
type: log.type,
|
|
action: log.action,
|
|
timestamp: log.timestamp.toISOString(),
|
|
createdAt: log.createdAt.toISOString(),
|
|
source: log.source,
|
|
operationId: log.operationId,
|
|
displayJson,
|
|
actionDisplayTitle,
|
|
displayFields,
|
|
actor: {
|
|
id: log.actor.id,
|
|
type: log.actor.type,
|
|
userUuid: log.actor.userUuid,
|
|
attendeeId: log.actor.attendeeId,
|
|
name: log.actor.name,
|
|
createdAt: log.actor.createdAt,
|
|
displayName: enrichedActor.displayName,
|
|
displayEmail: enrichedActor.displayEmail,
|
|
displayAvatar: enrichedActor.displayAvatar,
|
|
},
|
|
impersonatedBy,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Builds a minimal fallback audit log when enrichment fails.
|
|
* Returns a log entry with hasError: true and basic information from the raw log.
|
|
*/
|
|
private buildFallbackAuditLog(log: BookingAuditWithActor): EnrichedAuditLog {
|
|
return {
|
|
id: log.id,
|
|
bookingUid: log.bookingUid,
|
|
type: log.type,
|
|
action: log.action,
|
|
timestamp: log.timestamp.toISOString(),
|
|
createdAt: log.createdAt.toISOString(),
|
|
source: log.source,
|
|
operationId: log.operationId,
|
|
displayJson: null,
|
|
actionDisplayTitle: {
|
|
key: "booking_audit_action.error_processing",
|
|
params: { actionType: log.action },
|
|
},
|
|
displayFields: null,
|
|
actor: {
|
|
id: log.actor.id,
|
|
type: log.actor.type,
|
|
userUuid: log.actor.userUuid,
|
|
attendeeId: log.actor.attendeeId,
|
|
name: log.actor.name,
|
|
createdAt: log.actor.createdAt,
|
|
displayName: log.actor.name || "Unknown",
|
|
displayEmail: null,
|
|
displayAvatar: null,
|
|
},
|
|
impersonatedBy: null,
|
|
hasError: true,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Builds a "rescheduled from" log entry for bookings created from a reschedule.
|
|
* Fetches the RESCHEDULED log from the previous booking and transforms it
|
|
* to show "rescheduled from" context for the current booking.
|
|
*/
|
|
private async buildRescheduledFromLog({
|
|
fromRescheduleUid,
|
|
currentBookingUid,
|
|
userTimeZone,
|
|
dbStore,
|
|
rescheduledLogs,
|
|
}: {
|
|
fromRescheduleUid: string;
|
|
currentBookingUid: string;
|
|
userTimeZone: string;
|
|
dbStore: EnrichmentDataStore;
|
|
rescheduledLogs: BookingAuditWithActor[];
|
|
}): Promise<EnrichedAuditLog | null> {
|
|
// Find the specific log that created this booking by matching rescheduledToUid
|
|
const rescheduledLog = this.rescheduledAuditActionService.getMatchingLog({
|
|
rescheduledLogs,
|
|
rescheduledToBookingUid: currentBookingUid,
|
|
});
|
|
|
|
if (!rescheduledLog) {
|
|
this.log.error(`No rescheduled log found for booking ${fromRescheduleUid} -> ${currentBookingUid}`);
|
|
// Instead of crashing, we ignore because it is important to be able to access other logs as well.
|
|
return null;
|
|
}
|
|
|
|
const enrichedLog = await this.enrichAuditLog(rescheduledLog, userTimeZone, dbStore);
|
|
const parsedData = this.rescheduledAuditActionService.parseStored(rescheduledLog.data);
|
|
|
|
// Transform the display JSON to show "rescheduled from" instead of "rescheduled to"
|
|
// by replacing rescheduledToUid with rescheduledFromUid
|
|
const transformedDisplayJson = enrichedLog.displayJson
|
|
? {
|
|
...enrichedLog.displayJson,
|
|
rescheduledFromUid: fromRescheduleUid,
|
|
}
|
|
: undefined;
|
|
|
|
return {
|
|
...enrichedLog,
|
|
// Override bookingUid to associate with the current booking being viewed
|
|
bookingUid: currentBookingUid,
|
|
displayJson: transformedDisplayJson,
|
|
// Use a different translation key to show "Rescheduled from" instead of "Rescheduled"
|
|
actionDisplayTitle: this.rescheduledAuditActionService.getDisplayTitleForRescheduledFromLog({
|
|
fromRescheduleUid,
|
|
userTimeZone,
|
|
storedData: parsedData,
|
|
}),
|
|
};
|
|
}
|
|
|
|
private enrichImpersonator({
|
|
context,
|
|
dbStore,
|
|
}: {
|
|
context: BookingAuditContext | null;
|
|
dbStore: EnrichmentDataStore;
|
|
}): {
|
|
displayName: string;
|
|
displayEmail: string | null;
|
|
displayAvatar: string | null;
|
|
} | null {
|
|
if (!context?.impersonatedBy) {
|
|
return null;
|
|
}
|
|
|
|
const impersonatorUser = dbStore.getUserByUuid(context.impersonatedBy);
|
|
if (!impersonatorUser) {
|
|
return {
|
|
displayName: "Deleted User",
|
|
displayEmail: null,
|
|
displayAvatar: null,
|
|
};
|
|
}
|
|
|
|
return {
|
|
displayName: impersonatorUser.name || impersonatorUser.email,
|
|
displayEmail: impersonatorUser.email,
|
|
displayAvatar: impersonatorUser.avatarUrl || null,
|
|
};
|
|
}
|
|
|
|
|
|
private mergeDataRequirements(...requirements: DataRequirements[]): DataRequirements {
|
|
const userUuids = new Set<string>();
|
|
const attendeeIds = new Set<number>();
|
|
const credentialIds = new Set<number>();
|
|
|
|
for (const requirement of requirements) {
|
|
for (const uuid of requirement.userUuids || []) userUuids.add(uuid);
|
|
for (const id of requirement.attendeeIds || []) attendeeIds.add(id);
|
|
for (const id of requirement.credentialIds || []) credentialIds.add(id);
|
|
}
|
|
|
|
return {
|
|
userUuids: Array.from(userUuids),
|
|
attendeeIds: Array.from(attendeeIds),
|
|
credentialIds: Array.from(credentialIds),
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Collect all data requirements from audit logs and action services
|
|
*/
|
|
private collectDataRequirements(auditLogs: BookingAuditWithActor[]): DataRequirements {
|
|
let actorRequirements: DataRequirements[] = [];
|
|
let serviceRequirements: DataRequirements[] = [];
|
|
let contextRequirements: DataRequirements[] = [];
|
|
for (const log of auditLogs) {
|
|
actorRequirements.push(getActorDataRequirements(log.actor));
|
|
|
|
const context = log.context
|
|
if (context?.impersonatedBy) {
|
|
contextRequirements.push({ userUuids: [context.impersonatedBy] });
|
|
}
|
|
|
|
try {
|
|
const actionService = this.actionServiceRegistry.getActionService(log.action);
|
|
const parsedData = actionService.parseStored(log.data);
|
|
serviceRequirements.push(actionService.getDataRequirements(parsedData));
|
|
} catch(error) {
|
|
this.log.error(
|
|
`Failed to get data requirements for action ${log.action}: ${error instanceof Error ? error.message : String(error)}`
|
|
);
|
|
}
|
|
}
|
|
|
|
const allDataRequirements = this.mergeDataRequirements(
|
|
...actorRequirements,
|
|
...serviceRequirements,
|
|
...contextRequirements
|
|
);
|
|
|
|
return allDataRequirements;
|
|
}
|
|
|
|
/**
|
|
* Build the enrichment data store by bulk-fetching all required data
|
|
*/
|
|
private async buildEnrichmentDataStore(requirements: DataRequirements): Promise<EnrichmentDataStore> {
|
|
const dbStore = new EnrichmentDataStore(requirements, {
|
|
userRepository: this.userRepository,
|
|
attendeeRepository: this.attendeeRepository,
|
|
credentialRepository: this.credentialRepository,
|
|
});
|
|
await dbStore.fetch();
|
|
return dbStore;
|
|
}
|
|
}
|