summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NotificationService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-08-16 17:51:28 +0900
committerGitHub <noreply@github.com>2023-08-16 17:51:28 +0900
commit792622aeadf3e36d50cddec3c64b2ff0105ea927 (patch)
treec42a71da86be3c33e2752b4c673e280b1158e57b /packages/backend/src/core/NotificationService.ts
parentbuild(deps): bump actions/setup-node from 3.7.0 to 3.8.0 (#11726) (diff)
downloadsharkey-792622aeadf3e36d50cddec3c64b2ff0105ea927.tar.gz
sharkey-792622aeadf3e36d50cddec3c64b2ff0105ea927.tar.bz2
sharkey-792622aeadf3e36d50cddec3c64b2ff0105ea927.zip
refactor: prefix Mi for all entities (#11719)
* wip * wip * wip * wip * Update RepositoryModule.ts * wip * wip * wip * Revert "wip" This reverts commit c1c13b37d2aaf3c65bc148212da302b0eb7868bf.
Diffstat (limited to 'packages/backend/src/core/NotificationService.ts')
-rw-r--r--packages/backend/src/core/NotificationService.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/packages/backend/src/core/NotificationService.ts b/packages/backend/src/core/NotificationService.ts
index a708a54004..02c577c199 100644
--- a/packages/backend/src/core/NotificationService.ts
+++ b/packages/backend/src/core/NotificationService.ts
@@ -9,8 +9,8 @@ import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
import { In } from 'typeorm';
import { DI } from '@/di-symbols.js';
import type { UsersRepository } from '@/models/index.js';
-import type { User } from '@/models/entities/User.js';
-import type { Notification } from '@/models/entities/Notification.js';
+import type { MiUser } from '@/models/entities/User.js';
+import type { MiNotification } from '@/models/entities/Notification.js';
import { bindThis } from '@/decorators.js';
import { GlobalEventService } from '@/core/GlobalEventService.js';
import { PushNotificationService } from '@/core/PushNotificationService.js';
@@ -39,7 +39,7 @@ export class NotificationService implements OnApplicationShutdown {
@bindThis
public async readAllNotification(
- userId: User['id'],
+ userId: MiUser['id'],
force = false,
) {
const latestReadNotificationId = await this.redisClient.get(`latestReadNotification:${userId}`);
@@ -61,17 +61,17 @@ export class NotificationService implements OnApplicationShutdown {
}
@bindThis
- private postReadAllNotifications(userId: User['id']) {
+ private postReadAllNotifications(userId: MiUser['id']) {
this.globalEventService.publishMainStream(userId, 'readAllNotifications');
this.pushNotificationService.pushNotification(userId, 'readAllNotifications', undefined);
}
@bindThis
public async createNotification(
- notifieeId: User['id'],
- type: Notification['type'],
- data: Partial<Notification>,
- ): Promise<Notification | null> {
+ notifieeId: MiUser['id'],
+ type: MiNotification['type'],
+ data: Partial<MiNotification>,
+ ): Promise<MiNotification | null> {
const profile = await this.cacheService.userProfileCache.fetch(notifieeId);
const isMuted = profile.mutingNotificationTypes.includes(type);
if (isMuted) return null;
@@ -92,7 +92,7 @@ export class NotificationService implements OnApplicationShutdown {
createdAt: new Date(),
type: type,
...data,
- } as Notification;
+ } as MiNotification;
const redisIdPromise = this.redisClient.xadd(
`notificationTimeline:${notifieeId}`,
@@ -126,7 +126,7 @@ export class NotificationService implements OnApplicationShutdown {
// TODO: locale ファイルをクライアント用とサーバー用で分けたい
@bindThis
- private async emailNotificationFollow(userId: User['id'], follower: User) {
+ private async emailNotificationFollow(userId: MiUser['id'], follower: MiUser) {
/*
const userProfile = await UserProfiles.findOneByOrFail({ userId: userId });
if (!userProfile.email || !userProfile.emailNotificationTypes.includes('follow')) return;
@@ -138,7 +138,7 @@ export class NotificationService implements OnApplicationShutdown {
}
@bindThis
- private async emailNotificationReceiveFollowRequest(userId: User['id'], follower: User) {
+ private async emailNotificationReceiveFollowRequest(userId: MiUser['id'], follower: MiUser) {
/*
const userProfile = await UserProfiles.findOneByOrFail({ userId: userId });
if (!userProfile.email || !userProfile.emailNotificationTypes.includes('receiveFollowRequest')) return;