32 lines
966 B
TypeScript
32 lines
966 B
TypeScript
import { BotTelegramApi } from '@/modules/bids/apis/bot-telegram.api';
|
|
import { Body, Controller, Get, Post } from '@nestjs/common';
|
|
import { SendMessageDto } from '../dto/send-message.dto';
|
|
import { NotificationService } from '../notification.service';
|
|
import { BidsService } from '@/modules/bids/services/bids.service';
|
|
|
|
@Controller('notifications')
|
|
export class ClientNotificationController {
|
|
constructor(
|
|
private botTelegramApi: BotTelegramApi,
|
|
private readonly notifyService: NotificationService,
|
|
private readonly bidsService: BidsService,
|
|
) {}
|
|
|
|
@Post('send-messages')
|
|
async sendMessage(@Body() data: SendMessageDto) {
|
|
return await this.botTelegramApi.sendMessage(data.text, data.options);
|
|
}
|
|
|
|
@Post('test')
|
|
async test() {
|
|
const bid = await this.bidsService.bidsRepo.findOne({
|
|
where: { lot_id: '26077023' },
|
|
});
|
|
|
|
return await this.notifyService.emitBidStatus({
|
|
...bid,
|
|
status: 'win-bid',
|
|
});
|
|
}
|
|
}
|