Architecture: hbf-event-publisher
C4 Component Diagram
Key Flows
Flow Registration (Power Automate)
A console user POSTs to the Power Automate-specific registration endpoint. PowerAutomateController calls ConnectorsService.createFlow, which validates the TriggerType enum, checks org membership via HBFGuard, and persists a FlowAssociation record in MySQL.
Synchronous Flow Trigger
An internal service POSTs to POST /connectors/flows:trigger with triggerType, organizationId, and a payload body. ConnectorsService fetches matching FlowAssociation records, calls PowerAutomateService.generateFlowRequest for each, appends a callback URL and a short-lived JWT to the request metadata, then POSTs directly to each flow's triggerUrl via HttpClientService. Success/failure counters are persisted.
Push Notification Send
POST /push/firebase/send authenticates via JWTGuard, resolves all valid PushAssociation records for platformUserId, and calls FirebaseService.sendToAssociations. FCM multicast is sent in chunks of 500. Failed tokens are marked isValid=false in a single batched UPDATE.
Device Registration
POST /push/firebase/register authenticates via HBFGuard (user must be logged in), upserts a PushAssociation keyed on (platformUserId, token). Re-registering a token sets isValid=true.