Update PostScheduledNoteProcessorService.ts
This commit is contained in:
parent
0a018ab708
commit
92e24125db
|
@ -9,6 +9,7 @@ import type { NoteDraftsRepository } from '@/models/_.js';
|
||||||
import type Logger from '@/logger.js';
|
import type Logger from '@/logger.js';
|
||||||
import { NotificationService } from '@/core/NotificationService.js';
|
import { NotificationService } from '@/core/NotificationService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
import { NoteCreateService } from '@/core/NoteCreateService.js';
|
||||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||||
import type * as Bull from 'bullmq';
|
import type * as Bull from 'bullmq';
|
||||||
import type { PostScheduledNoteJobData } from '../types.js';
|
import type { PostScheduledNoteJobData } from '../types.js';
|
||||||
|
@ -21,6 +22,7 @@ export class PostScheduledNoteProcessorService {
|
||||||
@Inject(DI.noteDraftsRepository)
|
@Inject(DI.noteDraftsRepository)
|
||||||
private noteDraftsRepository: NoteDraftsRepository,
|
private noteDraftsRepository: NoteDraftsRepository,
|
||||||
|
|
||||||
|
private noteCreateService: NoteCreateService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private queueLoggerService: QueueLoggerService,
|
private queueLoggerService: QueueLoggerService,
|
||||||
) {
|
) {
|
||||||
|
@ -34,6 +36,10 @@ export class PostScheduledNoteProcessorService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const note = await this.noteCreateService.create(draft.user, draft);
|
||||||
|
|
||||||
|
this.noteDraftsRepository.remove(draft);
|
||||||
|
|
||||||
this.notificationService.createNotification(draft.userId, 'scheduledNotePosted', {
|
this.notificationService.createNotification(draft.userId, 'scheduledNotePosted', {
|
||||||
noteId: note.id,
|
noteId: note.id,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue