swagger configurado na rota chavenfe
This commit is contained in:
21
src/orders/application/invoice.service.ts
Normal file
21
src/orders/application/invoice.service.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { InvoiceRepository } from '../repositories/invoice.repository';
|
||||
import { InvoiceDto } from '../dto/invoice.dto';
|
||||
|
||||
@Injectable()
|
||||
export class InvoiceService {
|
||||
constructor(private readonly invoiceRepo: InvoiceRepository) {}
|
||||
|
||||
async getInvoiceByChave(chavenfe: string): Promise<InvoiceDto> {
|
||||
const invoice = await this.invoiceRepo.findInvoiceByChave(chavenfe);
|
||||
if (!invoice) {
|
||||
throw new NotFoundException('Nota fiscal não localizada.');
|
||||
}
|
||||
|
||||
const itens = await this.invoiceRepo.findInvoiceItems(invoice.transactionId);
|
||||
return {
|
||||
...invoice,
|
||||
itens,
|
||||
};
|
||||
}
|
||||
}
|
||||
6
src/orders/application/orders.service.ts
Normal file
6
src/orders/application/orders.service.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
///← Orquestra operações de pedido
|
||||
|
||||
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user