From 4610d8dfe3695a08188cffe5ce6d8594af364604 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 1 Feb 2023 20:15:11 +0900 Subject: [PATCH] refactor: fix type --- packages/backend/src/core/WebhookService.ts | 15 ++++++++++++--- .../core/entities/NotificationEntityService.ts | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/core/WebhookService.ts b/packages/backend/src/core/WebhookService.ts index 36110490a..30caa9682 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); diff --git a/packages/backend/src/core/entities/NotificationEntityService.ts b/packages/backend/src/core/entities/NotificationEntityService.ts index ded1b512a..4140b3f35 100644 --- a/packages/backend/src/core/entities/NotificationEntityService.ts +++ b/packages/backend/src/core/entities/NotificationEntityService.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { In } from 'typeorm'; import { ModuleRef } from '@nestjs/core'; import { DI } from '@/di-symbols.js'; -import type { AccessTokensRepository, NoteReactionsRepository, NotificationsRepository } from '@/models/index.js'; +import type { AccessTokensRepository, NoteReactionsRepository, NotificationsRepository, User } from '@/models/index.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Notification } from '@/models/entities/Notification.js'; import type { NoteReaction } from '@/models/entities/NoteReaction.js';