2026-04-13 13:21:50 +03:30
|
|
|
import { TokenAccount } from '@/common/decorators/tokenInfo.decorator'
|
2026-04-27 22:11:05 +03:30
|
|
|
import { Body, Controller, Get, Param, Post } from '@nestjs/common'
|
2026-04-13 13:21:50 +03:30
|
|
|
import { ApiTags } from '@nestjs/swagger'
|
2026-04-27 22:11:05 +03:30
|
|
|
import type {
|
|
|
|
|
SaleInvoicesServiceFindAllResponseDto,
|
|
|
|
|
SaleInvoicesServiceFindOneResponseDto,
|
|
|
|
|
} from './dto/saleInvoices-response.dto'
|
|
|
|
|
import { SendBulkSaleInvoicesDto } from './dto/send-saleInvoices.dto'
|
2026-04-13 13:21:50 +03:30
|
|
|
import { SaleInvoicesService } from './saleInvoices.service'
|
|
|
|
|
|
2026-04-18 12:14:19 +03:30
|
|
|
@ApiTags('ConsumerSaleInvoices')
|
|
|
|
|
@Controller('consumer/sale-invoices')
|
2026-04-13 13:21:50 +03:30
|
|
|
export class StatisticsController {
|
|
|
|
|
constructor(private readonly service: SaleInvoicesService) {}
|
|
|
|
|
|
2026-04-18 12:14:19 +03:30
|
|
|
@Get('')
|
2026-04-27 22:11:05 +03:30
|
|
|
async findAll(
|
|
|
|
|
@TokenAccount('userId') consumerId: string,
|
|
|
|
|
): Promise<SaleInvoicesServiceFindAllResponseDto> {
|
2026-04-18 12:14:19 +03:30
|
|
|
return this.service.findAll(consumerId)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get(':id')
|
2026-04-27 22:11:05 +03:30
|
|
|
async findOne(
|
|
|
|
|
@TokenAccount('userId') consumerId: string,
|
|
|
|
|
@Param('id') id: string,
|
|
|
|
|
): Promise<SaleInvoicesServiceFindOneResponseDto> {
|
2026-04-18 12:14:19 +03:30
|
|
|
return this.service.findOne(consumerId, id)
|
2026-04-13 13:21:50 +03:30
|
|
|
}
|
2026-04-27 22:11:05 +03:30
|
|
|
|
|
|
|
|
@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)
|
|
|
|
|
}
|
2026-04-13 13:21:50 +03:30
|
|
|
}
|