feat: implement correction and original send functionality for Nama provider

- Added new DTOs for correction requests and responses in `nama-provider.dto.ts`.
- Updated `nama-provider.adapter.ts` to include `originalSend` and `correctionSend` methods.
- Enhanced `nama-provider.util.ts` with mapping functions for correction requests.
- Created operational guidelines for agents in `AGENT.md`.
- Updated Prisma migrations to support new invoice types and relationships.
- Introduced new service and DTO for creating sales invoices in `sale-invoice-create.service.ts` and `sale-invoice-create.dto.ts`.
- Added utility for handling Prisma errors in `prisma-error.util.ts`.
This commit is contained in:
2026-05-05 22:42:09 +03:30
parent 4af07fe3e8
commit 658496320b
43 changed files with 2808 additions and 1354 deletions
@@ -42,18 +42,30 @@ export class BusinessActivityComplexesService {
},
})
async findAll(partner_id: string, consumer_id: string, business_activity_id: string) {
const complexes = await this.prisma.complex.findMany({
where: this.defaultWhere(partner_id, consumer_id, business_activity_id),
select: {
...this.defaultSelect,
_count: {
select: {
pos_list: true,
async findAll(
partner_id: string,
consumer_id: string,
business_activity_id: string,
page = 1,
perPage = 10,
) {
const where = this.defaultWhere(partner_id, consumer_id, business_activity_id)
const [complexes, total] = await this.prisma.$transaction(async tx => [
await tx.complex.findMany({
where,
select: {
...this.defaultSelect,
_count: {
select: {
pos_list: true,
},
},
},
},
})
skip: (page - 1) * perPage,
take: perPage,
}),
await tx.complex.count({ where }),
])
const mappedComplexes = complexes.map(complex => {
const { _count, ...rest } = complex
@@ -62,7 +74,7 @@ export class BusinessActivityComplexesService {
pos_count: _count.pos_list,
}
})
return ResponseMapper.list(mappedComplexes)
return ResponseMapper.paginate(mappedComplexes, { total, page, perPage })
}
async findOne(