summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/WebhookService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-02-01 20:15:11 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-02-01 20:15:11 +0900
commit4610d8dfe3695a08188cffe5ce6d8594af364604 (patch)
treebe378f3c702b080f16082a1561a53250633e4f2c /packages/backend/src/core/WebhookService.ts
parentrefactor: fix type (diff)
downloadsharkey-4610d8dfe3695a08188cffe5ce6d8594af364604.tar.gz
sharkey-4610d8dfe3695a08188cffe5ce6d8594af364604.tar.bz2
sharkey-4610d8dfe3695a08188cffe5ce6d8594af364604.zip
refactor: fix type
Diffstat (limited to 'packages/backend/src/core/WebhookService.ts')
-rw-r--r--packages/backend/src/core/WebhookService.ts15
1 files changed, 12 insertions, 3 deletions
diff --git a/packages/backend/src/core/WebhookService.ts b/packages/backend/src/core/WebhookService.ts
index 36110490a0..30caa9682c 100644
--- a/packages/backend/src/core/WebhookService.ts
+++ b/packages/backend/src/core/WebhookService.ts
@@ -44,16 +44,25 @@ export class WebhookService implements OnApplicationShutdown {
switch (type) {
case 'webhookCreated':
if (body.active) {
- this.webhooks.push(body);
+ this.webhooks.push({
+ ...body,
+ createdAt: new Date(body.createdAt),
+ });
}
break;
case 'webhookUpdated':
if (body.active) {
const i = this.webhooks.findIndex(a => a.id === body.id);
if (i > -1) {
- this.webhooks[i] = body;
+ this.webhooks[i] = {
+ ...body,
+ createdAt: new Date(body.createdAt),
+ };
} else {
- this.webhooks.push(body);
+ this.webhooks.push({
+ ...body,
+ createdAt: new Date(body.createdAt),
+ });
}
} else {
this.webhooks = this.webhooks.filter(a => a.id !== body.id);