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:
@@ -58,11 +58,17 @@ export class AccountsService {
|
||||
},
|
||||
})
|
||||
|
||||
async findAll(partner_id: string, consumer_id: string) {
|
||||
const accounts = await this.prisma.consumerAccount.findMany({
|
||||
where: this.defaultWhere(partner_id, consumer_id),
|
||||
select: this.default_select,
|
||||
})
|
||||
async findAll(partner_id: string, consumer_id: string, page = 1, perPage = 10) {
|
||||
const where = this.defaultWhere(partner_id, consumer_id)
|
||||
const [accounts, total] = await this.prisma.$transaction(async tx => [
|
||||
await tx.consumerAccount.findMany({
|
||||
where,
|
||||
select: this.default_select,
|
||||
skip: (page - 1) * perPage,
|
||||
take: perPage,
|
||||
}),
|
||||
await tx.consumerAccount.count({ where }),
|
||||
])
|
||||
|
||||
const mappedAccounts = accounts.map(account => {
|
||||
const { account: mainAccount, role, ...rest } = account
|
||||
@@ -77,7 +83,7 @@ export class AccountsService {
|
||||
}
|
||||
})
|
||||
|
||||
return ResponseMapper.list(mappedAccounts)
|
||||
return ResponseMapper.paginate(mappedAccounts, { total, page, perPage })
|
||||
}
|
||||
|
||||
async findOne(partner_id: string, consumer_id: string, id: string) {
|
||||
|
||||
Reference in New Issue
Block a user