-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
6071 return only updated fields of records in zapier update trigger #8193
6071 return only updated fields of records in zapier update trigger #8193
Conversation
…llWebhookJobsJob in event listener
c31f079
to
a4b5524
Compare
a4b5524
to
a9f36df
Compare
…n-zapier-update-trigger
let newOperation = webhook.operation; | ||
let newOpe = webhook.operation; | ||
|
||
newOpe = newOpe.replace(/\bcreate\b(?=\.|$)/g, 'created'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bit surprise about \b operator. shouldn't it be ^ (start with) direclty?
Not a problem just curious about this \b operator which is not super usual in regex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, i will update that, I just used the chatgpt -> 101 validated REGEX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\b is checking word boudaries -> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Word_boundary_assertion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might work with ^but it has sense
...server/src/engine/api/graphql/graphql-query-runner/decorators/on-database-event.decorator.ts
Outdated
Show resolved
Hide resolved
...nty-server/src/engine/api/graphql/graphql-query-runner/services/api-event-emitter.service.ts
Outdated
Show resolved
Hide resolved
updatedFields, | ||
diff, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok why not adding the diff to the event api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean by "event api"?
...r/src/engine/api/graphql/graphql-query-runner/utils/check-string-is-database-event-action.ts
Outdated
Show resolved
Hide resolved
|
||
@Injectable() | ||
export class EntityEventsToDbListener { | ||
constructor( | ||
@InjectMessageQueue(MessageQueue.entityEventsToDbQueue) | ||
private readonly messageQueueService: MessageQueueService, | ||
private readonly entityEventsToDbQueueService: MessageQueueService, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entity is not a valid term anymore.
entity is either ObjectRecord (aka Record) or ObjectMetadata (aka Object when confusion is not possible)
Also in this particular case, why not keeping messageQueueService, it's the first time we have a service not having the same name as its class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because they are different, either injected by @InjectMessageQueue(MessageQueue.entityEventsToDbQueue)
or @InjectMessageQueue(MessageQueue.webhookQueue)
@@ -195,7 +196,7 @@ export class CreateCompanyAndContactService { | |||
); | |||
|
|||
this.workspaceEventEmitter.emit( | |||
'person.created', | |||
`person.${DatabaseEventAction.CREATED}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at the usage it looks a bit verbose to use the enum. I wonder if a string literal wouldn't provide a better DX
https://claritydev.net/blog/typescript-type-literals-practical-use-cases-code-quality
I think it's more elegant but might be individual opinion, don't want to force it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verbose I agree, but far more clear than a type that checks string ends with .created
in my opinion
packages/twenty-server/src/modules/timeline/services/timeline-activity.service.ts
Show resolved
Hide resolved
packages/twenty-server/src/modules/timeline/services/timeline-activity.service.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/modules/webhook/jobs/call-webhook-jobs.job.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/modules/webhook/jobs/call-webhook-jobs.job.ts
Outdated
Show resolved
Hide resolved
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "twenty-zapier", | |||
"version": "1.0.2", | |||
"version": "2.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.0 ? :p should we follow the twenty versions for now: 0.32.0 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a breaking change update, so I need to update X in X.Y.Z
f069c5c
to
34441d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Fixes bug introduced in #8193 Taking into account linked event name `linked-{eventName}` as before issue ## Before `linked-created` and `linked-updated` activity targets were not created in `timelineActivity` table ## After `linked-created` and `linked-updated` activity targets are created in `timelineActivity` table
entity-events-to-db.listener.ts
@OnDatabaseEvent
decorator to manage database events