Files
psp_api/src/modules/consumer/saleInvoices/saleInvoices.controller.ts
T

44 lines
1.4 KiB
TypeScript
Raw Normal View History

import { TokenAccount } from '@/common/decorators/tokenInfo.decorator'
import { Body, Controller, Get, Param, Post } from '@nestjs/common'
import { ApiTags } from '@nestjs/swagger'
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,
): Promise<SaleInvoicesServiceFindAllResponseDto> {
return this.service.findAll(consumerId)
}
@Get(':id')
async findOne(
@TokenAccount('userId') consumerId: string,
@Param('id') id: string,
): Promise<SaleInvoicesServiceFindOneResponseDto> {
return this.service.findOne(consumerId, id)
}
@Post(':id/send_tax')
async send(@TokenAccount('userId') consumerId: string, @Param('id') id: string) {
return this.service.send(consumerId, id)
}
@Post('send_tax_bulk')
async sendBulk(
@TokenAccount('userId') consumerId: string,
@Body() data: SendBulkSaleInvoicesDto,
) {
return this.service.sendBulk(consumerId, data.invoice_ids)
}
}