1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-24 15:16:21 +09:00

refactor: fix type

This commit is contained in:
syuilo 2023-02-01 20:15:11 +09:00
parent fa296efdf6
commit 4610d8dfe3
2 changed files with 13 additions and 4 deletions

View File

@ -44,16 +44,25 @@ export class WebhookService implements OnApplicationShutdown {
switch (type) { switch (type) {
case 'webhookCreated': case 'webhookCreated':
if (body.active) { if (body.active) {
this.webhooks.push(body); this.webhooks.push({
...body,
createdAt: new Date(body.createdAt),
});
} }
break; break;
case 'webhookUpdated': case 'webhookUpdated':
if (body.active) { if (body.active) {
const i = this.webhooks.findIndex(a => a.id === body.id); const i = this.webhooks.findIndex(a => a.id === body.id);
if (i > -1) { if (i > -1) {
this.webhooks[i] = body; this.webhooks[i] = {
...body,
createdAt: new Date(body.createdAt),
};
} else { } else {
this.webhooks.push(body); this.webhooks.push({
...body,
createdAt: new Date(body.createdAt),
});
} }
} else { } else {
this.webhooks = this.webhooks.filter(a => a.id !== body.id); this.webhooks = this.webhooks.filter(a => a.id !== body.id);

View File

@ -2,7 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';
import { In } from 'typeorm'; import { In } from 'typeorm';
import { ModuleRef } from '@nestjs/core'; import { ModuleRef } from '@nestjs/core';
import { DI } from '@/di-symbols.js'; 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 { awaitAll } from '@/misc/prelude/await-all.js';
import type { Notification } from '@/models/entities/Notification.js'; import type { Notification } from '@/models/entities/Notification.js';
import type { NoteReaction } from '@/models/entities/NoteReaction.js'; import type { NoteReaction } from '@/models/entities/NoteReaction.js';