apps/recallassess/recallassess-api/src/api/client/participant/events/participant.events.ts
Event emitted when participant performs an activity
Properties |
|
constructor(participantId: number, activityType: string, metadata?: Record<string | unknown>)
|
||||||||||||
|
Parameters :
|
| Public Readonly activityType |
Type : string
|
| Public Readonly Optional metadata |
Type : Record<string | unknown>
|
| Public Readonly participantId |
Type : number
|
export class ParticipantCreatedEvent {
constructor(
public readonly participantId: number,
public readonly companyId: number,
public readonly isActive: boolean,
public readonly isReplaced: boolean,
) {}
}
/**
* Event emitted when a participant's status is updated
*/
export class ParticipantStatusUpdatedEvent {
constructor(
public readonly participantId: number,
public readonly companyId: number,
public readonly oldIsActive: boolean,
public readonly newIsActive: boolean,
public readonly oldIsReplaced: boolean,
public readonly newIsReplaced: boolean,
) {}
}
/**
* Event emitted when a participant is deleted
*/
export class ParticipantDeletedEvent {
constructor(
public readonly participantId: number,
public readonly companyId: number,
public readonly isActive: boolean,
public readonly isReplaced: boolean,
) {}
}
/**
* Event emitted when participant performs an activity
*/
export class ParticipantActivityEvent {
constructor(
public readonly participantId: number,
public readonly activityType: string, // String to allow any activity type from any module
public readonly metadata?: Record<string, unknown>,
) {}
}
/**
* Event emitted when a participant is reactivated
*/
export class ParticipantReactivatedEvent {
constructor(
public readonly participantId: number,
public readonly companyId: number,
public readonly incompleteCourses: number,
public readonly pendingAssessments: number,
public readonly reactivatedAt: Date,
) {}
}
/**
* Event names as constants for type safety
*/
export const PARTICIPANT_EVENTS = {
CREATED: "participant.created",
STATUS_UPDATED: "participant.status.updated",
DELETED: "participant.deleted",
ACTIVITY: "participant.activity",
REACTIVATED: "participant.reactivated",
} as const;