Use Serialized in EntityService

This commit is contained in:
tamaina
2023-06-04 18:26:05 +00:00
parent a1b243bbda
commit 4a104af304
34 changed files with 82 additions and 78 deletions

View File

@@ -7,6 +7,7 @@ import { awaitAll } from '@/misc/prelude/await-all.js';
import type { Notification } from '@/models/entities/Notification.js';
import type { Note } from '@/models/entities/Note.js';
import type { Packed } from 'misskey-js';
import type { Serialized } from 'schema-type';
import { bindThis } from '@/decorators.js';
import { isNotNull } from '@/misc/is-not-null.js';
import { notificationTypes } from 'misskey-js';
@@ -62,10 +63,10 @@ export class NotificationEntityService implements OnModuleInit {
},
hint?: {
packedNotes: Map<Note['id'], Packed<'Note'>>;
packedUsers: Map<User['id'], Packed<'User'>>;
packedNotes: Map<Note['id'], Serialized<Packed<'Note'>>>;
packedUsers: Map<User['id'], Serialized<Packed<'User'>>>;
},
): Promise<Packed<'Notification'>> {
): Promise<Serialized<Packed<'Notification'>>> {
const notification = src;
const token = notification.appAccessTokenId ? await this.accessTokensRepository.findOneByOrFail({ id: notification.appAccessTokenId }) : null;
const noteIfNeed = NOTE_REQUIRED_NOTIFICATION_TYPES.has(notification.type) && notification.noteId != null ? (