import { PosInfo } from '@/common/decorators/posInfo.decorator' import { TokenAccount } from '@/common/decorators/tokenInfo.decorator' import type { IPosPayload } from '@/common/models' import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common' import { ApiTags } from '@nestjs/swagger' import { ConsumerSaleInvoicesFilterDto } from './dto/saleInvoices-filter.dto' import type { SaleInvoicesServiceFindAllResponseDto, SaleInvoicesServiceFindOneResponseDto, } from './dto/saleInvoices-response.dto' import { SendBulkSaleInvoicesDto } from './dto/send-saleInvoices.dto' import { SaleInvoicesService } from './saleInvoices.service' @ApiTags('ConsumerSaleInvoices') @Controller('consumer/sale-invoices') export class StatisticsController { constructor(private readonly service: SaleInvoicesService) {} @Get('') async findAll( @TokenAccount('userId') consumerId: string, @Query() query: ConsumerSaleInvoicesFilterDto, ): Promise { return this.service.findAll(consumerId, query) } @Get(':id') async findOne( @TokenAccount('userId') consumerId: string, @Param('id') id: string, ): Promise { return this.service.findOne(consumerId, id) } @Post('send_tax_bulk') async sendBulk( @TokenAccount('userId') consumerId: string, @Body() data: SendBulkSaleInvoicesDto, ) { return this.service.sendBulk(consumerId, data.invoice_ids) } @Get(':id/inquiry') inquiry(@PosInfo() posInfo: IPosPayload, @Param('id') id: string) { return this.service.inquiry(posInfo.consumer_account_id, posInfo.pos_id, id) } @Post(':id/send') send(@Param('id') id: string, @PosInfo() posInfo: IPosPayload) { return this.service.send(id, posInfo) } @Post(':id/retry') retry(@Param('id') id: string, @PosInfo() posInfo: IPosPayload) { return this.service.retry(id, posInfo) } @Post(':id/revoke') revoke(@Param('id') id: string, @PosInfo() posInfo: IPosPayload) { return this.service.revoke(id, posInfo) } }