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
+16 -11
View File
@@ -1,4 +1,4 @@
import { ActivatedLicenseSelect } from '@/generated/prisma/models'
import { LicenseActivationSelect } from '@/generated/prisma/models'
import { PrismaService } from '@/prisma/prisma.service'
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from 'common/response/response-mapper'
@@ -7,22 +7,27 @@ import { ResponseMapper } from 'common/response/response-mapper'
export class PartnerLicensesService {
constructor(private readonly prisma: PrismaService) {}
private readonly licenseDefaultSelect: ActivatedLicenseSelect = {
private readonly licenseDefaultSelect: LicenseActivationSelect = {
id: true,
starts_at: true,
expires_at: true,
consumer: {
business_activity: {
select: {
first_name: true,
last_name: true,
mobile_number: true,
status: true,
id: true,
name: true,
consumer: {
select: {
id: true,
first_name: true,
last_name: true,
},
},
},
},
license: {
select: {
id: true,
charged_license_transaction: {
charge_transaction: {
select: {
partner: {
select: {
@@ -39,12 +44,12 @@ export class PartnerLicensesService {
async findAll(page = 1, pageSize = 10) {
const [licenses, count] = await this.prisma.$transaction([
this.prisma.activatedLicense.findMany({
this.prisma.licenseActivation.findMany({
select: this.licenseDefaultSelect,
skip: (page - 1) * pageSize,
take: pageSize,
}),
this.prisma.activatedLicense.count(),
this.prisma.licenseActivation.count(),
])
return ResponseMapper.paginate(licenses, {
@@ -55,7 +60,7 @@ export class PartnerLicensesService {
}
async findOne(id: string) {
const license = await this.prisma.activatedLicense.findFirst({
const license = await this.prisma.licenseActivation.findFirst({
where: {
id,
},