refactor(backend): integrate CreateNotificationService to NotificationService

This commit is contained in:
syuilo 2023-03-16 14:24:11 +09:00
parent 0944c1cd6f
commit 89e2c302dd
10 changed files with 205 additions and 234 deletions

View file

@ -3,11 +3,11 @@ import { DI } from '@/di-symbols.js';
import type { PollVotesRepository, NotesRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
import type Logger from '@/logger.js';
import { CreateNotificationService } from '@/core/CreateNotificationService.js';
import { NotificationService } from '@/core/NotificationService.js';
import { bindThis } from '@/decorators.js';
import { QueueLoggerService } from '../QueueLoggerService.js';
import type Bull from 'bull';
import type { EndedPollNotificationJobData } from '../types.js';
import { bindThis } from '@/decorators.js';
@Injectable()
export class EndedPollNotificationProcessorService {
@ -23,7 +23,7 @@ export class EndedPollNotificationProcessorService {
@Inject(DI.pollVotesRepository)
private pollVotesRepository: PollVotesRepository,
private createNotificationService: CreateNotificationService,
private notificationService: NotificationService,
private queueLoggerService: QueueLoggerService,
) {
this.logger = this.queueLoggerService.logger.createSubLogger('ended-poll-notification');
@ -47,7 +47,7 @@ export class EndedPollNotificationProcessorService {
const userIds = [...new Set([note.userId, ...votes.map(v => v.userId)])];
for (const userId of userIds) {
this.createNotificationService.createNotification(userId, 'pollEnded', {
this.notificationService.createNotification(userId, 'pollEnded', {
noteId: note.id,
});
}