import { Injectable } from '@nestjs/common'; import { Change } from 'src/models/change.model'; import { TelegramBotService } from 'src/telegram-bot/telegram-bot.service'; @Injectable() export class StatusChangeAdapterService { constructor(private telegramBotService: TelegramBotService) {} async send(change: Change): Promise { const promises = change.messages.map((m) => { if (!m || !m.recipient || !m.recipient.id || !m.notification_message) { return true; } return this.telegramBotService.sendMessageByRedmineId( m.recipient.id, m.notification_message, { parse_mode: 'HTML' }, ); }); return await Promise.all(promises); } }