refactor: prefix Mi for all entities (#11719)

* wip

* wip

* wip

* wip

* Update RepositoryModule.ts

* wip

* wip

* wip

* Revert "wip"

This reverts commit c1c13b37d2aaf3c65bc148212da302b0eb7868bf.
This commit is contained in:
syuilo 2023-08-16 17:51:28 +09:00 committed by GitHub
parent 9264ca336b
commit 792622aead
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
229 changed files with 1990 additions and 1990 deletions

View file

@ -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;