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
+45 -26
View File
@@ -159,7 +159,7 @@ export type LicenseRenewGroupByOutputType = {
created_at: Date
updated_at: Date
charge_transaction_id: string
activation_id: string
activation_id: string | null
_count: LicenseRenewCountAggregateOutputType | null
_min: LicenseRenewMinAggregateOutputType | null
_max: LicenseRenewMaxAggregateOutputType | null
@@ -189,9 +189,9 @@ export type LicenseRenewWhereInput = {
created_at?: Prisma.DateTimeFilter<"LicenseRenew"> | Date | string
updated_at?: Prisma.DateTimeFilter<"LicenseRenew"> | Date | string
charge_transaction_id?: Prisma.StringFilter<"LicenseRenew"> | string
activation_id?: Prisma.StringFilter<"LicenseRenew"> | string
activation_id?: Prisma.StringNullableFilter<"LicenseRenew"> | string | null
charge_transaction?: Prisma.XOR<Prisma.LicenseRenewChargeTransactionScalarRelationFilter, Prisma.LicenseRenewChargeTransactionWhereInput>
activation?: Prisma.XOR<Prisma.LicenseActivationScalarRelationFilter, Prisma.LicenseActivationWhereInput>
activation?: Prisma.XOR<Prisma.LicenseActivationNullableScalarRelationFilter, Prisma.LicenseActivationWhereInput> | null
}
export type LicenseRenewOrderByWithRelationInput = {
@@ -200,7 +200,7 @@ export type LicenseRenewOrderByWithRelationInput = {
created_at?: Prisma.SortOrder
updated_at?: Prisma.SortOrder
charge_transaction_id?: Prisma.SortOrder
activation_id?: Prisma.SortOrder
activation_id?: Prisma.SortOrderInput | Prisma.SortOrder
charge_transaction?: Prisma.LicenseRenewChargeTransactionOrderByWithRelationInput
activation?: Prisma.LicenseActivationOrderByWithRelationInput
_relevance?: Prisma.LicenseRenewOrderByRelevanceInput
@@ -215,9 +215,9 @@ export type LicenseRenewWhereUniqueInput = Prisma.AtLeast<{
created_at?: Prisma.DateTimeFilter<"LicenseRenew"> | Date | string
updated_at?: Prisma.DateTimeFilter<"LicenseRenew"> | Date | string
charge_transaction_id?: Prisma.StringFilter<"LicenseRenew"> | string
activation_id?: Prisma.StringFilter<"LicenseRenew"> | string
activation_id?: Prisma.StringNullableFilter<"LicenseRenew"> | string | null
charge_transaction?: Prisma.XOR<Prisma.LicenseRenewChargeTransactionScalarRelationFilter, Prisma.LicenseRenewChargeTransactionWhereInput>
activation?: Prisma.XOR<Prisma.LicenseActivationScalarRelationFilter, Prisma.LicenseActivationWhereInput>
activation?: Prisma.XOR<Prisma.LicenseActivationNullableScalarRelationFilter, Prisma.LicenseActivationWhereInput> | null
}, "id">
export type LicenseRenewOrderByWithAggregationInput = {
@@ -226,7 +226,7 @@ export type LicenseRenewOrderByWithAggregationInput = {
created_at?: Prisma.SortOrder
updated_at?: Prisma.SortOrder
charge_transaction_id?: Prisma.SortOrder
activation_id?: Prisma.SortOrder
activation_id?: Prisma.SortOrderInput | Prisma.SortOrder
_count?: Prisma.LicenseRenewCountOrderByAggregateInput
_max?: Prisma.LicenseRenewMaxOrderByAggregateInput
_min?: Prisma.LicenseRenewMinOrderByAggregateInput
@@ -241,7 +241,7 @@ export type LicenseRenewScalarWhereWithAggregatesInput = {
created_at?: Prisma.DateTimeWithAggregatesFilter<"LicenseRenew"> | Date | string
updated_at?: Prisma.DateTimeWithAggregatesFilter<"LicenseRenew"> | Date | string
charge_transaction_id?: Prisma.StringWithAggregatesFilter<"LicenseRenew"> | string
activation_id?: Prisma.StringWithAggregatesFilter<"LicenseRenew"> | string
activation_id?: Prisma.StringNullableWithAggregatesFilter<"LicenseRenew"> | string | null
}
export type LicenseRenewCreateInput = {
@@ -250,7 +250,7 @@ export type LicenseRenewCreateInput = {
created_at?: Date | string
updated_at?: Date | string
charge_transaction: Prisma.LicenseRenewChargeTransactionCreateNestedOneWithoutLicense_renewsInput
activation: Prisma.LicenseActivationCreateNestedOneWithoutLicense_renewsInput
activation?: Prisma.LicenseActivationCreateNestedOneWithoutLicense_renewsInput
}
export type LicenseRenewUncheckedCreateInput = {
@@ -259,7 +259,7 @@ export type LicenseRenewUncheckedCreateInput = {
created_at?: Date | string
updated_at?: Date | string
charge_transaction_id: string
activation_id: string
activation_id?: string | null
}
export type LicenseRenewUpdateInput = {
@@ -268,7 +268,7 @@ export type LicenseRenewUpdateInput = {
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
charge_transaction?: Prisma.LicenseRenewChargeTransactionUpdateOneRequiredWithoutLicense_renewsNestedInput
activation?: Prisma.LicenseActivationUpdateOneRequiredWithoutLicense_renewsNestedInput
activation?: Prisma.LicenseActivationUpdateOneWithoutLicense_renewsNestedInput
}
export type LicenseRenewUncheckedUpdateInput = {
@@ -277,7 +277,7 @@ export type LicenseRenewUncheckedUpdateInput = {
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
charge_transaction_id?: Prisma.StringFieldUpdateOperationsInput | string
activation_id?: Prisma.StringFieldUpdateOperationsInput | string
activation_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
export type LicenseRenewCreateManyInput = {
@@ -286,7 +286,7 @@ export type LicenseRenewCreateManyInput = {
created_at?: Date | string
updated_at?: Date | string
charge_transaction_id: string
activation_id: string
activation_id?: string | null
}
export type LicenseRenewUpdateManyMutationInput = {
@@ -302,7 +302,7 @@ export type LicenseRenewUncheckedUpdateManyInput = {
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
charge_transaction_id?: Prisma.StringFieldUpdateOperationsInput | string
activation_id?: Prisma.StringFieldUpdateOperationsInput | string
activation_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
export type LicenseRenewListRelationFilter = {
@@ -483,7 +483,7 @@ export type LicenseRenewScalarWhereInput = {
created_at?: Prisma.DateTimeFilter<"LicenseRenew"> | Date | string
updated_at?: Prisma.DateTimeFilter<"LicenseRenew"> | Date | string
charge_transaction_id?: Prisma.StringFilter<"LicenseRenew"> | string
activation_id?: Prisma.StringFilter<"LicenseRenew"> | string
activation_id?: Prisma.StringNullableFilter<"LicenseRenew"> | string | null
}
export type LicenseRenewCreateWithoutCharge_transactionInput = {
@@ -491,7 +491,7 @@ export type LicenseRenewCreateWithoutCharge_transactionInput = {
expires_at: Date | string
created_at?: Date | string
updated_at?: Date | string
activation: Prisma.LicenseActivationCreateNestedOneWithoutLicense_renewsInput
activation?: Prisma.LicenseActivationCreateNestedOneWithoutLicense_renewsInput
}
export type LicenseRenewUncheckedCreateWithoutCharge_transactionInput = {
@@ -499,7 +499,7 @@ export type LicenseRenewUncheckedCreateWithoutCharge_transactionInput = {
expires_at: Date | string
created_at?: Date | string
updated_at?: Date | string
activation_id: string
activation_id?: string | null
}
export type LicenseRenewCreateOrConnectWithoutCharge_transactionInput = {
@@ -565,7 +565,7 @@ export type LicenseRenewCreateManyCharge_transactionInput = {
expires_at: Date | string
created_at?: Date | string
updated_at?: Date | string
activation_id: string
activation_id?: string | null
}
export type LicenseRenewUpdateWithoutCharge_transactionInput = {
@@ -573,7 +573,7 @@ export type LicenseRenewUpdateWithoutCharge_transactionInput = {
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
activation?: Prisma.LicenseActivationUpdateOneRequiredWithoutLicense_renewsNestedInput
activation?: Prisma.LicenseActivationUpdateOneWithoutLicense_renewsNestedInput
}
export type LicenseRenewUncheckedUpdateWithoutCharge_transactionInput = {
@@ -581,7 +581,7 @@ export type LicenseRenewUncheckedUpdateWithoutCharge_transactionInput = {
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
activation_id?: Prisma.StringFieldUpdateOperationsInput | string
activation_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
export type LicenseRenewUncheckedUpdateManyWithoutCharge_transactionInput = {
@@ -589,7 +589,7 @@ export type LicenseRenewUncheckedUpdateManyWithoutCharge_transactionInput = {
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
activation_id?: Prisma.StringFieldUpdateOperationsInput | string
activation_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}
@@ -602,7 +602,7 @@ export type LicenseRenewSelect<ExtArgs extends runtime.Types.Extensions.Internal
charge_transaction_id?: boolean
activation_id?: boolean
charge_transaction?: boolean | Prisma.LicenseRenewChargeTransactionDefaultArgs<ExtArgs>
activation?: boolean | Prisma.LicenseActivationDefaultArgs<ExtArgs>
activation?: boolean | Prisma.LicenseRenew$activationArgs<ExtArgs>
}, ExtArgs["result"]["licenseRenew"]>
@@ -619,14 +619,14 @@ export type LicenseRenewSelectScalar = {
export type LicenseRenewOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "expires_at" | "created_at" | "updated_at" | "charge_transaction_id" | "activation_id", ExtArgs["result"]["licenseRenew"]>
export type LicenseRenewInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
charge_transaction?: boolean | Prisma.LicenseRenewChargeTransactionDefaultArgs<ExtArgs>
activation?: boolean | Prisma.LicenseActivationDefaultArgs<ExtArgs>
activation?: boolean | Prisma.LicenseRenew$activationArgs<ExtArgs>
}
export type $LicenseRenewPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
name: "LicenseRenew"
objects: {
charge_transaction: Prisma.$LicenseRenewChargeTransactionPayload<ExtArgs>
activation: Prisma.$LicenseActivationPayload<ExtArgs>
activation: Prisma.$LicenseActivationPayload<ExtArgs> | null
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
@@ -634,7 +634,7 @@ export type $LicenseRenewPayload<ExtArgs extends runtime.Types.Extensions.Intern
created_at: Date
updated_at: Date
charge_transaction_id: string
activation_id: string
activation_id: string | null
}, ExtArgs["result"]["licenseRenew"]>
composites: {}
}
@@ -976,7 +976,7 @@ readonly fields: LicenseRenewFieldRefs;
export interface Prisma__LicenseRenewClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
readonly [Symbol.toStringTag]: "PrismaPromise"
charge_transaction<T extends Prisma.LicenseRenewChargeTransactionDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.LicenseRenewChargeTransactionDefaultArgs<ExtArgs>>): Prisma.Prisma__LicenseRenewChargeTransactionClient<runtime.Types.Result.GetResult<Prisma.$LicenseRenewChargeTransactionPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
activation<T extends Prisma.LicenseActivationDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.LicenseActivationDefaultArgs<ExtArgs>>): Prisma.Prisma__LicenseActivationClient<runtime.Types.Result.GetResult<Prisma.$LicenseActivationPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
activation<T extends Prisma.LicenseRenew$activationArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.LicenseRenew$activationArgs<ExtArgs>>): Prisma.Prisma__LicenseActivationClient<runtime.Types.Result.GetResult<Prisma.$LicenseActivationPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
@@ -1359,6 +1359,25 @@ export type LicenseRenewDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.
limit?: number
}
/**
* LicenseRenew.activation
*/
export type LicenseRenew$activationArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the LicenseActivation
*/
select?: Prisma.LicenseActivationSelect<ExtArgs> | null
/**
* Omit specific fields from the LicenseActivation
*/
omit?: Prisma.LicenseActivationOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.LicenseActivationInclude<ExtArgs> | null
where?: Prisma.LicenseActivationWhereInput
}
/**
* LicenseRenew without action
*/