Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[messaging] Add messageParticipant matching once people emails are updated #3887

Merged
merged 5 commits into from
Feb 8, 2024

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Feb 8, 2024

Context

This PR introduces nestjs-emitter package so we can emit events whenever standard objects are created/updated.
We needed that because we want to be able to match message participants with people in the DB (or workspace members) when their email addresses are changed (or when a new person/member is created) retroactively.
The other solution is to directly add this logic to the service responsible to mutate the person object however there is none due to our way of managing standard objects and dynamically send the request to the DB.

Implementation

As specified above, there is no person service so the best place to do that is to emit an event in the workspace query runner since this is where we query pg_graphql (and the DB) and get its response. Each mutation has now its own topic that follows this rule: object_name_singular.created/updated/deleted, for many resolvers we trigger an event of each record.

@Weiko Weiko marked this pull request as ready for review February 8, 2024 16:21
newRecord: Record<string, any>,
) => {
const changedProperties = Object.keys(newRecord).filter(
(key) => oldRecord[key] !== newRecord[key],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deepEqual?

@Weiko Weiko merged commit 99e2dd6 into main Feb 8, 2024
7 checks passed
@Weiko Weiko deleted the c--poc-nestjs-emitter branch February 8, 2024 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants