fix: attachments events not recognised by DeliverWebhookTask
This commit is contained in:
@@ -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":
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user