fix(audit): resolve player resource ids - #64
Conversation
agniev-a-hub
left a comment
There was a problem hiding this comment.
I got it now.
You want to write the different data - instead of userId to write playerId.
As I explained offline (or on meet, don't remember), user is our core entity representing a person.
User is used for chat / payment / auth etc. Audit is low-level data storage.
To implement this fix, the idea was to GET playerId from BE and then redirect. Another option - as we have it now - to just paste userId in the search bar.
But writing playerId as default level entity for audit is strange... Please elaborate on necessarity.
| actorId: str(p['userId']), | ||
| resourceType: 'player', | ||
| resourceId: str(p['userId']), | ||
| resourceId: await resolvePlayerId(str(p['userId'])), |
There was a problem hiding this comment.
The whole idea of making one more DB call from audit to later record to the audit is strange... Please elaborate why we don't pass that data on the service layer of callee through event body?
Audit module himself must be standalone.
There was a problem hiding this comment.
To be discussed offline.
Summary
Fix audit records so player-scoped events store the PAM player ID as resourceId. Update integration and E2E coverage for KYC, responsible gambling, and player-level audit flows. BF-335.
Why
Player audit events previously persisted the identity user ID while declaring resourceType as player. Admin log and export filters using the actual player ID therefore missed those records.
Alternatives considered
Keep using the identity user ID as resourceId, but that conflicts with the declared player resource type and the identifiers used by player-facing consumers.
Risks
No schema migration. When an event references a user without a materialized player row, resourceId remains null.