From 14795b68f2234c90504cd0a979de42ff4d757441 Mon Sep 17 00:00:00 2001 From: tamaina Date: Wed, 22 Sep 2021 22:35:55 +0900 Subject: refactor: PackedHoge型をPacked<'Hoge'>型に書き換える (#7792) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * packedNotificationSchemaを更新 * read:gallery, write:gallery, read:gallery-likes, write:gallery-likesに翻訳を追加 * fix * add header, choice, invitation * test * fix * yatta * remove no longer needed "as PackedUser/PackedNote" * clean up * add simple-schema * fix lint * define items in full Schema * revert https://github.com/misskey-dev/misskey/pull/7772#discussion_r706627736 * user packとnote packの型不整合を修正 * add prelude/types.ts * emoji * signin * game * matching * fix * add emoji schema * add reversiGame * add reversiMatching * remove signin schema (use Signin entity) * add Packed type * note-reaction * user * user-group * user-list * note * app, messaging-message * notification * drive-file * drive-folder * following * muting * blocking * hashtag * page * app (with modifying schema) * import user? * channel * antenna * clip * gallery-post * emoji * Packed * reversi-matching * add changelog * add changelog * revert fix --- src/services/note/read.ts | 12 ++++++------ src/services/push-notification.ts | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src/services') diff --git a/src/services/note/read.ts b/src/services/note/read.ts index b5e7de7976..f25f86da9c 100644 --- a/src/services/note/read.ts +++ b/src/services/note/read.ts @@ -6,15 +6,15 @@ import { Not, IsNull, In } from 'typeorm'; import { Channel } from '@/models/entities/channel'; import { checkHitAntenna } from '@/misc/check-hit-antenna'; import { getAntennas } from '@/misc/antenna-cache'; -import { PackedNote } from '@/models/repositories/note'; import { readNotificationByQuery } from '@/server/api/common/read-notification'; +import { Packed } from '@/misc/schema'; /** * Mark notes as read */ export default async function( userId: User['id'], - notes: (Note | PackedNote)[], + notes: (Note | Packed<'Note'>)[], info?: { following: Set; followingChannels: Set; @@ -34,10 +34,10 @@ export default async function( })).map(x => x.followeeId)); const myAntennas = (await getAntennas()).filter(a => a.userId === userId); - const readMentions: (Note | PackedNote)[] = []; - const readSpecifiedNotes: (Note | PackedNote)[] = []; - const readChannelNotes: (Note | PackedNote)[] = []; - const readAntennaNotes: (Note | PackedNote)[] = []; + const readMentions: (Note | Packed<'Note'>)[] = []; + const readSpecifiedNotes: (Note | Packed<'Note'>)[] = []; + const readChannelNotes: (Note | Packed<'Note'>)[] = []; + const readAntennaNotes: (Note | Packed<'Note'>)[] = []; for (const note of notes) { if (note.mentions && note.mentions.includes(userId)) { diff --git a/src/services/push-notification.ts b/src/services/push-notification.ts index 5bd7499692..5949d11b3b 100644 --- a/src/services/push-notification.ts +++ b/src/services/push-notification.ts @@ -2,11 +2,10 @@ import * as push from 'web-push'; import config from '@/config/index'; import { SwSubscriptions } from '@/models/index'; import { fetchMeta } from '@/misc/fetch-meta'; -import { PackedNotification } from '../models/repositories/notification'; -import { PackedMessagingMessage } from '../models/repositories/messaging-message'; +import { Packed } from '@/misc/schema'; type notificationType = 'notification' | 'unreadMessagingMessage'; -type notificationBody = PackedNotification | PackedMessagingMessage; +type notificationBody = Packed<'Notification'> | Packed<'MessagingMessage'>; export default async function(userId: string, type: notificationType, body: notificationBody) { const meta = await fetchMeta(); -- cgit v1.2.3-freya