feat: add consumer accounts and business activities management

- Implemented AccountsService for managing consumer accounts including create, update, delete, and find operations.
- Created DTOs for account creation and updates.
- Developed BusinessActivitiesController and BusinessActivitiesService for handling business activities related to consumers.
- Added complexes management with ComplexesController and ComplexesService.
- Introduced POS management with ComplexPosesController and ComplexPosesService.
- Created necessary DTOs for business activities and POS.
- Established Licenses management with LicensesController and LicensesService.
- Integrated consumer management with PartnerConsumersController and PartnerConsumersService.
- Added Prisma module imports and service connections across modules.
This commit is contained in:
2026-04-23 20:59:39 +03:30
parent f9e1ad69dc
commit a350ec7990
104 changed files with 13233 additions and 4105 deletions
@@ -0,0 +1,61 @@
import { PartnerAccountQuotaAllocationWhereInput } from '@/generated/prisma/models'
import { PrismaService } from '@/prisma/prisma.service'
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from 'common/response/response-mapper'
@Injectable()
export class PartnerAllocatedAccountsService {
constructor(private readonly prisma: PrismaService) {}
async findAll(partner_id: string, page = 1, pageSize = 10) {
const defaultWhere: PartnerAccountQuotaAllocationWhereInput = {
charge_transaction: {
partner_id,
},
}
const [allocations, count] = await this.prisma.$transaction(async tx => [
await tx.partnerAccountQuotaAllocation.findMany({
where: defaultWhere,
skip: (page - 1) * pageSize,
take: pageSize,
select: {
id: true,
created_at: true,
updated_at: true,
charge_transaction_id: true,
license_id: true,
charge_transaction: {
select: {
id: true,
tracking_code: true,
purchased_count: true,
created_at: true,
},
},
license: {
select: {
id: true,
accounts_limit: true,
activation: {
select: {
id: true,
business_activity_id: true,
},
},
},
},
},
}),
await tx.partnerAccountQuotaAllocation.count({
where: defaultWhere,
}),
])
return ResponseMapper.paginate(allocations, {
page,
pageSize,
count,
})
}
}