feat: refactor ComplexPosesService to remove unused defaultInsert method and improve findAll logic

fix: update PartnersService to use 'isNot' instead of 'not' for allocation checks

refactor: enhance BusinessActivityComplexesService to validate license activation before creating a complex

fix: adjust ComplexPosesService to ensure account allocation checks are accurate and handle errors properly

refactor: modify ConsumerMiddleware to set consumerData instead of partnerData for better clarity

feat: expand SaleInvoicesService to include additional fields in the invoice selection

chore: update business-activities module to include accounts-charge module for better organization

fix: ensure ComplexPosesService correctly handles account allocation during POS creation

feat: implement PartnerBusinessActivityAccountsCharge module with create functionality for account charges

refactor: streamline getPartnerBusinessActivityAllocationLimits utility for better clarity and functionality

chore: add migration script to update database schema with necessary constraints and foreign keys

feat: create DTO for accounts charge to validate incoming data
This commit is contained in:
2026-04-25 15:16:59 +03:30
parent 12506de863
commit b72e6c7194
36 changed files with 975 additions and 568 deletions
@@ -1,8 +1,7 @@
import { PosCreateInput, PosSelect } from '@/generated/prisma/models'
import { PosSelect } from '@/generated/prisma/models'
import { PrismaService } from '@/prisma/prisma.service'
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from 'common/response/response-mapper'
import { CreatePosDto } from './dto/pos.dto'
@Injectable()
export class ComplexPosesService {
@@ -49,32 +48,32 @@ export class ComplexPosesService {
},
} as PosSelect
defaultInsert = (data: CreatePosDto, complex_id: string) => {
const { device_id, provider_id, ...rest } = data
// defaultInsert = (data: CreatePosDto, complex_id: string) => {
// const { device_id, provider_id, ...rest } = data
return {
...rest,
complex: {
connect: {
id: complex_id,
},
},
provider: provider_id
? {
connect: {
id: provider_id,
},
}
: undefined,
device: device_id
? {
connect: {
id: device_id,
},
}
: undefined,
} as PosCreateInput
}
// return {
// ...rest,
// complex: {
// connect: {
// id: complex_id,
// },
// },
// provider: provider_id
// ? {
// connect: {
// id: provider_id,
// },
// }
// : undefined,
// device: device_id
// ? {
// connect: {
// id: device_id,
// },
// }
// : undefined,
// } as PosCreateInput
// }
async findAll(business_activity_id: string, complex_id: string) {
const accounts = await this.prisma.pos.findMany({