fix: attachments events not recognised by DeliverWebhookTask

This commit is contained in:
Tom Moor
2022-07-01 18:40:32 +02:00
parent b44dc726f3
commit 7ce57c9c83
3 changed files with 24 additions and 2 deletions

View File

@@ -84,6 +84,8 @@ export default class DeliverWebhookTask extends BaseTask<Props> {
switch (event.name) {
case "api_keys.create":
case "api_keys.delete":
case "attachments.create":
case "attachments.delete":
// Ignored
return;
case "users.create":

View File

@@ -81,7 +81,7 @@ router.post("attachments.create", auth(), async (ctx) => {
name,
},
teamId: user.teamId,
userId: user.id,
actorId: user.id,
ip: ctx.request.ip,
},
{ transaction }
@@ -133,7 +133,7 @@ router.post("attachments.delete", auth(), async (ctx) => {
await Event.create({
name: "attachments.delete",
teamId: user.teamId,
userId: user.id,
actorId: user.id,
ip: ctx.request.ip,
});

View File

@@ -23,6 +23,25 @@ export type ApiKeyEvent = BaseEvent & {
};
};
export type AttachmentEvent = BaseEvent &
(
| {
name: "attachments.create";
modelId: string;
data: {
name: string;
source: string;
};
}
| {
name: "attachments.delete";
modelId: string;
data: {
name: string;
};
}
);
export type UserEvent = BaseEvent &
(
| {
@@ -244,6 +263,7 @@ export type WebhookSubscriptionEvent = BaseEvent & {
export type Event =
| ApiKeyEvent
| AttachmentEvent
| UserEvent
| DocumentEvent
| PinEvent