feat(partners): add utility functions for partner business activity allocation limits and remaining licenses

- Implemented `getPartnerBusinessActivityAllocationLimits` to retrieve allocation limits for a partner's business activity.
- Added `ensurePartnerBusinessActivityHasRemainingAllocation` to validate remaining allocation credits.
- Created `getPartnerRemainingLicenses` to count remaining licenses for a partner.
- Developed `getPartnerFirstRemainingLicense` to fetch the first unused license for a partner.
- Introduced `ensurePartnerHasRemainingLicense` to ensure a partner has at least one unused license.
This commit is contained in:
2026-04-24 23:02:05 +03:30
parent 9b652a3603
commit 12506de863
43 changed files with 4645 additions and 2196 deletions
@@ -0,0 +1,50 @@
/*
Warnings:
- You are about to drop the `partner_account_quota_allocation` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE `partner_account_quota_allocation` DROP FOREIGN KEY `partner_account_quota_allocation_charge_transaction_id_fkey`;
-- DropForeignKey
ALTER TABLE `partner_account_quota_allocation` DROP FOREIGN KEY `partner_account_quota_allocation_license_id_fkey`;
-- DropTable
DROP TABLE `partner_account_quota_allocation`;
-- CreateTable
CREATE TABLE `partner_account_quota_credit` (
`id` VARCHAR(191) NOT NULL,
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`updated_at` TIMESTAMP(0) NOT NULL,
`charge_transaction_id` VARCHAR(191) NOT NULL,
`allocation_id` VARCHAR(191) NULL,
UNIQUE INDEX `partner_account_quota_credit_allocation_id_key`(`allocation_id`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `license_account_allocation` (
`id` VARCHAR(191) NOT NULL,
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`updated_at` TIMESTAMP(0) NOT NULL,
`license_activation_id` VARCHAR(191) NOT NULL,
`account_id` VARCHAR(191) NOT NULL,
UNIQUE INDEX `license_account_allocation_account_id_key`(`account_id`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `partner_account_quota_credit` ADD CONSTRAINT `partner_account_quota_credit_charge_transaction_id_fkey` FOREIGN KEY (`charge_transaction_id`) REFERENCES `partner_account_quota_charge_transaction`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `partner_account_quota_credit` ADD CONSTRAINT `partner_account_quota_credit_allocation_id_fkey` FOREIGN KEY (`allocation_id`) REFERENCES `license_account_allocation`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_license_activation_id_fkey` FOREIGN KEY (`license_activation_id`) REFERENCES `licenses_activated`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -0,0 +1,30 @@
-- DropForeignKey
ALTER TABLE `license_account_allocation` DROP FOREIGN KEY `license_account_allocation_account_id_fkey`;
-- DropForeignKey
ALTER TABLE `license_account_allocation` DROP FOREIGN KEY `license_account_allocation_license_activation_id_fkey`;
-- DropForeignKey
ALTER TABLE `partner_account_quota_credit` DROP FOREIGN KEY `partner_account_quota_credit_charge_transaction_id_fkey`;
-- DropIndex
DROP INDEX `license_account_allocation_license_activation_id_fkey` ON `license_account_allocation`;
-- DropIndex
DROP INDEX `partner_account_quota_credit_charge_transaction_id_fkey` ON `partner_account_quota_credit`;
-- AlterTable
ALTER TABLE `license_account_allocation` MODIFY `license_activation_id` VARCHAR(191) NULL,
MODIFY `account_id` VARCHAR(191) NULL;
-- AlterTable
ALTER TABLE `partner_account_quota_credit` MODIFY `charge_transaction_id` VARCHAR(191) NULL;
-- AddForeignKey
ALTER TABLE `partner_account_quota_credit` ADD CONSTRAINT `partner_account_quota_credit_charge_transaction_id_fkey` FOREIGN KEY (`charge_transaction_id`) REFERENCES `partner_account_quota_charge_transaction`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_license_activation_id_fkey` FOREIGN KEY (`license_activation_id`) REFERENCES `licenses_activated`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
+4 -3
View File
@@ -11,9 +11,10 @@ model ConsumerAccount {
account_id String @unique()
account Account @relation(fields: [account_id], references: [id])
pos Pos?
permission PermissionConsumer?
sales_invoices SalesInvoice[]
pos Pos?
permission PermissionConsumer?
account_allocation LicenseAccountAllocation?
sales_invoices SalesInvoice[]
@@map("consumer_accounts")
}
+66 -48
View File
@@ -1,37 +1,3 @@
model License {
id String @id @default(ulid())
accounts_limit Int @default(2)
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @updatedAt() @db.Timestamp(0)
charge_transaction_id String
charge_transaction LicenseChargeTransaction @relation(fields: [charge_transaction_id], references: [id])
activation LicenseActivation?
account_allocations PartnerAccountQuotaAllocation[]
@@map("licenses")
}
model LicenseActivation {
id String @id @unique() @default(ulid())
starts_at DateTime
expires_at DateTime
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @updatedAt() @db.Timestamp(0)
license_id String @unique
license License @relation(fields: [license_id], references: [id])
business_activity_id String @unique
business_activity BusinessActivity @relation(fields: [business_activity_id], references: [id])
license_renews LicenseRenew[]
@@map("licenses_activated")
}
model LicenseChargeTransaction {
id String @id @default(ulid())
activation_expires_at DateTime
@@ -49,20 +15,39 @@ model LicenseChargeTransaction {
@@map("license_charged_transactions")
}
model LicenseRenew {
id String @id @default(ulid())
expires_at DateTime
model License {
id String @id @default(ulid())
accounts_limit Int @default(2)
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @updatedAt() @db.Timestamp(0)
charge_transaction_id String
charge_transaction LicenseRenewChargeTransaction @relation(fields: [charge_transaction_id], references: [id])
charge_transaction LicenseChargeTransaction @relation(fields: [charge_transaction_id], references: [id])
activation_id String
activation LicenseActivation @relation(fields: [activation_id], references: [id])
activation LicenseActivation?
@@map("license_renew")
@@map("licenses")
}
model LicenseActivation {
id String @id @unique() @default(ulid())
starts_at DateTime
expires_at DateTime
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @updatedAt() @db.Timestamp(0)
license_id String @unique
license License @relation(fields: [license_id], references: [id])
business_activity_id String @unique
business_activity BusinessActivity @relation(fields: [business_activity_id], references: [id])
license_renews LicenseRenew[]
account_allocations LicenseAccountAllocation[]
@@map("licenses_activated")
}
model LicenseRenewChargeTransaction {
@@ -82,6 +67,22 @@ model LicenseRenewChargeTransaction {
@@map("license_renew_charge_transaction")
}
model LicenseRenew {
id String @id @default(ulid())
expires_at DateTime
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @updatedAt() @db.Timestamp(0)
charge_transaction_id String
charge_transaction LicenseRenewChargeTransaction @relation(fields: [charge_transaction_id], references: [id])
activation_id String
activation LicenseActivation @relation(fields: [activation_id], references: [id])
@@map("license_renew")
}
model PartnerAccountQuotaChargeTransaction {
id String @id @default(ulid())
activation_expires_at DateTime
@@ -94,22 +95,39 @@ model PartnerAccountQuotaChargeTransaction {
partner_id String
partner Partner @relation(fields: [partner_id], references: [id])
allocations PartnerAccountQuotaAllocation[]
credits PartnerAccountQuotaCredit[]
@@map("partner_account_quota_charge_transaction")
}
model PartnerAccountQuotaAllocation {
model PartnerAccountQuotaCredit {
id String @id @default(ulid())
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @updatedAt() @db.Timestamp(0)
charge_transaction_id String
charge_transaction PartnerAccountQuotaChargeTransaction @relation(fields: [charge_transaction_id], references: [id])
charge_transaction_id String?
charge_transaction PartnerAccountQuotaChargeTransaction? @relation(fields: [charge_transaction_id], references: [id])
license_id String?
license License? @relation(fields: [license_id], references: [id])
allocation_id String? @unique
allocation LicenseAccountAllocation? @relation(fields: [allocation_id], references: [id])
@@map("partner_account_quota_allocation")
@@map("partner_account_quota_credit")
}
model LicenseAccountAllocation {
id String @id @default(ulid())
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @updatedAt() @db.Timestamp(0)
license_activation_id String?
license_activation LicenseActivation? @relation(fields: [license_activation_id], references: [id])
account_id String? @unique
account ConsumerAccount? @relation(fields: [account_id], references: [id])
partner_account_quota_credit PartnerAccountQuotaCredit?
@@map("license_account_allocation")
}
+1 -1
View File
@@ -5,7 +5,7 @@ model PartnerAccount {
created_at DateTime @default(now()) @db.Timestamp(0)
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(0)
partner_id String
partner_id String @unique
partner Partner @relation(fields: [partner_id], references: [id])
account_id String @unique
+14 -9
View File
@@ -67,6 +67,11 @@ export type DeviceBrand = Prisma.DeviceBrandModel
*
*/
export type Device = Prisma.DeviceModel
/**
* Model LicenseChargeTransaction
*
*/
export type LicenseChargeTransaction = Prisma.LicenseChargeTransactionModel
/**
* Model License
*
@@ -78,30 +83,30 @@ export type License = Prisma.LicenseModel
*/
export type LicenseActivation = Prisma.LicenseActivationModel
/**
* Model LicenseChargeTransaction
* Model LicenseRenewChargeTransaction
*
*/
export type LicenseChargeTransaction = Prisma.LicenseChargeTransactionModel
export type LicenseRenewChargeTransaction = Prisma.LicenseRenewChargeTransactionModel
/**
* Model LicenseRenew
*
*/
export type LicenseRenew = Prisma.LicenseRenewModel
/**
* Model LicenseRenewChargeTransaction
*
*/
export type LicenseRenewChargeTransaction = Prisma.LicenseRenewChargeTransactionModel
/**
* Model PartnerAccountQuotaChargeTransaction
*
*/
export type PartnerAccountQuotaChargeTransaction = Prisma.PartnerAccountQuotaChargeTransactionModel
/**
* Model PartnerAccountQuotaAllocation
* Model PartnerAccountQuotaCredit
*
*/
export type PartnerAccountQuotaAllocation = Prisma.PartnerAccountQuotaAllocationModel
export type PartnerAccountQuotaCredit = Prisma.PartnerAccountQuotaCreditModel
/**
* Model LicenseAccountAllocation
*
*/
export type LicenseAccountAllocation = Prisma.LicenseAccountAllocationModel
/**
* Model PartnerAccount
*
+14 -9
View File
@@ -89,6 +89,11 @@ export type DeviceBrand = Prisma.DeviceBrandModel
*
*/
export type Device = Prisma.DeviceModel
/**
* Model LicenseChargeTransaction
*
*/
export type LicenseChargeTransaction = Prisma.LicenseChargeTransactionModel
/**
* Model License
*
@@ -100,30 +105,30 @@ export type License = Prisma.LicenseModel
*/
export type LicenseActivation = Prisma.LicenseActivationModel
/**
* Model LicenseChargeTransaction
* Model LicenseRenewChargeTransaction
*
*/
export type LicenseChargeTransaction = Prisma.LicenseChargeTransactionModel
export type LicenseRenewChargeTransaction = Prisma.LicenseRenewChargeTransactionModel
/**
* Model LicenseRenew
*
*/
export type LicenseRenew = Prisma.LicenseRenewModel
/**
* Model LicenseRenewChargeTransaction
*
*/
export type LicenseRenewChargeTransaction = Prisma.LicenseRenewChargeTransactionModel
/**
* Model PartnerAccountQuotaChargeTransaction
*
*/
export type PartnerAccountQuotaChargeTransaction = Prisma.PartnerAccountQuotaChargeTransactionModel
/**
* Model PartnerAccountQuotaAllocation
* Model PartnerAccountQuotaCredit
*
*/
export type PartnerAccountQuotaAllocation = Prisma.PartnerAccountQuotaAllocationModel
export type PartnerAccountQuotaCredit = Prisma.PartnerAccountQuotaCreditModel
/**
* Model LicenseAccountAllocation
*
*/
export type LicenseAccountAllocation = Prisma.LicenseAccountAllocationModel
/**
* Model PartnerAccount
*
File diff suppressed because one or more lines are too long
+253 -165
View File
@@ -394,13 +394,14 @@ export const ModelName = {
Pos: 'Pos',
DeviceBrand: 'DeviceBrand',
Device: 'Device',
LicenseChargeTransaction: 'LicenseChargeTransaction',
License: 'License',
LicenseActivation: 'LicenseActivation',
LicenseChargeTransaction: 'LicenseChargeTransaction',
LicenseRenew: 'LicenseRenew',
LicenseRenewChargeTransaction: 'LicenseRenewChargeTransaction',
LicenseRenew: 'LicenseRenew',
PartnerAccountQuotaChargeTransaction: 'PartnerAccountQuotaChargeTransaction',
PartnerAccountQuotaAllocation: 'PartnerAccountQuotaAllocation',
PartnerAccountQuotaCredit: 'PartnerAccountQuotaCredit',
LicenseAccountAllocation: 'LicenseAccountAllocation',
PartnerAccount: 'PartnerAccount',
Partner: 'Partner',
PermissionConsumer: 'PermissionConsumer',
@@ -438,7 +439,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
omit: GlobalOmitOptions
}
meta: {
modelProps: "adminAccount" | "admin" | "account" | "consumerAccount" | "consumer" | "businessActivity" | "complex" | "pos" | "deviceBrand" | "device" | "license" | "licenseActivation" | "licenseChargeTransaction" | "licenseRenew" | "licenseRenewChargeTransaction" | "partnerAccountQuotaChargeTransaction" | "partnerAccountQuotaAllocation" | "partnerAccount" | "partner" | "permissionConsumer" | "permissionPos" | "permissionComplex" | "permissionBusiness" | "providerAccount" | "provider" | "consumerDevices" | "applicationReleasedInfo" | "triggerLog" | "customer" | "customerIndividual" | "customerLegal" | "good" | "goodCategory" | "guild" | "salesInvoice" | "salesInvoiceItem" | "salesInvoicePayment" | "service" | "serviceCategory"
modelProps: "adminAccount" | "admin" | "account" | "consumerAccount" | "consumer" | "businessActivity" | "complex" | "pos" | "deviceBrand" | "device" | "licenseChargeTransaction" | "license" | "licenseActivation" | "licenseRenewChargeTransaction" | "licenseRenew" | "partnerAccountQuotaChargeTransaction" | "partnerAccountQuotaCredit" | "licenseAccountAllocation" | "partnerAccount" | "partner" | "permissionConsumer" | "permissionPos" | "permissionComplex" | "permissionBusiness" | "providerAccount" | "provider" | "consumerDevices" | "applicationReleasedInfo" | "triggerLog" | "customer" | "customerIndividual" | "customerLegal" | "good" | "goodCategory" | "guild" | "salesInvoice" | "salesInvoiceItem" | "salesInvoicePayment" | "service" | "serviceCategory"
txIsolationLevel: TransactionIsolationLevel
}
model: {
@@ -1102,6 +1103,72 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
}
}
}
LicenseChargeTransaction: {
payload: Prisma.$LicenseChargeTransactionPayload<ExtArgs>
fields: Prisma.LicenseChargeTransactionFieldRefs
operations: {
findUnique: {
args: Prisma.LicenseChargeTransactionFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload> | null
}
findUniqueOrThrow: {
args: Prisma.LicenseChargeTransactionFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>
}
findFirst: {
args: Prisma.LicenseChargeTransactionFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload> | null
}
findFirstOrThrow: {
args: Prisma.LicenseChargeTransactionFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>
}
findMany: {
args: Prisma.LicenseChargeTransactionFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>[]
}
create: {
args: Prisma.LicenseChargeTransactionCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>
}
createMany: {
args: Prisma.LicenseChargeTransactionCreateManyArgs<ExtArgs>
result: BatchPayload
}
delete: {
args: Prisma.LicenseChargeTransactionDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>
}
update: {
args: Prisma.LicenseChargeTransactionUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>
}
deleteMany: {
args: Prisma.LicenseChargeTransactionDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.LicenseChargeTransactionUpdateManyArgs<ExtArgs>
result: BatchPayload
}
upsert: {
args: Prisma.LicenseChargeTransactionUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>
}
aggregate: {
args: Prisma.LicenseChargeTransactionAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateLicenseChargeTransaction>
}
groupBy: {
args: Prisma.LicenseChargeTransactionGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.LicenseChargeTransactionGroupByOutputType>[]
}
count: {
args: Prisma.LicenseChargeTransactionCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.LicenseChargeTransactionCountAggregateOutputType> | number
}
}
}
License: {
payload: Prisma.$LicensePayload<ExtArgs>
fields: Prisma.LicenseFieldRefs
@@ -1234,69 +1301,69 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
}
}
}
LicenseChargeTransaction: {
payload: Prisma.$LicenseChargeTransactionPayload<ExtArgs>
fields: Prisma.LicenseChargeTransactionFieldRefs
LicenseRenewChargeTransaction: {
payload: Prisma.$LicenseRenewChargeTransactionPayload<ExtArgs>
fields: Prisma.LicenseRenewChargeTransactionFieldRefs
operations: {
findUnique: {
args: Prisma.LicenseChargeTransactionFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload> | null
args: Prisma.LicenseRenewChargeTransactionFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload> | null
}
findUniqueOrThrow: {
args: Prisma.LicenseChargeTransactionFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>
args: Prisma.LicenseRenewChargeTransactionFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>
}
findFirst: {
args: Prisma.LicenseChargeTransactionFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload> | null
args: Prisma.LicenseRenewChargeTransactionFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload> | null
}
findFirstOrThrow: {
args: Prisma.LicenseChargeTransactionFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>
args: Prisma.LicenseRenewChargeTransactionFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>
}
findMany: {
args: Prisma.LicenseChargeTransactionFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>[]
args: Prisma.LicenseRenewChargeTransactionFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>[]
}
create: {
args: Prisma.LicenseChargeTransactionCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>
args: Prisma.LicenseRenewChargeTransactionCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>
}
createMany: {
args: Prisma.LicenseChargeTransactionCreateManyArgs<ExtArgs>
args: Prisma.LicenseRenewChargeTransactionCreateManyArgs<ExtArgs>
result: BatchPayload
}
delete: {
args: Prisma.LicenseChargeTransactionDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>
args: Prisma.LicenseRenewChargeTransactionDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>
}
update: {
args: Prisma.LicenseChargeTransactionUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>
args: Prisma.LicenseRenewChargeTransactionUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>
}
deleteMany: {
args: Prisma.LicenseChargeTransactionDeleteManyArgs<ExtArgs>
args: Prisma.LicenseRenewChargeTransactionDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.LicenseChargeTransactionUpdateManyArgs<ExtArgs>
args: Prisma.LicenseRenewChargeTransactionUpdateManyArgs<ExtArgs>
result: BatchPayload
}
upsert: {
args: Prisma.LicenseChargeTransactionUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseChargeTransactionPayload>
args: Prisma.LicenseRenewChargeTransactionUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>
}
aggregate: {
args: Prisma.LicenseChargeTransactionAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateLicenseChargeTransaction>
args: Prisma.LicenseRenewChargeTransactionAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateLicenseRenewChargeTransaction>
}
groupBy: {
args: Prisma.LicenseChargeTransactionGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.LicenseChargeTransactionGroupByOutputType>[]
args: Prisma.LicenseRenewChargeTransactionGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.LicenseRenewChargeTransactionGroupByOutputType>[]
}
count: {
args: Prisma.LicenseChargeTransactionCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.LicenseChargeTransactionCountAggregateOutputType> | number
args: Prisma.LicenseRenewChargeTransactionCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.LicenseRenewChargeTransactionCountAggregateOutputType> | number
}
}
}
@@ -1366,72 +1433,6 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
}
}
}
LicenseRenewChargeTransaction: {
payload: Prisma.$LicenseRenewChargeTransactionPayload<ExtArgs>
fields: Prisma.LicenseRenewChargeTransactionFieldRefs
operations: {
findUnique: {
args: Prisma.LicenseRenewChargeTransactionFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload> | null
}
findUniqueOrThrow: {
args: Prisma.LicenseRenewChargeTransactionFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>
}
findFirst: {
args: Prisma.LicenseRenewChargeTransactionFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload> | null
}
findFirstOrThrow: {
args: Prisma.LicenseRenewChargeTransactionFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>
}
findMany: {
args: Prisma.LicenseRenewChargeTransactionFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>[]
}
create: {
args: Prisma.LicenseRenewChargeTransactionCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>
}
createMany: {
args: Prisma.LicenseRenewChargeTransactionCreateManyArgs<ExtArgs>
result: BatchPayload
}
delete: {
args: Prisma.LicenseRenewChargeTransactionDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>
}
update: {
args: Prisma.LicenseRenewChargeTransactionUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>
}
deleteMany: {
args: Prisma.LicenseRenewChargeTransactionDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.LicenseRenewChargeTransactionUpdateManyArgs<ExtArgs>
result: BatchPayload
}
upsert: {
args: Prisma.LicenseRenewChargeTransactionUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseRenewChargeTransactionPayload>
}
aggregate: {
args: Prisma.LicenseRenewChargeTransactionAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateLicenseRenewChargeTransaction>
}
groupBy: {
args: Prisma.LicenseRenewChargeTransactionGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.LicenseRenewChargeTransactionGroupByOutputType>[]
}
count: {
args: Prisma.LicenseRenewChargeTransactionCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.LicenseRenewChargeTransactionCountAggregateOutputType> | number
}
}
}
PartnerAccountQuotaChargeTransaction: {
payload: Prisma.$PartnerAccountQuotaChargeTransactionPayload<ExtArgs>
fields: Prisma.PartnerAccountQuotaChargeTransactionFieldRefs
@@ -1498,69 +1499,135 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
}
}
}
PartnerAccountQuotaAllocation: {
payload: Prisma.$PartnerAccountQuotaAllocationPayload<ExtArgs>
fields: Prisma.PartnerAccountQuotaAllocationFieldRefs
PartnerAccountQuotaCredit: {
payload: Prisma.$PartnerAccountQuotaCreditPayload<ExtArgs>
fields: Prisma.PartnerAccountQuotaCreditFieldRefs
operations: {
findUnique: {
args: Prisma.PartnerAccountQuotaAllocationFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaAllocationPayload> | null
args: Prisma.PartnerAccountQuotaCreditFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaCreditPayload> | null
}
findUniqueOrThrow: {
args: Prisma.PartnerAccountQuotaAllocationFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaAllocationPayload>
args: Prisma.PartnerAccountQuotaCreditFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaCreditPayload>
}
findFirst: {
args: Prisma.PartnerAccountQuotaAllocationFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaAllocationPayload> | null
args: Prisma.PartnerAccountQuotaCreditFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaCreditPayload> | null
}
findFirstOrThrow: {
args: Prisma.PartnerAccountQuotaAllocationFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaAllocationPayload>
args: Prisma.PartnerAccountQuotaCreditFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaCreditPayload>
}
findMany: {
args: Prisma.PartnerAccountQuotaAllocationFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaAllocationPayload>[]
args: Prisma.PartnerAccountQuotaCreditFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaCreditPayload>[]
}
create: {
args: Prisma.PartnerAccountQuotaAllocationCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaAllocationPayload>
args: Prisma.PartnerAccountQuotaCreditCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaCreditPayload>
}
createMany: {
args: Prisma.PartnerAccountQuotaAllocationCreateManyArgs<ExtArgs>
args: Prisma.PartnerAccountQuotaCreditCreateManyArgs<ExtArgs>
result: BatchPayload
}
delete: {
args: Prisma.PartnerAccountQuotaAllocationDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaAllocationPayload>
args: Prisma.PartnerAccountQuotaCreditDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaCreditPayload>
}
update: {
args: Prisma.PartnerAccountQuotaAllocationUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaAllocationPayload>
args: Prisma.PartnerAccountQuotaCreditUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaCreditPayload>
}
deleteMany: {
args: Prisma.PartnerAccountQuotaAllocationDeleteManyArgs<ExtArgs>
args: Prisma.PartnerAccountQuotaCreditDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.PartnerAccountQuotaAllocationUpdateManyArgs<ExtArgs>
args: Prisma.PartnerAccountQuotaCreditUpdateManyArgs<ExtArgs>
result: BatchPayload
}
upsert: {
args: Prisma.PartnerAccountQuotaAllocationUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaAllocationPayload>
args: Prisma.PartnerAccountQuotaCreditUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$PartnerAccountQuotaCreditPayload>
}
aggregate: {
args: Prisma.PartnerAccountQuotaAllocationAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregatePartnerAccountQuotaAllocation>
args: Prisma.PartnerAccountQuotaCreditAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregatePartnerAccountQuotaCredit>
}
groupBy: {
args: Prisma.PartnerAccountQuotaAllocationGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.PartnerAccountQuotaAllocationGroupByOutputType>[]
args: Prisma.PartnerAccountQuotaCreditGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.PartnerAccountQuotaCreditGroupByOutputType>[]
}
count: {
args: Prisma.PartnerAccountQuotaAllocationCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.PartnerAccountQuotaAllocationCountAggregateOutputType> | number
args: Prisma.PartnerAccountQuotaCreditCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.PartnerAccountQuotaCreditCountAggregateOutputType> | number
}
}
}
LicenseAccountAllocation: {
payload: Prisma.$LicenseAccountAllocationPayload<ExtArgs>
fields: Prisma.LicenseAccountAllocationFieldRefs
operations: {
findUnique: {
args: Prisma.LicenseAccountAllocationFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseAccountAllocationPayload> | null
}
findUniqueOrThrow: {
args: Prisma.LicenseAccountAllocationFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseAccountAllocationPayload>
}
findFirst: {
args: Prisma.LicenseAccountAllocationFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseAccountAllocationPayload> | null
}
findFirstOrThrow: {
args: Prisma.LicenseAccountAllocationFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseAccountAllocationPayload>
}
findMany: {
args: Prisma.LicenseAccountAllocationFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseAccountAllocationPayload>[]
}
create: {
args: Prisma.LicenseAccountAllocationCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseAccountAllocationPayload>
}
createMany: {
args: Prisma.LicenseAccountAllocationCreateManyArgs<ExtArgs>
result: BatchPayload
}
delete: {
args: Prisma.LicenseAccountAllocationDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseAccountAllocationPayload>
}
update: {
args: Prisma.LicenseAccountAllocationUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseAccountAllocationPayload>
}
deleteMany: {
args: Prisma.LicenseAccountAllocationDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.LicenseAccountAllocationUpdateManyArgs<ExtArgs>
result: BatchPayload
}
upsert: {
args: Prisma.LicenseAccountAllocationUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$LicenseAccountAllocationPayload>
}
aggregate: {
args: Prisma.LicenseAccountAllocationAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateLicenseAccountAllocation>
}
groupBy: {
args: Prisma.LicenseAccountAllocationGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.LicenseAccountAllocationGroupByOutputType>[]
}
count: {
args: Prisma.LicenseAccountAllocationCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.LicenseAccountAllocationCountAggregateOutputType> | number
}
}
}
@@ -3183,6 +3250,19 @@ export const DeviceScalarFieldEnum = {
export type DeviceScalarFieldEnum = (typeof DeviceScalarFieldEnum)[keyof typeof DeviceScalarFieldEnum]
export const LicenseChargeTransactionScalarFieldEnum = {
id: 'id',
activation_expires_at: 'activation_expires_at',
tracking_code: 'tracking_code',
purchased_count: 'purchased_count',
created_at: 'created_at',
updated_at: 'updated_at',
partner_id: 'partner_id'
} as const
export type LicenseChargeTransactionScalarFieldEnum = (typeof LicenseChargeTransactionScalarFieldEnum)[keyof typeof LicenseChargeTransactionScalarFieldEnum]
export const LicenseScalarFieldEnum = {
id: 'id',
accounts_limit: 'accounts_limit',
@@ -3207,7 +3287,7 @@ export const LicenseActivationScalarFieldEnum = {
export type LicenseActivationScalarFieldEnum = (typeof LicenseActivationScalarFieldEnum)[keyof typeof LicenseActivationScalarFieldEnum]
export const LicenseChargeTransactionScalarFieldEnum = {
export const LicenseRenewChargeTransactionScalarFieldEnum = {
id: 'id',
activation_expires_at: 'activation_expires_at',
tracking_code: 'tracking_code',
@@ -3217,7 +3297,7 @@ export const LicenseChargeTransactionScalarFieldEnum = {
partner_id: 'partner_id'
} as const
export type LicenseChargeTransactionScalarFieldEnum = (typeof LicenseChargeTransactionScalarFieldEnum)[keyof typeof LicenseChargeTransactionScalarFieldEnum]
export type LicenseRenewChargeTransactionScalarFieldEnum = (typeof LicenseRenewChargeTransactionScalarFieldEnum)[keyof typeof LicenseRenewChargeTransactionScalarFieldEnum]
export const LicenseRenewScalarFieldEnum = {
@@ -3232,19 +3312,6 @@ export const LicenseRenewScalarFieldEnum = {
export type LicenseRenewScalarFieldEnum = (typeof LicenseRenewScalarFieldEnum)[keyof typeof LicenseRenewScalarFieldEnum]
export const LicenseRenewChargeTransactionScalarFieldEnum = {
id: 'id',
activation_expires_at: 'activation_expires_at',
tracking_code: 'tracking_code',
purchased_count: 'purchased_count',
created_at: 'created_at',
updated_at: 'updated_at',
partner_id: 'partner_id'
} as const
export type LicenseRenewChargeTransactionScalarFieldEnum = (typeof LicenseRenewChargeTransactionScalarFieldEnum)[keyof typeof LicenseRenewChargeTransactionScalarFieldEnum]
export const PartnerAccountQuotaChargeTransactionScalarFieldEnum = {
id: 'id',
activation_expires_at: 'activation_expires_at',
@@ -3258,15 +3325,26 @@ export const PartnerAccountQuotaChargeTransactionScalarFieldEnum = {
export type PartnerAccountQuotaChargeTransactionScalarFieldEnum = (typeof PartnerAccountQuotaChargeTransactionScalarFieldEnum)[keyof typeof PartnerAccountQuotaChargeTransactionScalarFieldEnum]
export const PartnerAccountQuotaAllocationScalarFieldEnum = {
export const PartnerAccountQuotaCreditScalarFieldEnum = {
id: 'id',
created_at: 'created_at',
updated_at: 'updated_at',
charge_transaction_id: 'charge_transaction_id',
license_id: 'license_id'
allocation_id: 'allocation_id'
} as const
export type PartnerAccountQuotaAllocationScalarFieldEnum = (typeof PartnerAccountQuotaAllocationScalarFieldEnum)[keyof typeof PartnerAccountQuotaAllocationScalarFieldEnum]
export type PartnerAccountQuotaCreditScalarFieldEnum = (typeof PartnerAccountQuotaCreditScalarFieldEnum)[keyof typeof PartnerAccountQuotaCreditScalarFieldEnum]
export const LicenseAccountAllocationScalarFieldEnum = {
id: 'id',
created_at: 'created_at',
updated_at: 'updated_at',
license_activation_id: 'license_activation_id',
account_id: 'account_id'
} as const
export type LicenseAccountAllocationScalarFieldEnum = (typeof LicenseAccountAllocationScalarFieldEnum)[keyof typeof LicenseAccountAllocationScalarFieldEnum]
export const PartnerAccountScalarFieldEnum = {
@@ -3701,6 +3779,15 @@ export const DeviceOrderByRelevanceFieldEnum = {
export type DeviceOrderByRelevanceFieldEnum = (typeof DeviceOrderByRelevanceFieldEnum)[keyof typeof DeviceOrderByRelevanceFieldEnum]
export const LicenseChargeTransactionOrderByRelevanceFieldEnum = {
id: 'id',
tracking_code: 'tracking_code',
partner_id: 'partner_id'
} as const
export type LicenseChargeTransactionOrderByRelevanceFieldEnum = (typeof LicenseChargeTransactionOrderByRelevanceFieldEnum)[keyof typeof LicenseChargeTransactionOrderByRelevanceFieldEnum]
export const LicenseOrderByRelevanceFieldEnum = {
id: 'id',
charge_transaction_id: 'charge_transaction_id'
@@ -3718,13 +3805,13 @@ export const LicenseActivationOrderByRelevanceFieldEnum = {
export type LicenseActivationOrderByRelevanceFieldEnum = (typeof LicenseActivationOrderByRelevanceFieldEnum)[keyof typeof LicenseActivationOrderByRelevanceFieldEnum]
export const LicenseChargeTransactionOrderByRelevanceFieldEnum = {
export const LicenseRenewChargeTransactionOrderByRelevanceFieldEnum = {
id: 'id',
tracking_code: 'tracking_code',
partner_id: 'partner_id'
} as const
export type LicenseChargeTransactionOrderByRelevanceFieldEnum = (typeof LicenseChargeTransactionOrderByRelevanceFieldEnum)[keyof typeof LicenseChargeTransactionOrderByRelevanceFieldEnum]
export type LicenseRenewChargeTransactionOrderByRelevanceFieldEnum = (typeof LicenseRenewChargeTransactionOrderByRelevanceFieldEnum)[keyof typeof LicenseRenewChargeTransactionOrderByRelevanceFieldEnum]
export const LicenseRenewOrderByRelevanceFieldEnum = {
@@ -3736,15 +3823,6 @@ export const LicenseRenewOrderByRelevanceFieldEnum = {
export type LicenseRenewOrderByRelevanceFieldEnum = (typeof LicenseRenewOrderByRelevanceFieldEnum)[keyof typeof LicenseRenewOrderByRelevanceFieldEnum]
export const LicenseRenewChargeTransactionOrderByRelevanceFieldEnum = {
id: 'id',
tracking_code: 'tracking_code',
partner_id: 'partner_id'
} as const
export type LicenseRenewChargeTransactionOrderByRelevanceFieldEnum = (typeof LicenseRenewChargeTransactionOrderByRelevanceFieldEnum)[keyof typeof LicenseRenewChargeTransactionOrderByRelevanceFieldEnum]
export const PartnerAccountQuotaChargeTransactionOrderByRelevanceFieldEnum = {
id: 'id',
tracking_code: 'tracking_code',
@@ -3754,13 +3832,22 @@ export const PartnerAccountQuotaChargeTransactionOrderByRelevanceFieldEnum = {
export type PartnerAccountQuotaChargeTransactionOrderByRelevanceFieldEnum = (typeof PartnerAccountQuotaChargeTransactionOrderByRelevanceFieldEnum)[keyof typeof PartnerAccountQuotaChargeTransactionOrderByRelevanceFieldEnum]
export const PartnerAccountQuotaAllocationOrderByRelevanceFieldEnum = {
export const PartnerAccountQuotaCreditOrderByRelevanceFieldEnum = {
id: 'id',
charge_transaction_id: 'charge_transaction_id',
license_id: 'license_id'
allocation_id: 'allocation_id'
} as const
export type PartnerAccountQuotaAllocationOrderByRelevanceFieldEnum = (typeof PartnerAccountQuotaAllocationOrderByRelevanceFieldEnum)[keyof typeof PartnerAccountQuotaAllocationOrderByRelevanceFieldEnum]
export type PartnerAccountQuotaCreditOrderByRelevanceFieldEnum = (typeof PartnerAccountQuotaCreditOrderByRelevanceFieldEnum)[keyof typeof PartnerAccountQuotaCreditOrderByRelevanceFieldEnum]
export const LicenseAccountAllocationOrderByRelevanceFieldEnum = {
id: 'id',
license_activation_id: 'license_activation_id',
account_id: 'account_id'
} as const
export type LicenseAccountAllocationOrderByRelevanceFieldEnum = (typeof LicenseAccountAllocationOrderByRelevanceFieldEnum)[keyof typeof LicenseAccountAllocationOrderByRelevanceFieldEnum]
export const PartnerAccountOrderByRelevanceFieldEnum = {
@@ -4314,13 +4401,14 @@ export type GlobalOmitConfig = {
pos?: Prisma.PosOmit
deviceBrand?: Prisma.DeviceBrandOmit
device?: Prisma.DeviceOmit
licenseChargeTransaction?: Prisma.LicenseChargeTransactionOmit
license?: Prisma.LicenseOmit
licenseActivation?: Prisma.LicenseActivationOmit
licenseChargeTransaction?: Prisma.LicenseChargeTransactionOmit
licenseRenew?: Prisma.LicenseRenewOmit
licenseRenewChargeTransaction?: Prisma.LicenseRenewChargeTransactionOmit
licenseRenew?: Prisma.LicenseRenewOmit
partnerAccountQuotaChargeTransaction?: Prisma.PartnerAccountQuotaChargeTransactionOmit
partnerAccountQuotaAllocation?: Prisma.PartnerAccountQuotaAllocationOmit
partnerAccountQuotaCredit?: Prisma.PartnerAccountQuotaCreditOmit
licenseAccountAllocation?: Prisma.LicenseAccountAllocationOmit
partnerAccount?: Prisma.PartnerAccountOmit
partner?: Prisma.PartnerOmit
permissionConsumer?: Prisma.PermissionConsumerOmit
@@ -61,13 +61,14 @@ export const ModelName = {
Pos: 'Pos',
DeviceBrand: 'DeviceBrand',
Device: 'Device',
LicenseChargeTransaction: 'LicenseChargeTransaction',
License: 'License',
LicenseActivation: 'LicenseActivation',
LicenseChargeTransaction: 'LicenseChargeTransaction',
LicenseRenew: 'LicenseRenew',
LicenseRenewChargeTransaction: 'LicenseRenewChargeTransaction',
LicenseRenew: 'LicenseRenew',
PartnerAccountQuotaChargeTransaction: 'PartnerAccountQuotaChargeTransaction',
PartnerAccountQuotaAllocation: 'PartnerAccountQuotaAllocation',
PartnerAccountQuotaCredit: 'PartnerAccountQuotaCredit',
LicenseAccountAllocation: 'LicenseAccountAllocation',
PartnerAccount: 'PartnerAccount',
Partner: 'Partner',
PermissionConsumer: 'PermissionConsumer',
@@ -236,6 +237,19 @@ export const DeviceScalarFieldEnum = {
export type DeviceScalarFieldEnum = (typeof DeviceScalarFieldEnum)[keyof typeof DeviceScalarFieldEnum]
export const LicenseChargeTransactionScalarFieldEnum = {
id: 'id',
activation_expires_at: 'activation_expires_at',
tracking_code: 'tracking_code',
purchased_count: 'purchased_count',
created_at: 'created_at',
updated_at: 'updated_at',
partner_id: 'partner_id'
} as const
export type LicenseChargeTransactionScalarFieldEnum = (typeof LicenseChargeTransactionScalarFieldEnum)[keyof typeof LicenseChargeTransactionScalarFieldEnum]
export const LicenseScalarFieldEnum = {
id: 'id',
accounts_limit: 'accounts_limit',
@@ -260,7 +274,7 @@ export const LicenseActivationScalarFieldEnum = {
export type LicenseActivationScalarFieldEnum = (typeof LicenseActivationScalarFieldEnum)[keyof typeof LicenseActivationScalarFieldEnum]
export const LicenseChargeTransactionScalarFieldEnum = {
export const LicenseRenewChargeTransactionScalarFieldEnum = {
id: 'id',
activation_expires_at: 'activation_expires_at',
tracking_code: 'tracking_code',
@@ -270,7 +284,7 @@ export const LicenseChargeTransactionScalarFieldEnum = {
partner_id: 'partner_id'
} as const
export type LicenseChargeTransactionScalarFieldEnum = (typeof LicenseChargeTransactionScalarFieldEnum)[keyof typeof LicenseChargeTransactionScalarFieldEnum]
export type LicenseRenewChargeTransactionScalarFieldEnum = (typeof LicenseRenewChargeTransactionScalarFieldEnum)[keyof typeof LicenseRenewChargeTransactionScalarFieldEnum]
export const LicenseRenewScalarFieldEnum = {
@@ -285,19 +299,6 @@ export const LicenseRenewScalarFieldEnum = {
export type LicenseRenewScalarFieldEnum = (typeof LicenseRenewScalarFieldEnum)[keyof typeof LicenseRenewScalarFieldEnum]
export const LicenseRenewChargeTransactionScalarFieldEnum = {
id: 'id',
activation_expires_at: 'activation_expires_at',
tracking_code: 'tracking_code',
purchased_count: 'purchased_count',
created_at: 'created_at',
updated_at: 'updated_at',
partner_id: 'partner_id'
} as const
export type LicenseRenewChargeTransactionScalarFieldEnum = (typeof LicenseRenewChargeTransactionScalarFieldEnum)[keyof typeof LicenseRenewChargeTransactionScalarFieldEnum]
export const PartnerAccountQuotaChargeTransactionScalarFieldEnum = {
id: 'id',
activation_expires_at: 'activation_expires_at',
@@ -311,15 +312,26 @@ export const PartnerAccountQuotaChargeTransactionScalarFieldEnum = {
export type PartnerAccountQuotaChargeTransactionScalarFieldEnum = (typeof PartnerAccountQuotaChargeTransactionScalarFieldEnum)[keyof typeof PartnerAccountQuotaChargeTransactionScalarFieldEnum]
export const PartnerAccountQuotaAllocationScalarFieldEnum = {
export const PartnerAccountQuotaCreditScalarFieldEnum = {
id: 'id',
created_at: 'created_at',
updated_at: 'updated_at',
charge_transaction_id: 'charge_transaction_id',
license_id: 'license_id'
allocation_id: 'allocation_id'
} as const
export type PartnerAccountQuotaAllocationScalarFieldEnum = (typeof PartnerAccountQuotaAllocationScalarFieldEnum)[keyof typeof PartnerAccountQuotaAllocationScalarFieldEnum]
export type PartnerAccountQuotaCreditScalarFieldEnum = (typeof PartnerAccountQuotaCreditScalarFieldEnum)[keyof typeof PartnerAccountQuotaCreditScalarFieldEnum]
export const LicenseAccountAllocationScalarFieldEnum = {
id: 'id',
created_at: 'created_at',
updated_at: 'updated_at',
license_activation_id: 'license_activation_id',
account_id: 'account_id'
} as const
export type LicenseAccountAllocationScalarFieldEnum = (typeof LicenseAccountAllocationScalarFieldEnum)[keyof typeof LicenseAccountAllocationScalarFieldEnum]
export const PartnerAccountScalarFieldEnum = {
@@ -754,6 +766,15 @@ export const DeviceOrderByRelevanceFieldEnum = {
export type DeviceOrderByRelevanceFieldEnum = (typeof DeviceOrderByRelevanceFieldEnum)[keyof typeof DeviceOrderByRelevanceFieldEnum]
export const LicenseChargeTransactionOrderByRelevanceFieldEnum = {
id: 'id',
tracking_code: 'tracking_code',
partner_id: 'partner_id'
} as const
export type LicenseChargeTransactionOrderByRelevanceFieldEnum = (typeof LicenseChargeTransactionOrderByRelevanceFieldEnum)[keyof typeof LicenseChargeTransactionOrderByRelevanceFieldEnum]
export const LicenseOrderByRelevanceFieldEnum = {
id: 'id',
charge_transaction_id: 'charge_transaction_id'
@@ -771,13 +792,13 @@ export const LicenseActivationOrderByRelevanceFieldEnum = {
export type LicenseActivationOrderByRelevanceFieldEnum = (typeof LicenseActivationOrderByRelevanceFieldEnum)[keyof typeof LicenseActivationOrderByRelevanceFieldEnum]
export const LicenseChargeTransactionOrderByRelevanceFieldEnum = {
export const LicenseRenewChargeTransactionOrderByRelevanceFieldEnum = {
id: 'id',
tracking_code: 'tracking_code',
partner_id: 'partner_id'
} as const
export type LicenseChargeTransactionOrderByRelevanceFieldEnum = (typeof LicenseChargeTransactionOrderByRelevanceFieldEnum)[keyof typeof LicenseChargeTransactionOrderByRelevanceFieldEnum]
export type LicenseRenewChargeTransactionOrderByRelevanceFieldEnum = (typeof LicenseRenewChargeTransactionOrderByRelevanceFieldEnum)[keyof typeof LicenseRenewChargeTransactionOrderByRelevanceFieldEnum]
export const LicenseRenewOrderByRelevanceFieldEnum = {
@@ -789,15 +810,6 @@ export const LicenseRenewOrderByRelevanceFieldEnum = {
export type LicenseRenewOrderByRelevanceFieldEnum = (typeof LicenseRenewOrderByRelevanceFieldEnum)[keyof typeof LicenseRenewOrderByRelevanceFieldEnum]
export const LicenseRenewChargeTransactionOrderByRelevanceFieldEnum = {
id: 'id',
tracking_code: 'tracking_code',
partner_id: 'partner_id'
} as const
export type LicenseRenewChargeTransactionOrderByRelevanceFieldEnum = (typeof LicenseRenewChargeTransactionOrderByRelevanceFieldEnum)[keyof typeof LicenseRenewChargeTransactionOrderByRelevanceFieldEnum]
export const PartnerAccountQuotaChargeTransactionOrderByRelevanceFieldEnum = {
id: 'id',
tracking_code: 'tracking_code',
@@ -807,13 +819,22 @@ export const PartnerAccountQuotaChargeTransactionOrderByRelevanceFieldEnum = {
export type PartnerAccountQuotaChargeTransactionOrderByRelevanceFieldEnum = (typeof PartnerAccountQuotaChargeTransactionOrderByRelevanceFieldEnum)[keyof typeof PartnerAccountQuotaChargeTransactionOrderByRelevanceFieldEnum]
export const PartnerAccountQuotaAllocationOrderByRelevanceFieldEnum = {
export const PartnerAccountQuotaCreditOrderByRelevanceFieldEnum = {
id: 'id',
charge_transaction_id: 'charge_transaction_id',
license_id: 'license_id'
allocation_id: 'allocation_id'
} as const
export type PartnerAccountQuotaAllocationOrderByRelevanceFieldEnum = (typeof PartnerAccountQuotaAllocationOrderByRelevanceFieldEnum)[keyof typeof PartnerAccountQuotaAllocationOrderByRelevanceFieldEnum]
export type PartnerAccountQuotaCreditOrderByRelevanceFieldEnum = (typeof PartnerAccountQuotaCreditOrderByRelevanceFieldEnum)[keyof typeof PartnerAccountQuotaCreditOrderByRelevanceFieldEnum]
export const LicenseAccountAllocationOrderByRelevanceFieldEnum = {
id: 'id',
license_activation_id: 'license_activation_id',
account_id: 'account_id'
} as const
export type LicenseAccountAllocationOrderByRelevanceFieldEnum = (typeof LicenseAccountAllocationOrderByRelevanceFieldEnum)[keyof typeof LicenseAccountAllocationOrderByRelevanceFieldEnum]
export const PartnerAccountOrderByRelevanceFieldEnum = {
+4 -3
View File
@@ -18,13 +18,14 @@ export type * from './models/Complex.js'
export type * from './models/Pos.js'
export type * from './models/DeviceBrand.js'
export type * from './models/Device.js'
export type * from './models/LicenseChargeTransaction.js'
export type * from './models/License.js'
export type * from './models/LicenseActivation.js'
export type * from './models/LicenseChargeTransaction.js'
export type * from './models/LicenseRenew.js'
export type * from './models/LicenseRenewChargeTransaction.js'
export type * from './models/LicenseRenew.js'
export type * from './models/PartnerAccountQuotaChargeTransaction.js'
export type * from './models/PartnerAccountQuotaAllocation.js'
export type * from './models/PartnerAccountQuotaCredit.js'
export type * from './models/LicenseAccountAllocation.js'
export type * from './models/PartnerAccount.js'
export type * from './models/Partner.js'
export type * from './models/PermissionConsumer.js'
@@ -194,6 +194,7 @@ export type ConsumerAccountWhereInput = {
account?: Prisma.XOR<Prisma.AccountScalarRelationFilter, Prisma.AccountWhereInput>
pos?: Prisma.XOR<Prisma.PosNullableScalarRelationFilter, Prisma.PosWhereInput> | null
permission?: Prisma.XOR<Prisma.PermissionConsumerNullableScalarRelationFilter, Prisma.PermissionConsumerWhereInput> | null
account_allocation?: Prisma.XOR<Prisma.LicenseAccountAllocationNullableScalarRelationFilter, Prisma.LicenseAccountAllocationWhereInput> | null
sales_invoices?: Prisma.SalesInvoiceListRelationFilter
}
@@ -208,6 +209,7 @@ export type ConsumerAccountOrderByWithRelationInput = {
account?: Prisma.AccountOrderByWithRelationInput
pos?: Prisma.PosOrderByWithRelationInput
permission?: Prisma.PermissionConsumerOrderByWithRelationInput
account_allocation?: Prisma.LicenseAccountAllocationOrderByWithRelationInput
sales_invoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput
_relevance?: Prisma.ConsumerAccountOrderByRelevanceInput
}
@@ -226,6 +228,7 @@ export type ConsumerAccountWhereUniqueInput = Prisma.AtLeast<{
account?: Prisma.XOR<Prisma.AccountScalarRelationFilter, Prisma.AccountWhereInput>
pos?: Prisma.XOR<Prisma.PosNullableScalarRelationFilter, Prisma.PosWhereInput> | null
permission?: Prisma.XOR<Prisma.PermissionConsumerNullableScalarRelationFilter, Prisma.PermissionConsumerWhereInput> | null
account_allocation?: Prisma.XOR<Prisma.LicenseAccountAllocationNullableScalarRelationFilter, Prisma.LicenseAccountAllocationWhereInput> | null
sales_invoices?: Prisma.SalesInvoiceListRelationFilter
}, "id" | "account_id">
@@ -262,6 +265,7 @@ export type ConsumerAccountCreateInput = {
account: Prisma.AccountCreateNestedOneWithoutConsumer_accountInput
pos?: Prisma.PosCreateNestedOneWithoutAccountInput
permission?: Prisma.PermissionConsumerCreateNestedOneWithoutConsumer_accountInput
account_allocation?: Prisma.LicenseAccountAllocationCreateNestedOneWithoutAccountInput
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutConsumer_accountInput
}
@@ -274,6 +278,7 @@ export type ConsumerAccountUncheckedCreateInput = {
account_id: string
pos?: Prisma.PosUncheckedCreateNestedOneWithoutAccountInput
permission?: Prisma.PermissionConsumerUncheckedCreateNestedOneWithoutConsumer_accountInput
account_allocation?: Prisma.LicenseAccountAllocationUncheckedCreateNestedOneWithoutAccountInput
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutConsumer_accountInput
}
@@ -286,6 +291,7 @@ export type ConsumerAccountUpdateInput = {
account?: Prisma.AccountUpdateOneRequiredWithoutConsumer_accountNestedInput
pos?: Prisma.PosUpdateOneWithoutAccountNestedInput
permission?: Prisma.PermissionConsumerUpdateOneWithoutConsumer_accountNestedInput
account_allocation?: Prisma.LicenseAccountAllocationUpdateOneWithoutAccountNestedInput
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutConsumer_accountNestedInput
}
@@ -298,6 +304,7 @@ export type ConsumerAccountUncheckedUpdateInput = {
account_id?: Prisma.StringFieldUpdateOperationsInput | string
pos?: Prisma.PosUncheckedUpdateOneWithoutAccountNestedInput
permission?: Prisma.PermissionConsumerUncheckedUpdateOneWithoutConsumer_accountNestedInput
account_allocation?: Prisma.LicenseAccountAllocationUncheckedUpdateOneWithoutAccountNestedInput
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutConsumer_accountNestedInput
}
@@ -473,6 +480,22 @@ export type ConsumerAccountUpdateOneWithoutPosNestedInput = {
update?: Prisma.XOR<Prisma.XOR<Prisma.ConsumerAccountUpdateToOneWithWhereWithoutPosInput, Prisma.ConsumerAccountUpdateWithoutPosInput>, Prisma.ConsumerAccountUncheckedUpdateWithoutPosInput>
}
export type ConsumerAccountCreateNestedOneWithoutAccount_allocationInput = {
create?: Prisma.XOR<Prisma.ConsumerAccountCreateWithoutAccount_allocationInput, Prisma.ConsumerAccountUncheckedCreateWithoutAccount_allocationInput>
connectOrCreate?: Prisma.ConsumerAccountCreateOrConnectWithoutAccount_allocationInput
connect?: Prisma.ConsumerAccountWhereUniqueInput
}
export type ConsumerAccountUpdateOneWithoutAccount_allocationNestedInput = {
create?: Prisma.XOR<Prisma.ConsumerAccountCreateWithoutAccount_allocationInput, Prisma.ConsumerAccountUncheckedCreateWithoutAccount_allocationInput>
connectOrCreate?: Prisma.ConsumerAccountCreateOrConnectWithoutAccount_allocationInput
upsert?: Prisma.ConsumerAccountUpsertWithoutAccount_allocationInput
disconnect?: Prisma.ConsumerAccountWhereInput | boolean
delete?: Prisma.ConsumerAccountWhereInput | boolean
connect?: Prisma.ConsumerAccountWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.ConsumerAccountUpdateToOneWithWhereWithoutAccount_allocationInput, Prisma.ConsumerAccountUpdateWithoutAccount_allocationInput>, Prisma.ConsumerAccountUncheckedUpdateWithoutAccount_allocationInput>
}
export type ConsumerAccountCreateNestedOneWithoutPermissionInput = {
create?: Prisma.XOR<Prisma.ConsumerAccountCreateWithoutPermissionInput, Prisma.ConsumerAccountUncheckedCreateWithoutPermissionInput>
connectOrCreate?: Prisma.ConsumerAccountCreateOrConnectWithoutPermissionInput
@@ -509,6 +532,7 @@ export type ConsumerAccountCreateWithoutAccountInput = {
consumer: Prisma.ConsumerCreateNestedOneWithoutConsumer_accountsInput
pos?: Prisma.PosCreateNestedOneWithoutAccountInput
permission?: Prisma.PermissionConsumerCreateNestedOneWithoutConsumer_accountInput
account_allocation?: Prisma.LicenseAccountAllocationCreateNestedOneWithoutAccountInput
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutConsumer_accountInput
}
@@ -520,6 +544,7 @@ export type ConsumerAccountUncheckedCreateWithoutAccountInput = {
consumer_id: string
pos?: Prisma.PosUncheckedCreateNestedOneWithoutAccountInput
permission?: Prisma.PermissionConsumerUncheckedCreateNestedOneWithoutConsumer_accountInput
account_allocation?: Prisma.LicenseAccountAllocationUncheckedCreateNestedOneWithoutAccountInput
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutConsumer_accountInput
}
@@ -547,6 +572,7 @@ export type ConsumerAccountUpdateWithoutAccountInput = {
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutConsumer_accountsNestedInput
pos?: Prisma.PosUpdateOneWithoutAccountNestedInput
permission?: Prisma.PermissionConsumerUpdateOneWithoutConsumer_accountNestedInput
account_allocation?: Prisma.LicenseAccountAllocationUpdateOneWithoutAccountNestedInput
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutConsumer_accountNestedInput
}
@@ -558,6 +584,7 @@ export type ConsumerAccountUncheckedUpdateWithoutAccountInput = {
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
pos?: Prisma.PosUncheckedUpdateOneWithoutAccountNestedInput
permission?: Prisma.PermissionConsumerUncheckedUpdateOneWithoutConsumer_accountNestedInput
account_allocation?: Prisma.LicenseAccountAllocationUncheckedUpdateOneWithoutAccountNestedInput
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutConsumer_accountNestedInput
}
@@ -569,6 +596,7 @@ export type ConsumerAccountCreateWithoutConsumerInput = {
account: Prisma.AccountCreateNestedOneWithoutConsumer_accountInput
pos?: Prisma.PosCreateNestedOneWithoutAccountInput
permission?: Prisma.PermissionConsumerCreateNestedOneWithoutConsumer_accountInput
account_allocation?: Prisma.LicenseAccountAllocationCreateNestedOneWithoutAccountInput
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutConsumer_accountInput
}
@@ -580,6 +608,7 @@ export type ConsumerAccountUncheckedCreateWithoutConsumerInput = {
account_id: string
pos?: Prisma.PosUncheckedCreateNestedOneWithoutAccountInput
permission?: Prisma.PermissionConsumerUncheckedCreateNestedOneWithoutConsumer_accountInput
account_allocation?: Prisma.LicenseAccountAllocationUncheckedCreateNestedOneWithoutAccountInput
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutConsumer_accountInput
}
@@ -629,6 +658,7 @@ export type ConsumerAccountCreateWithoutPosInput = {
consumer: Prisma.ConsumerCreateNestedOneWithoutConsumer_accountsInput
account: Prisma.AccountCreateNestedOneWithoutConsumer_accountInput
permission?: Prisma.PermissionConsumerCreateNestedOneWithoutConsumer_accountInput
account_allocation?: Prisma.LicenseAccountAllocationCreateNestedOneWithoutAccountInput
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutConsumer_accountInput
}
@@ -640,6 +670,7 @@ export type ConsumerAccountUncheckedCreateWithoutPosInput = {
consumer_id: string
account_id: string
permission?: Prisma.PermissionConsumerUncheckedCreateNestedOneWithoutConsumer_accountInput
account_allocation?: Prisma.LicenseAccountAllocationUncheckedCreateNestedOneWithoutAccountInput
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutConsumer_accountInput
}
@@ -667,6 +698,7 @@ export type ConsumerAccountUpdateWithoutPosInput = {
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutConsumer_accountsNestedInput
account?: Prisma.AccountUpdateOneRequiredWithoutConsumer_accountNestedInput
permission?: Prisma.PermissionConsumerUpdateOneWithoutConsumer_accountNestedInput
account_allocation?: Prisma.LicenseAccountAllocationUpdateOneWithoutAccountNestedInput
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutConsumer_accountNestedInput
}
@@ -678,6 +710,71 @@ export type ConsumerAccountUncheckedUpdateWithoutPosInput = {
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
account_id?: Prisma.StringFieldUpdateOperationsInput | string
permission?: Prisma.PermissionConsumerUncheckedUpdateOneWithoutConsumer_accountNestedInput
account_allocation?: Prisma.LicenseAccountAllocationUncheckedUpdateOneWithoutAccountNestedInput
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutConsumer_accountNestedInput
}
export type ConsumerAccountCreateWithoutAccount_allocationInput = {
id?: string
role: $Enums.ConsumerRole
created_at?: Date | string
updated_at?: Date | string
consumer: Prisma.ConsumerCreateNestedOneWithoutConsumer_accountsInput
account: Prisma.AccountCreateNestedOneWithoutConsumer_accountInput
pos?: Prisma.PosCreateNestedOneWithoutAccountInput
permission?: Prisma.PermissionConsumerCreateNestedOneWithoutConsumer_accountInput
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutConsumer_accountInput
}
export type ConsumerAccountUncheckedCreateWithoutAccount_allocationInput = {
id?: string
role: $Enums.ConsumerRole
created_at?: Date | string
updated_at?: Date | string
consumer_id: string
account_id: string
pos?: Prisma.PosUncheckedCreateNestedOneWithoutAccountInput
permission?: Prisma.PermissionConsumerUncheckedCreateNestedOneWithoutConsumer_accountInput
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutConsumer_accountInput
}
export type ConsumerAccountCreateOrConnectWithoutAccount_allocationInput = {
where: Prisma.ConsumerAccountWhereUniqueInput
create: Prisma.XOR<Prisma.ConsumerAccountCreateWithoutAccount_allocationInput, Prisma.ConsumerAccountUncheckedCreateWithoutAccount_allocationInput>
}
export type ConsumerAccountUpsertWithoutAccount_allocationInput = {
update: Prisma.XOR<Prisma.ConsumerAccountUpdateWithoutAccount_allocationInput, Prisma.ConsumerAccountUncheckedUpdateWithoutAccount_allocationInput>
create: Prisma.XOR<Prisma.ConsumerAccountCreateWithoutAccount_allocationInput, Prisma.ConsumerAccountUncheckedCreateWithoutAccount_allocationInput>
where?: Prisma.ConsumerAccountWhereInput
}
export type ConsumerAccountUpdateToOneWithWhereWithoutAccount_allocationInput = {
where?: Prisma.ConsumerAccountWhereInput
data: Prisma.XOR<Prisma.ConsumerAccountUpdateWithoutAccount_allocationInput, Prisma.ConsumerAccountUncheckedUpdateWithoutAccount_allocationInput>
}
export type ConsumerAccountUpdateWithoutAccount_allocationInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
role?: Prisma.EnumConsumerRoleFieldUpdateOperationsInput | $Enums.ConsumerRole
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutConsumer_accountsNestedInput
account?: Prisma.AccountUpdateOneRequiredWithoutConsumer_accountNestedInput
pos?: Prisma.PosUpdateOneWithoutAccountNestedInput
permission?: Prisma.PermissionConsumerUpdateOneWithoutConsumer_accountNestedInput
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutConsumer_accountNestedInput
}
export type ConsumerAccountUncheckedUpdateWithoutAccount_allocationInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
role?: Prisma.EnumConsumerRoleFieldUpdateOperationsInput | $Enums.ConsumerRole
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
account_id?: Prisma.StringFieldUpdateOperationsInput | string
pos?: Prisma.PosUncheckedUpdateOneWithoutAccountNestedInput
permission?: Prisma.PermissionConsumerUncheckedUpdateOneWithoutConsumer_accountNestedInput
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutConsumer_accountNestedInput
}
@@ -689,6 +786,7 @@ export type ConsumerAccountCreateWithoutPermissionInput = {
consumer: Prisma.ConsumerCreateNestedOneWithoutConsumer_accountsInput
account: Prisma.AccountCreateNestedOneWithoutConsumer_accountInput
pos?: Prisma.PosCreateNestedOneWithoutAccountInput
account_allocation?: Prisma.LicenseAccountAllocationCreateNestedOneWithoutAccountInput
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutConsumer_accountInput
}
@@ -700,6 +798,7 @@ export type ConsumerAccountUncheckedCreateWithoutPermissionInput = {
consumer_id: string
account_id: string
pos?: Prisma.PosUncheckedCreateNestedOneWithoutAccountInput
account_allocation?: Prisma.LicenseAccountAllocationUncheckedCreateNestedOneWithoutAccountInput
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutConsumer_accountInput
}
@@ -727,6 +826,7 @@ export type ConsumerAccountUpdateWithoutPermissionInput = {
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutConsumer_accountsNestedInput
account?: Prisma.AccountUpdateOneRequiredWithoutConsumer_accountNestedInput
pos?: Prisma.PosUpdateOneWithoutAccountNestedInput
account_allocation?: Prisma.LicenseAccountAllocationUpdateOneWithoutAccountNestedInput
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutConsumer_accountNestedInput
}
@@ -738,6 +838,7 @@ export type ConsumerAccountUncheckedUpdateWithoutPermissionInput = {
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
account_id?: Prisma.StringFieldUpdateOperationsInput | string
pos?: Prisma.PosUncheckedUpdateOneWithoutAccountNestedInput
account_allocation?: Prisma.LicenseAccountAllocationUncheckedUpdateOneWithoutAccountNestedInput
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutConsumer_accountNestedInput
}
@@ -750,6 +851,7 @@ export type ConsumerAccountCreateWithoutSales_invoicesInput = {
account: Prisma.AccountCreateNestedOneWithoutConsumer_accountInput
pos?: Prisma.PosCreateNestedOneWithoutAccountInput
permission?: Prisma.PermissionConsumerCreateNestedOneWithoutConsumer_accountInput
account_allocation?: Prisma.LicenseAccountAllocationCreateNestedOneWithoutAccountInput
}
export type ConsumerAccountUncheckedCreateWithoutSales_invoicesInput = {
@@ -761,6 +863,7 @@ export type ConsumerAccountUncheckedCreateWithoutSales_invoicesInput = {
account_id: string
pos?: Prisma.PosUncheckedCreateNestedOneWithoutAccountInput
permission?: Prisma.PermissionConsumerUncheckedCreateNestedOneWithoutConsumer_accountInput
account_allocation?: Prisma.LicenseAccountAllocationUncheckedCreateNestedOneWithoutAccountInput
}
export type ConsumerAccountCreateOrConnectWithoutSales_invoicesInput = {
@@ -788,6 +891,7 @@ export type ConsumerAccountUpdateWithoutSales_invoicesInput = {
account?: Prisma.AccountUpdateOneRequiredWithoutConsumer_accountNestedInput
pos?: Prisma.PosUpdateOneWithoutAccountNestedInput
permission?: Prisma.PermissionConsumerUpdateOneWithoutConsumer_accountNestedInput
account_allocation?: Prisma.LicenseAccountAllocationUpdateOneWithoutAccountNestedInput
}
export type ConsumerAccountUncheckedUpdateWithoutSales_invoicesInput = {
@@ -799,6 +903,7 @@ export type ConsumerAccountUncheckedUpdateWithoutSales_invoicesInput = {
account_id?: Prisma.StringFieldUpdateOperationsInput | string
pos?: Prisma.PosUncheckedUpdateOneWithoutAccountNestedInput
permission?: Prisma.PermissionConsumerUncheckedUpdateOneWithoutConsumer_accountNestedInput
account_allocation?: Prisma.LicenseAccountAllocationUncheckedUpdateOneWithoutAccountNestedInput
}
export type ConsumerAccountCreateManyConsumerInput = {
@@ -817,6 +922,7 @@ export type ConsumerAccountUpdateWithoutConsumerInput = {
account?: Prisma.AccountUpdateOneRequiredWithoutConsumer_accountNestedInput
pos?: Prisma.PosUpdateOneWithoutAccountNestedInput
permission?: Prisma.PermissionConsumerUpdateOneWithoutConsumer_accountNestedInput
account_allocation?: Prisma.LicenseAccountAllocationUpdateOneWithoutAccountNestedInput
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutConsumer_accountNestedInput
}
@@ -828,6 +934,7 @@ export type ConsumerAccountUncheckedUpdateWithoutConsumerInput = {
account_id?: Prisma.StringFieldUpdateOperationsInput | string
pos?: Prisma.PosUncheckedUpdateOneWithoutAccountNestedInput
permission?: Prisma.PermissionConsumerUncheckedUpdateOneWithoutConsumer_accountNestedInput
account_allocation?: Prisma.LicenseAccountAllocationUncheckedUpdateOneWithoutAccountNestedInput
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutConsumer_accountNestedInput
}
@@ -881,6 +988,7 @@ export type ConsumerAccountSelect<ExtArgs extends runtime.Types.Extensions.Inter
account?: boolean | Prisma.AccountDefaultArgs<ExtArgs>
pos?: boolean | Prisma.ConsumerAccount$posArgs<ExtArgs>
permission?: boolean | Prisma.ConsumerAccount$permissionArgs<ExtArgs>
account_allocation?: boolean | Prisma.ConsumerAccount$account_allocationArgs<ExtArgs>
sales_invoices?: boolean | Prisma.ConsumerAccount$sales_invoicesArgs<ExtArgs>
_count?: boolean | Prisma.ConsumerAccountCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["consumerAccount"]>
@@ -902,6 +1010,7 @@ export type ConsumerAccountInclude<ExtArgs extends runtime.Types.Extensions.Inte
account?: boolean | Prisma.AccountDefaultArgs<ExtArgs>
pos?: boolean | Prisma.ConsumerAccount$posArgs<ExtArgs>
permission?: boolean | Prisma.ConsumerAccount$permissionArgs<ExtArgs>
account_allocation?: boolean | Prisma.ConsumerAccount$account_allocationArgs<ExtArgs>
sales_invoices?: boolean | Prisma.ConsumerAccount$sales_invoicesArgs<ExtArgs>
_count?: boolean | Prisma.ConsumerAccountCountOutputTypeDefaultArgs<ExtArgs>
}
@@ -913,6 +1022,7 @@ export type $ConsumerAccountPayload<ExtArgs extends runtime.Types.Extensions.Int
account: Prisma.$AccountPayload<ExtArgs>
pos: Prisma.$PosPayload<ExtArgs> | null
permission: Prisma.$PermissionConsumerPayload<ExtArgs> | null
account_allocation: Prisma.$LicenseAccountAllocationPayload<ExtArgs> | null
sales_invoices: Prisma.$SalesInvoicePayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
@@ -1266,6 +1376,7 @@ export interface Prisma__ConsumerAccountClient<T, Null = never, ExtArgs extends
account<T extends Prisma.AccountDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AccountDefaultArgs<ExtArgs>>): Prisma.Prisma__AccountClient<runtime.Types.Result.GetResult<Prisma.$AccountPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
pos<T extends Prisma.ConsumerAccount$posArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ConsumerAccount$posArgs<ExtArgs>>): Prisma.Prisma__PosClient<runtime.Types.Result.GetResult<Prisma.$PosPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
permission<T extends Prisma.ConsumerAccount$permissionArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ConsumerAccount$permissionArgs<ExtArgs>>): Prisma.Prisma__PermissionConsumerClient<runtime.Types.Result.GetResult<Prisma.$PermissionConsumerPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
account_allocation<T extends Prisma.ConsumerAccount$account_allocationArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ConsumerAccount$account_allocationArgs<ExtArgs>>): Prisma.Prisma__LicenseAccountAllocationClient<runtime.Types.Result.GetResult<Prisma.$LicenseAccountAllocationPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
sales_invoices<T extends Prisma.ConsumerAccount$sales_invoicesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ConsumerAccount$sales_invoicesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SalesInvoicePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
@@ -1687,6 +1798,25 @@ export type ConsumerAccount$permissionArgs<ExtArgs extends runtime.Types.Extensi
where?: Prisma.PermissionConsumerWhereInput
}
/**
* ConsumerAccount.account_allocation
*/
export type ConsumerAccount$account_allocationArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the LicenseAccountAllocation
*/
select?: Prisma.LicenseAccountAllocationSelect<ExtArgs> | null
/**
* Omit specific fields from the LicenseAccountAllocation
*/
omit?: Prisma.LicenseAccountAllocationOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.LicenseAccountAllocationInclude<ExtArgs> | null
where?: Prisma.LicenseAccountAllocationWhereInput
}
/**
* ConsumerAccount.sales_invoices
*/
+29 -184
View File
@@ -218,7 +218,6 @@ export type LicenseWhereInput = {
charge_transaction_id?: Prisma.StringFilter<"License"> | string
charge_transaction?: Prisma.XOR<Prisma.LicenseChargeTransactionScalarRelationFilter, Prisma.LicenseChargeTransactionWhereInput>
activation?: Prisma.XOR<Prisma.LicenseActivationNullableScalarRelationFilter, Prisma.LicenseActivationWhereInput> | null
account_allocations?: Prisma.PartnerAccountQuotaAllocationListRelationFilter
}
export type LicenseOrderByWithRelationInput = {
@@ -229,7 +228,6 @@ export type LicenseOrderByWithRelationInput = {
charge_transaction_id?: Prisma.SortOrder
charge_transaction?: Prisma.LicenseChargeTransactionOrderByWithRelationInput
activation?: Prisma.LicenseActivationOrderByWithRelationInput
account_allocations?: Prisma.PartnerAccountQuotaAllocationOrderByRelationAggregateInput
_relevance?: Prisma.LicenseOrderByRelevanceInput
}
@@ -244,7 +242,6 @@ export type LicenseWhereUniqueInput = Prisma.AtLeast<{
charge_transaction_id?: Prisma.StringFilter<"License"> | string
charge_transaction?: Prisma.XOR<Prisma.LicenseChargeTransactionScalarRelationFilter, Prisma.LicenseChargeTransactionWhereInput>
activation?: Prisma.XOR<Prisma.LicenseActivationNullableScalarRelationFilter, Prisma.LicenseActivationWhereInput> | null
account_allocations?: Prisma.PartnerAccountQuotaAllocationListRelationFilter
}, "id">
export type LicenseOrderByWithAggregationInput = {
@@ -278,7 +275,6 @@ export type LicenseCreateInput = {
updated_at?: Date | string
charge_transaction: Prisma.LicenseChargeTransactionCreateNestedOneWithoutLicensesInput
activation?: Prisma.LicenseActivationCreateNestedOneWithoutLicenseInput
account_allocations?: Prisma.PartnerAccountQuotaAllocationCreateNestedManyWithoutLicenseInput
}
export type LicenseUncheckedCreateInput = {
@@ -288,7 +284,6 @@ export type LicenseUncheckedCreateInput = {
updated_at?: Date | string
charge_transaction_id: string
activation?: Prisma.LicenseActivationUncheckedCreateNestedOneWithoutLicenseInput
account_allocations?: Prisma.PartnerAccountQuotaAllocationUncheckedCreateNestedManyWithoutLicenseInput
}
export type LicenseUpdateInput = {
@@ -298,7 +293,6 @@ export type LicenseUpdateInput = {
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
charge_transaction?: Prisma.LicenseChargeTransactionUpdateOneRequiredWithoutLicensesNestedInput
activation?: Prisma.LicenseActivationUpdateOneWithoutLicenseNestedInput
account_allocations?: Prisma.PartnerAccountQuotaAllocationUpdateManyWithoutLicenseNestedInput
}
export type LicenseUncheckedUpdateInput = {
@@ -308,7 +302,6 @@ export type LicenseUncheckedUpdateInput = {
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
charge_transaction_id?: Prisma.StringFieldUpdateOperationsInput | string
activation?: Prisma.LicenseActivationUncheckedUpdateOneWithoutLicenseNestedInput
account_allocations?: Prisma.PartnerAccountQuotaAllocationUncheckedUpdateManyWithoutLicenseNestedInput
}
export type LicenseCreateManyInput = {
@@ -334,6 +327,16 @@ export type LicenseUncheckedUpdateManyInput = {
charge_transaction_id?: Prisma.StringFieldUpdateOperationsInput | string
}
export type LicenseListRelationFilter = {
every?: Prisma.LicenseWhereInput
some?: Prisma.LicenseWhereInput
none?: Prisma.LicenseWhereInput
}
export type LicenseOrderByRelationAggregateInput = {
_count?: Prisma.SortOrder
}
export type LicenseOrderByRelevanceInput = {
fields: Prisma.LicenseOrderByRelevanceFieldEnum | Prisma.LicenseOrderByRelevanceFieldEnum[]
sort: Prisma.SortOrder
@@ -377,43 +380,6 @@ export type LicenseScalarRelationFilter = {
isNot?: Prisma.LicenseWhereInput
}
export type LicenseListRelationFilter = {
every?: Prisma.LicenseWhereInput
some?: Prisma.LicenseWhereInput
none?: Prisma.LicenseWhereInput
}
export type LicenseOrderByRelationAggregateInput = {
_count?: Prisma.SortOrder
}
export type LicenseNullableScalarRelationFilter = {
is?: Prisma.LicenseWhereInput | null
isNot?: Prisma.LicenseWhereInput | null
}
export type IntFieldUpdateOperationsInput = {
set?: number
increment?: number
decrement?: number
multiply?: number
divide?: number
}
export type LicenseCreateNestedOneWithoutActivationInput = {
create?: Prisma.XOR<Prisma.LicenseCreateWithoutActivationInput, Prisma.LicenseUncheckedCreateWithoutActivationInput>
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutActivationInput
connect?: Prisma.LicenseWhereUniqueInput
}
export type LicenseUpdateOneRequiredWithoutActivationNestedInput = {
create?: Prisma.XOR<Prisma.LicenseCreateWithoutActivationInput, Prisma.LicenseUncheckedCreateWithoutActivationInput>
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutActivationInput
upsert?: Prisma.LicenseUpsertWithoutActivationInput
connect?: Prisma.LicenseWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.LicenseUpdateToOneWithWhereWithoutActivationInput, Prisma.LicenseUpdateWithoutActivationInput>, Prisma.LicenseUncheckedUpdateWithoutActivationInput>
}
export type LicenseCreateNestedManyWithoutCharge_transactionInput = {
create?: Prisma.XOR<Prisma.LicenseCreateWithoutCharge_transactionInput, Prisma.LicenseUncheckedCreateWithoutCharge_transactionInput> | Prisma.LicenseCreateWithoutCharge_transactionInput[] | Prisma.LicenseUncheckedCreateWithoutCharge_transactionInput[]
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutCharge_transactionInput | Prisma.LicenseCreateOrConnectWithoutCharge_transactionInput[]
@@ -456,72 +422,18 @@ export type LicenseUncheckedUpdateManyWithoutCharge_transactionNestedInput = {
deleteMany?: Prisma.LicenseScalarWhereInput | Prisma.LicenseScalarWhereInput[]
}
export type LicenseCreateNestedOneWithoutAccount_allocationsInput = {
create?: Prisma.XOR<Prisma.LicenseCreateWithoutAccount_allocationsInput, Prisma.LicenseUncheckedCreateWithoutAccount_allocationsInput>
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutAccount_allocationsInput
export type LicenseCreateNestedOneWithoutActivationInput = {
create?: Prisma.XOR<Prisma.LicenseCreateWithoutActivationInput, Prisma.LicenseUncheckedCreateWithoutActivationInput>
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutActivationInput
connect?: Prisma.LicenseWhereUniqueInput
}
export type LicenseUpdateOneWithoutAccount_allocationsNestedInput = {
create?: Prisma.XOR<Prisma.LicenseCreateWithoutAccount_allocationsInput, Prisma.LicenseUncheckedCreateWithoutAccount_allocationsInput>
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutAccount_allocationsInput
upsert?: Prisma.LicenseUpsertWithoutAccount_allocationsInput
disconnect?: Prisma.LicenseWhereInput | boolean
delete?: Prisma.LicenseWhereInput | boolean
export type LicenseUpdateOneRequiredWithoutActivationNestedInput = {
create?: Prisma.XOR<Prisma.LicenseCreateWithoutActivationInput, Prisma.LicenseUncheckedCreateWithoutActivationInput>
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutActivationInput
upsert?: Prisma.LicenseUpsertWithoutActivationInput
connect?: Prisma.LicenseWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.LicenseUpdateToOneWithWhereWithoutAccount_allocationsInput, Prisma.LicenseUpdateWithoutAccount_allocationsInput>, Prisma.LicenseUncheckedUpdateWithoutAccount_allocationsInput>
}
export type LicenseCreateWithoutActivationInput = {
id?: string
accounts_limit?: number
created_at?: Date | string
updated_at?: Date | string
charge_transaction: Prisma.LicenseChargeTransactionCreateNestedOneWithoutLicensesInput
account_allocations?: Prisma.PartnerAccountQuotaAllocationCreateNestedManyWithoutLicenseInput
}
export type LicenseUncheckedCreateWithoutActivationInput = {
id?: string
accounts_limit?: number
created_at?: Date | string
updated_at?: Date | string
charge_transaction_id: string
account_allocations?: Prisma.PartnerAccountQuotaAllocationUncheckedCreateNestedManyWithoutLicenseInput
}
export type LicenseCreateOrConnectWithoutActivationInput = {
where: Prisma.LicenseWhereUniqueInput
create: Prisma.XOR<Prisma.LicenseCreateWithoutActivationInput, Prisma.LicenseUncheckedCreateWithoutActivationInput>
}
export type LicenseUpsertWithoutActivationInput = {
update: Prisma.XOR<Prisma.LicenseUpdateWithoutActivationInput, Prisma.LicenseUncheckedUpdateWithoutActivationInput>
create: Prisma.XOR<Prisma.LicenseCreateWithoutActivationInput, Prisma.LicenseUncheckedCreateWithoutActivationInput>
where?: Prisma.LicenseWhereInput
}
export type LicenseUpdateToOneWithWhereWithoutActivationInput = {
where?: Prisma.LicenseWhereInput
data: Prisma.XOR<Prisma.LicenseUpdateWithoutActivationInput, Prisma.LicenseUncheckedUpdateWithoutActivationInput>
}
export type LicenseUpdateWithoutActivationInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
accounts_limit?: Prisma.IntFieldUpdateOperationsInput | number
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
charge_transaction?: Prisma.LicenseChargeTransactionUpdateOneRequiredWithoutLicensesNestedInput
account_allocations?: Prisma.PartnerAccountQuotaAllocationUpdateManyWithoutLicenseNestedInput
}
export type LicenseUncheckedUpdateWithoutActivationInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
accounts_limit?: Prisma.IntFieldUpdateOperationsInput | number
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
charge_transaction_id?: Prisma.StringFieldUpdateOperationsInput | string
account_allocations?: Prisma.PartnerAccountQuotaAllocationUncheckedUpdateManyWithoutLicenseNestedInput
update?: Prisma.XOR<Prisma.XOR<Prisma.LicenseUpdateToOneWithWhereWithoutActivationInput, Prisma.LicenseUpdateWithoutActivationInput>, Prisma.LicenseUncheckedUpdateWithoutActivationInput>
}
export type LicenseCreateWithoutCharge_transactionInput = {
@@ -530,7 +442,6 @@ export type LicenseCreateWithoutCharge_transactionInput = {
created_at?: Date | string
updated_at?: Date | string
activation?: Prisma.LicenseActivationCreateNestedOneWithoutLicenseInput
account_allocations?: Prisma.PartnerAccountQuotaAllocationCreateNestedManyWithoutLicenseInput
}
export type LicenseUncheckedCreateWithoutCharge_transactionInput = {
@@ -539,7 +450,6 @@ export type LicenseUncheckedCreateWithoutCharge_transactionInput = {
created_at?: Date | string
updated_at?: Date | string
activation?: Prisma.LicenseActivationUncheckedCreateNestedOneWithoutLicenseInput
account_allocations?: Prisma.PartnerAccountQuotaAllocationUncheckedCreateNestedManyWithoutLicenseInput
}
export type LicenseCreateOrConnectWithoutCharge_transactionInput = {
@@ -579,56 +489,52 @@ export type LicenseScalarWhereInput = {
charge_transaction_id?: Prisma.StringFilter<"License"> | string
}
export type LicenseCreateWithoutAccount_allocationsInput = {
export type LicenseCreateWithoutActivationInput = {
id?: string
accounts_limit?: number
created_at?: Date | string
updated_at?: Date | string
charge_transaction: Prisma.LicenseChargeTransactionCreateNestedOneWithoutLicensesInput
activation?: Prisma.LicenseActivationCreateNestedOneWithoutLicenseInput
}
export type LicenseUncheckedCreateWithoutAccount_allocationsInput = {
export type LicenseUncheckedCreateWithoutActivationInput = {
id?: string
accounts_limit?: number
created_at?: Date | string
updated_at?: Date | string
charge_transaction_id: string
activation?: Prisma.LicenseActivationUncheckedCreateNestedOneWithoutLicenseInput
}
export type LicenseCreateOrConnectWithoutAccount_allocationsInput = {
export type LicenseCreateOrConnectWithoutActivationInput = {
where: Prisma.LicenseWhereUniqueInput
create: Prisma.XOR<Prisma.LicenseCreateWithoutAccount_allocationsInput, Prisma.LicenseUncheckedCreateWithoutAccount_allocationsInput>
create: Prisma.XOR<Prisma.LicenseCreateWithoutActivationInput, Prisma.LicenseUncheckedCreateWithoutActivationInput>
}
export type LicenseUpsertWithoutAccount_allocationsInput = {
update: Prisma.XOR<Prisma.LicenseUpdateWithoutAccount_allocationsInput, Prisma.LicenseUncheckedUpdateWithoutAccount_allocationsInput>
create: Prisma.XOR<Prisma.LicenseCreateWithoutAccount_allocationsInput, Prisma.LicenseUncheckedCreateWithoutAccount_allocationsInput>
export type LicenseUpsertWithoutActivationInput = {
update: Prisma.XOR<Prisma.LicenseUpdateWithoutActivationInput, Prisma.LicenseUncheckedUpdateWithoutActivationInput>
create: Prisma.XOR<Prisma.LicenseCreateWithoutActivationInput, Prisma.LicenseUncheckedCreateWithoutActivationInput>
where?: Prisma.LicenseWhereInput
}
export type LicenseUpdateToOneWithWhereWithoutAccount_allocationsInput = {
export type LicenseUpdateToOneWithWhereWithoutActivationInput = {
where?: Prisma.LicenseWhereInput
data: Prisma.XOR<Prisma.LicenseUpdateWithoutAccount_allocationsInput, Prisma.LicenseUncheckedUpdateWithoutAccount_allocationsInput>
data: Prisma.XOR<Prisma.LicenseUpdateWithoutActivationInput, Prisma.LicenseUncheckedUpdateWithoutActivationInput>
}
export type LicenseUpdateWithoutAccount_allocationsInput = {
export type LicenseUpdateWithoutActivationInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
accounts_limit?: Prisma.IntFieldUpdateOperationsInput | number
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
charge_transaction?: Prisma.LicenseChargeTransactionUpdateOneRequiredWithoutLicensesNestedInput
activation?: Prisma.LicenseActivationUpdateOneWithoutLicenseNestedInput
}
export type LicenseUncheckedUpdateWithoutAccount_allocationsInput = {
export type LicenseUncheckedUpdateWithoutActivationInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
accounts_limit?: Prisma.IntFieldUpdateOperationsInput | number
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
charge_transaction_id?: Prisma.StringFieldUpdateOperationsInput | string
activation?: Prisma.LicenseActivationUncheckedUpdateOneWithoutLicenseNestedInput
}
export type LicenseCreateManyCharge_transactionInput = {
@@ -644,7 +550,6 @@ export type LicenseUpdateWithoutCharge_transactionInput = {
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
activation?: Prisma.LicenseActivationUpdateOneWithoutLicenseNestedInput
account_allocations?: Prisma.PartnerAccountQuotaAllocationUpdateManyWithoutLicenseNestedInput
}
export type LicenseUncheckedUpdateWithoutCharge_transactionInput = {
@@ -653,7 +558,6 @@ export type LicenseUncheckedUpdateWithoutCharge_transactionInput = {
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
activation?: Prisma.LicenseActivationUncheckedUpdateOneWithoutLicenseNestedInput
account_allocations?: Prisma.PartnerAccountQuotaAllocationUncheckedUpdateManyWithoutLicenseNestedInput
}
export type LicenseUncheckedUpdateManyWithoutCharge_transactionInput = {
@@ -664,35 +568,6 @@ export type LicenseUncheckedUpdateManyWithoutCharge_transactionInput = {
}
/**
* Count Type LicenseCountOutputType
*/
export type LicenseCountOutputType = {
account_allocations: number
}
export type LicenseCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
account_allocations?: boolean | LicenseCountOutputTypeCountAccount_allocationsArgs
}
/**
* LicenseCountOutputType without action
*/
export type LicenseCountOutputTypeDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the LicenseCountOutputType
*/
select?: Prisma.LicenseCountOutputTypeSelect<ExtArgs> | null
}
/**
* LicenseCountOutputType without action
*/
export type LicenseCountOutputTypeCountAccount_allocationsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.PartnerAccountQuotaAllocationWhereInput
}
export type LicenseSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
@@ -702,8 +577,6 @@ export type LicenseSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
charge_transaction_id?: boolean
charge_transaction?: boolean | Prisma.LicenseChargeTransactionDefaultArgs<ExtArgs>
activation?: boolean | Prisma.License$activationArgs<ExtArgs>
account_allocations?: boolean | Prisma.License$account_allocationsArgs<ExtArgs>
_count?: boolean | Prisma.LicenseCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["license"]>
@@ -720,8 +593,6 @@ export type LicenseOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs =
export type LicenseInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
charge_transaction?: boolean | Prisma.LicenseChargeTransactionDefaultArgs<ExtArgs>
activation?: boolean | Prisma.License$activationArgs<ExtArgs>
account_allocations?: boolean | Prisma.License$account_allocationsArgs<ExtArgs>
_count?: boolean | Prisma.LicenseCountOutputTypeDefaultArgs<ExtArgs>
}
export type $LicensePayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
@@ -729,7 +600,6 @@ export type $LicensePayload<ExtArgs extends runtime.Types.Extensions.InternalArg
objects: {
charge_transaction: Prisma.$LicenseChargeTransactionPayload<ExtArgs>
activation: Prisma.$LicenseActivationPayload<ExtArgs> | null
account_allocations: Prisma.$PartnerAccountQuotaAllocationPayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
@@ -1079,7 +949,6 @@ export interface Prisma__LicenseClient<T, Null = never, ExtArgs extends runtime.
readonly [Symbol.toStringTag]: "PrismaPromise"
charge_transaction<T extends Prisma.LicenseChargeTransactionDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.LicenseChargeTransactionDefaultArgs<ExtArgs>>): Prisma.Prisma__LicenseChargeTransactionClient<runtime.Types.Result.GetResult<Prisma.$LicenseChargeTransactionPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
activation<T extends Prisma.License$activationArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.License$activationArgs<ExtArgs>>): Prisma.Prisma__LicenseActivationClient<runtime.Types.Result.GetResult<Prisma.$LicenseActivationPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
account_allocations<T extends Prisma.License$account_allocationsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.License$account_allocationsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$PartnerAccountQuotaAllocationPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
@@ -1480,30 +1349,6 @@ export type License$activationArgs<ExtArgs extends runtime.Types.Extensions.Inte
where?: Prisma.LicenseActivationWhereInput
}
/**
* License.account_allocations
*/
export type License$account_allocationsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the PartnerAccountQuotaAllocation
*/
select?: Prisma.PartnerAccountQuotaAllocationSelect<ExtArgs> | null
/**
* Omit specific fields from the PartnerAccountQuotaAllocation
*/
omit?: Prisma.PartnerAccountQuotaAllocationOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.PartnerAccountQuotaAllocationInclude<ExtArgs> | null
where?: Prisma.PartnerAccountQuotaAllocationWhereInput
orderBy?: Prisma.PartnerAccountQuotaAllocationOrderByWithRelationInput | Prisma.PartnerAccountQuotaAllocationOrderByWithRelationInput[]
cursor?: Prisma.PartnerAccountQuotaAllocationWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.PartnerAccountQuotaAllocationScalarFieldEnum | Prisma.PartnerAccountQuotaAllocationScalarFieldEnum[]
}
/**
* License without action
*/
File diff suppressed because it is too large Load Diff
@@ -201,6 +201,7 @@ export type LicenseActivationWhereInput = {
license?: Prisma.XOR<Prisma.LicenseScalarRelationFilter, Prisma.LicenseWhereInput>
business_activity?: Prisma.XOR<Prisma.BusinessActivityScalarRelationFilter, Prisma.BusinessActivityWhereInput>
license_renews?: Prisma.LicenseRenewListRelationFilter
account_allocations?: Prisma.LicenseAccountAllocationListRelationFilter
}
export type LicenseActivationOrderByWithRelationInput = {
@@ -214,6 +215,7 @@ export type LicenseActivationOrderByWithRelationInput = {
license?: Prisma.LicenseOrderByWithRelationInput
business_activity?: Prisma.BusinessActivityOrderByWithRelationInput
license_renews?: Prisma.LicenseRenewOrderByRelationAggregateInput
account_allocations?: Prisma.LicenseAccountAllocationOrderByRelationAggregateInput
_relevance?: Prisma.LicenseActivationOrderByRelevanceInput
}
@@ -231,6 +233,7 @@ export type LicenseActivationWhereUniqueInput = Prisma.AtLeast<{
license?: Prisma.XOR<Prisma.LicenseScalarRelationFilter, Prisma.LicenseWhereInput>
business_activity?: Prisma.XOR<Prisma.BusinessActivityScalarRelationFilter, Prisma.BusinessActivityWhereInput>
license_renews?: Prisma.LicenseRenewListRelationFilter
account_allocations?: Prisma.LicenseAccountAllocationListRelationFilter
}, "id" | "id" | "license_id" | "business_activity_id">
export type LicenseActivationOrderByWithAggregationInput = {
@@ -268,6 +271,7 @@ export type LicenseActivationCreateInput = {
license: Prisma.LicenseCreateNestedOneWithoutActivationInput
business_activity: Prisma.BusinessActivityCreateNestedOneWithoutLicense_activationInput
license_renews?: Prisma.LicenseRenewCreateNestedManyWithoutActivationInput
account_allocations?: Prisma.LicenseAccountAllocationCreateNestedManyWithoutLicense_activationInput
}
export type LicenseActivationUncheckedCreateInput = {
@@ -279,6 +283,7 @@ export type LicenseActivationUncheckedCreateInput = {
license_id: string
business_activity_id: string
license_renews?: Prisma.LicenseRenewUncheckedCreateNestedManyWithoutActivationInput
account_allocations?: Prisma.LicenseAccountAllocationUncheckedCreateNestedManyWithoutLicense_activationInput
}
export type LicenseActivationUpdateInput = {
@@ -290,6 +295,7 @@ export type LicenseActivationUpdateInput = {
license?: Prisma.LicenseUpdateOneRequiredWithoutActivationNestedInput
business_activity?: Prisma.BusinessActivityUpdateOneRequiredWithoutLicense_activationNestedInput
license_renews?: Prisma.LicenseRenewUpdateManyWithoutActivationNestedInput
account_allocations?: Prisma.LicenseAccountAllocationUpdateManyWithoutLicense_activationNestedInput
}
export type LicenseActivationUncheckedUpdateInput = {
@@ -301,6 +307,7 @@ export type LicenseActivationUncheckedUpdateInput = {
license_id?: Prisma.StringFieldUpdateOperationsInput | string
business_activity_id?: Prisma.StringFieldUpdateOperationsInput | string
license_renews?: Prisma.LicenseRenewUncheckedUpdateManyWithoutActivationNestedInput
account_allocations?: Prisma.LicenseAccountAllocationUncheckedUpdateManyWithoutLicense_activationNestedInput
}
export type LicenseActivationCreateManyInput = {
@@ -455,6 +462,22 @@ export type LicenseActivationUpdateOneRequiredWithoutLicense_renewsNestedInput =
update?: Prisma.XOR<Prisma.XOR<Prisma.LicenseActivationUpdateToOneWithWhereWithoutLicense_renewsInput, Prisma.LicenseActivationUpdateWithoutLicense_renewsInput>, Prisma.LicenseActivationUncheckedUpdateWithoutLicense_renewsInput>
}
export type LicenseActivationCreateNestedOneWithoutAccount_allocationsInput = {
create?: Prisma.XOR<Prisma.LicenseActivationCreateWithoutAccount_allocationsInput, Prisma.LicenseActivationUncheckedCreateWithoutAccount_allocationsInput>
connectOrCreate?: Prisma.LicenseActivationCreateOrConnectWithoutAccount_allocationsInput
connect?: Prisma.LicenseActivationWhereUniqueInput
}
export type LicenseActivationUpdateOneWithoutAccount_allocationsNestedInput = {
create?: Prisma.XOR<Prisma.LicenseActivationCreateWithoutAccount_allocationsInput, Prisma.LicenseActivationUncheckedCreateWithoutAccount_allocationsInput>
connectOrCreate?: Prisma.LicenseActivationCreateOrConnectWithoutAccount_allocationsInput
upsert?: Prisma.LicenseActivationUpsertWithoutAccount_allocationsInput
disconnect?: Prisma.LicenseActivationWhereInput | boolean
delete?: Prisma.LicenseActivationWhereInput | boolean
connect?: Prisma.LicenseActivationWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.LicenseActivationUpdateToOneWithWhereWithoutAccount_allocationsInput, Prisma.LicenseActivationUpdateWithoutAccount_allocationsInput>, Prisma.LicenseActivationUncheckedUpdateWithoutAccount_allocationsInput>
}
export type LicenseActivationCreateWithoutBusiness_activityInput = {
id?: string
starts_at: Date | string
@@ -463,6 +486,7 @@ export type LicenseActivationCreateWithoutBusiness_activityInput = {
updated_at?: Date | string
license: Prisma.LicenseCreateNestedOneWithoutActivationInput
license_renews?: Prisma.LicenseRenewCreateNestedManyWithoutActivationInput
account_allocations?: Prisma.LicenseAccountAllocationCreateNestedManyWithoutLicense_activationInput
}
export type LicenseActivationUncheckedCreateWithoutBusiness_activityInput = {
@@ -473,6 +497,7 @@ export type LicenseActivationUncheckedCreateWithoutBusiness_activityInput = {
updated_at?: Date | string
license_id: string
license_renews?: Prisma.LicenseRenewUncheckedCreateNestedManyWithoutActivationInput
account_allocations?: Prisma.LicenseAccountAllocationUncheckedCreateNestedManyWithoutLicense_activationInput
}
export type LicenseActivationCreateOrConnectWithoutBusiness_activityInput = {
@@ -499,6 +524,7 @@ export type LicenseActivationUpdateWithoutBusiness_activityInput = {
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
license?: Prisma.LicenseUpdateOneRequiredWithoutActivationNestedInput
license_renews?: Prisma.LicenseRenewUpdateManyWithoutActivationNestedInput
account_allocations?: Prisma.LicenseAccountAllocationUpdateManyWithoutLicense_activationNestedInput
}
export type LicenseActivationUncheckedUpdateWithoutBusiness_activityInput = {
@@ -509,6 +535,7 @@ export type LicenseActivationUncheckedUpdateWithoutBusiness_activityInput = {
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
license_id?: Prisma.StringFieldUpdateOperationsInput | string
license_renews?: Prisma.LicenseRenewUncheckedUpdateManyWithoutActivationNestedInput
account_allocations?: Prisma.LicenseAccountAllocationUncheckedUpdateManyWithoutLicense_activationNestedInput
}
export type LicenseActivationCreateWithoutLicenseInput = {
@@ -519,6 +546,7 @@ export type LicenseActivationCreateWithoutLicenseInput = {
updated_at?: Date | string
business_activity: Prisma.BusinessActivityCreateNestedOneWithoutLicense_activationInput
license_renews?: Prisma.LicenseRenewCreateNestedManyWithoutActivationInput
account_allocations?: Prisma.LicenseAccountAllocationCreateNestedManyWithoutLicense_activationInput
}
export type LicenseActivationUncheckedCreateWithoutLicenseInput = {
@@ -529,6 +557,7 @@ export type LicenseActivationUncheckedCreateWithoutLicenseInput = {
updated_at?: Date | string
business_activity_id: string
license_renews?: Prisma.LicenseRenewUncheckedCreateNestedManyWithoutActivationInput
account_allocations?: Prisma.LicenseAccountAllocationUncheckedCreateNestedManyWithoutLicense_activationInput
}
export type LicenseActivationCreateOrConnectWithoutLicenseInput = {
@@ -555,6 +584,7 @@ export type LicenseActivationUpdateWithoutLicenseInput = {
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
business_activity?: Prisma.BusinessActivityUpdateOneRequiredWithoutLicense_activationNestedInput
license_renews?: Prisma.LicenseRenewUpdateManyWithoutActivationNestedInput
account_allocations?: Prisma.LicenseAccountAllocationUpdateManyWithoutLicense_activationNestedInput
}
export type LicenseActivationUncheckedUpdateWithoutLicenseInput = {
@@ -565,6 +595,7 @@ export type LicenseActivationUncheckedUpdateWithoutLicenseInput = {
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
business_activity_id?: Prisma.StringFieldUpdateOperationsInput | string
license_renews?: Prisma.LicenseRenewUncheckedUpdateManyWithoutActivationNestedInput
account_allocations?: Prisma.LicenseAccountAllocationUncheckedUpdateManyWithoutLicense_activationNestedInput
}
export type LicenseActivationCreateWithoutLicense_renewsInput = {
@@ -575,6 +606,7 @@ export type LicenseActivationCreateWithoutLicense_renewsInput = {
updated_at?: Date | string
license: Prisma.LicenseCreateNestedOneWithoutActivationInput
business_activity: Prisma.BusinessActivityCreateNestedOneWithoutLicense_activationInput
account_allocations?: Prisma.LicenseAccountAllocationCreateNestedManyWithoutLicense_activationInput
}
export type LicenseActivationUncheckedCreateWithoutLicense_renewsInput = {
@@ -585,6 +617,7 @@ export type LicenseActivationUncheckedCreateWithoutLicense_renewsInput = {
updated_at?: Date | string
license_id: string
business_activity_id: string
account_allocations?: Prisma.LicenseAccountAllocationUncheckedCreateNestedManyWithoutLicense_activationInput
}
export type LicenseActivationCreateOrConnectWithoutLicense_renewsInput = {
@@ -611,6 +644,7 @@ export type LicenseActivationUpdateWithoutLicense_renewsInput = {
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
license?: Prisma.LicenseUpdateOneRequiredWithoutActivationNestedInput
business_activity?: Prisma.BusinessActivityUpdateOneRequiredWithoutLicense_activationNestedInput
account_allocations?: Prisma.LicenseAccountAllocationUpdateManyWithoutLicense_activationNestedInput
}
export type LicenseActivationUncheckedUpdateWithoutLicense_renewsInput = {
@@ -621,6 +655,67 @@ export type LicenseActivationUncheckedUpdateWithoutLicense_renewsInput = {
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
license_id?: Prisma.StringFieldUpdateOperationsInput | string
business_activity_id?: Prisma.StringFieldUpdateOperationsInput | string
account_allocations?: Prisma.LicenseAccountAllocationUncheckedUpdateManyWithoutLicense_activationNestedInput
}
export type LicenseActivationCreateWithoutAccount_allocationsInput = {
id?: string
starts_at: Date | string
expires_at: Date | string
created_at?: Date | string
updated_at?: Date | string
license: Prisma.LicenseCreateNestedOneWithoutActivationInput
business_activity: Prisma.BusinessActivityCreateNestedOneWithoutLicense_activationInput
license_renews?: Prisma.LicenseRenewCreateNestedManyWithoutActivationInput
}
export type LicenseActivationUncheckedCreateWithoutAccount_allocationsInput = {
id?: string
starts_at: Date | string
expires_at: Date | string
created_at?: Date | string
updated_at?: Date | string
license_id: string
business_activity_id: string
license_renews?: Prisma.LicenseRenewUncheckedCreateNestedManyWithoutActivationInput
}
export type LicenseActivationCreateOrConnectWithoutAccount_allocationsInput = {
where: Prisma.LicenseActivationWhereUniqueInput
create: Prisma.XOR<Prisma.LicenseActivationCreateWithoutAccount_allocationsInput, Prisma.LicenseActivationUncheckedCreateWithoutAccount_allocationsInput>
}
export type LicenseActivationUpsertWithoutAccount_allocationsInput = {
update: Prisma.XOR<Prisma.LicenseActivationUpdateWithoutAccount_allocationsInput, Prisma.LicenseActivationUncheckedUpdateWithoutAccount_allocationsInput>
create: Prisma.XOR<Prisma.LicenseActivationCreateWithoutAccount_allocationsInput, Prisma.LicenseActivationUncheckedCreateWithoutAccount_allocationsInput>
where?: Prisma.LicenseActivationWhereInput
}
export type LicenseActivationUpdateToOneWithWhereWithoutAccount_allocationsInput = {
where?: Prisma.LicenseActivationWhereInput
data: Prisma.XOR<Prisma.LicenseActivationUpdateWithoutAccount_allocationsInput, Prisma.LicenseActivationUncheckedUpdateWithoutAccount_allocationsInput>
}
export type LicenseActivationUpdateWithoutAccount_allocationsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
starts_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
license?: Prisma.LicenseUpdateOneRequiredWithoutActivationNestedInput
business_activity?: Prisma.BusinessActivityUpdateOneRequiredWithoutLicense_activationNestedInput
license_renews?: Prisma.LicenseRenewUpdateManyWithoutActivationNestedInput
}
export type LicenseActivationUncheckedUpdateWithoutAccount_allocationsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
starts_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
license_id?: Prisma.StringFieldUpdateOperationsInput | string
business_activity_id?: Prisma.StringFieldUpdateOperationsInput | string
license_renews?: Prisma.LicenseRenewUncheckedUpdateManyWithoutActivationNestedInput
}
@@ -630,10 +725,12 @@ export type LicenseActivationUncheckedUpdateWithoutLicense_renewsInput = {
export type LicenseActivationCountOutputType = {
license_renews: number
account_allocations: number
}
export type LicenseActivationCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
license_renews?: boolean | LicenseActivationCountOutputTypeCountLicense_renewsArgs
account_allocations?: boolean | LicenseActivationCountOutputTypeCountAccount_allocationsArgs
}
/**
@@ -653,6 +750,13 @@ export type LicenseActivationCountOutputTypeCountLicense_renewsArgs<ExtArgs exte
where?: Prisma.LicenseRenewWhereInput
}
/**
* LicenseActivationCountOutputType without action
*/
export type LicenseActivationCountOutputTypeCountAccount_allocationsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.LicenseAccountAllocationWhereInput
}
export type LicenseActivationSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
id?: boolean
@@ -665,6 +769,7 @@ export type LicenseActivationSelect<ExtArgs extends runtime.Types.Extensions.Int
license?: boolean | Prisma.LicenseDefaultArgs<ExtArgs>
business_activity?: boolean | Prisma.BusinessActivityDefaultArgs<ExtArgs>
license_renews?: boolean | Prisma.LicenseActivation$license_renewsArgs<ExtArgs>
account_allocations?: boolean | Prisma.LicenseActivation$account_allocationsArgs<ExtArgs>
_count?: boolean | Prisma.LicenseActivationCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["licenseActivation"]>
@@ -685,6 +790,7 @@ export type LicenseActivationInclude<ExtArgs extends runtime.Types.Extensions.In
license?: boolean | Prisma.LicenseDefaultArgs<ExtArgs>
business_activity?: boolean | Prisma.BusinessActivityDefaultArgs<ExtArgs>
license_renews?: boolean | Prisma.LicenseActivation$license_renewsArgs<ExtArgs>
account_allocations?: boolean | Prisma.LicenseActivation$account_allocationsArgs<ExtArgs>
_count?: boolean | Prisma.LicenseActivationCountOutputTypeDefaultArgs<ExtArgs>
}
@@ -694,6 +800,7 @@ export type $LicenseActivationPayload<ExtArgs extends runtime.Types.Extensions.I
license: Prisma.$LicensePayload<ExtArgs>
business_activity: Prisma.$BusinessActivityPayload<ExtArgs>
license_renews: Prisma.$LicenseRenewPayload<ExtArgs>[]
account_allocations: Prisma.$LicenseAccountAllocationPayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
@@ -1046,6 +1153,7 @@ export interface Prisma__LicenseActivationClient<T, Null = never, ExtArgs extend
license<T extends Prisma.LicenseDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.LicenseDefaultArgs<ExtArgs>>): Prisma.Prisma__LicenseClient<runtime.Types.Result.GetResult<Prisma.$LicensePayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
business_activity<T extends Prisma.BusinessActivityDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BusinessActivityDefaultArgs<ExtArgs>>): Prisma.Prisma__BusinessActivityClient<runtime.Types.Result.GetResult<Prisma.$BusinessActivityPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
license_renews<T extends Prisma.LicenseActivation$license_renewsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.LicenseActivation$license_renewsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$LicenseRenewPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
account_allocations<T extends Prisma.LicenseActivation$account_allocationsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.LicenseActivation$account_allocationsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$LicenseAccountAllocationPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
@@ -1453,6 +1561,30 @@ export type LicenseActivation$license_renewsArgs<ExtArgs extends runtime.Types.E
distinct?: Prisma.LicenseRenewScalarFieldEnum | Prisma.LicenseRenewScalarFieldEnum[]
}
/**
* LicenseActivation.account_allocations
*/
export type LicenseActivation$account_allocationsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the LicenseAccountAllocation
*/
select?: Prisma.LicenseAccountAllocationSelect<ExtArgs> | null
/**
* Omit specific fields from the LicenseAccountAllocation
*/
omit?: Prisma.LicenseAccountAllocationOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.LicenseAccountAllocationInclude<ExtArgs> | null
where?: Prisma.LicenseAccountAllocationWhereInput
orderBy?: Prisma.LicenseAccountAllocationOrderByWithRelationInput | Prisma.LicenseAccountAllocationOrderByWithRelationInput[]
cursor?: Prisma.LicenseAccountAllocationWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.LicenseAccountAllocationScalarFieldEnum | Prisma.LicenseAccountAllocationScalarFieldEnum[]
}
/**
* LicenseActivation without action
*/
@@ -365,11 +365,6 @@ export type LicenseChargeTransactionUncheckedUpdateManyInput = {
partner_id?: Prisma.StringFieldUpdateOperationsInput | string
}
export type LicenseChargeTransactionScalarRelationFilter = {
is?: Prisma.LicenseChargeTransactionWhereInput
isNot?: Prisma.LicenseChargeTransactionWhereInput
}
export type LicenseChargeTransactionOrderByRelevanceInput = {
fields: Prisma.LicenseChargeTransactionOrderByRelevanceFieldEnum | Prisma.LicenseChargeTransactionOrderByRelevanceFieldEnum[]
sort: Prisma.SortOrder
@@ -414,6 +409,11 @@ export type LicenseChargeTransactionSumOrderByAggregateInput = {
purchased_count?: Prisma.SortOrder
}
export type LicenseChargeTransactionScalarRelationFilter = {
is?: Prisma.LicenseChargeTransactionWhereInput
isNot?: Prisma.LicenseChargeTransactionWhereInput
}
export type LicenseChargeTransactionListRelationFilter = {
every?: Prisma.LicenseChargeTransactionWhereInput
some?: Prisma.LicenseChargeTransactionWhereInput
@@ -424,6 +424,14 @@ export type LicenseChargeTransactionOrderByRelationAggregateInput = {
_count?: Prisma.SortOrder
}
export type IntFieldUpdateOperationsInput = {
set?: number
increment?: number
decrement?: number
multiply?: number
divide?: number
}
export type LicenseChargeTransactionCreateNestedOneWithoutLicensesInput = {
create?: Prisma.XOR<Prisma.LicenseChargeTransactionCreateWithoutLicensesInput, Prisma.LicenseChargeTransactionUncheckedCreateWithoutLicensesInput>
connectOrCreate?: Prisma.LicenseChargeTransactionCreateOrConnectWithoutLicensesInput
@@ -365,11 +365,6 @@ export type LicenseRenewChargeTransactionUncheckedUpdateManyInput = {
partner_id?: Prisma.StringFieldUpdateOperationsInput | string
}
export type LicenseRenewChargeTransactionScalarRelationFilter = {
is?: Prisma.LicenseRenewChargeTransactionWhereInput
isNot?: Prisma.LicenseRenewChargeTransactionWhereInput
}
export type LicenseRenewChargeTransactionOrderByRelevanceInput = {
fields: Prisma.LicenseRenewChargeTransactionOrderByRelevanceFieldEnum | Prisma.LicenseRenewChargeTransactionOrderByRelevanceFieldEnum[]
sort: Prisma.SortOrder
@@ -414,6 +409,11 @@ export type LicenseRenewChargeTransactionSumOrderByAggregateInput = {
purchased_count?: Prisma.SortOrder
}
export type LicenseRenewChargeTransactionScalarRelationFilter = {
is?: Prisma.LicenseRenewChargeTransactionWhereInput
isNot?: Prisma.LicenseRenewChargeTransactionWhereInput
}
export type LicenseRenewChargeTransactionListRelationFilter = {
every?: Prisma.LicenseRenewChargeTransactionWhereInput
some?: Prisma.LicenseRenewChargeTransactionWhereInput
@@ -208,6 +208,7 @@ export type PartnerAccountOrderByWithRelationInput = {
export type PartnerAccountWhereUniqueInput = Prisma.AtLeast<{
id?: string
partner_id?: string
account_id?: string
AND?: Prisma.PartnerAccountWhereInput | Prisma.PartnerAccountWhereInput[]
OR?: Prisma.PartnerAccountWhereInput[]
@@ -215,10 +216,9 @@ export type PartnerAccountWhereUniqueInput = Prisma.AtLeast<{
role?: Prisma.EnumPartnerRoleFilter<"PartnerAccount"> | $Enums.PartnerRole
created_at?: Prisma.DateTimeFilter<"PartnerAccount"> | Date | string
updated_at?: Prisma.DateTimeFilter<"PartnerAccount"> | Date | string
partner_id?: Prisma.StringFilter<"PartnerAccount"> | string
partner?: Prisma.XOR<Prisma.PartnerScalarRelationFilter, Prisma.PartnerWhereInput>
account?: Prisma.XOR<Prisma.AccountScalarRelationFilter, Prisma.AccountWhereInput>
}, "id" | "account_id">
}, "id" | "partner_id" | "account_id">
export type PartnerAccountOrderByWithAggregationInput = {
id?: Prisma.SortOrder
File diff suppressed because it is too large Load Diff
@@ -233,7 +233,7 @@ export type PartnerAccountQuotaChargeTransactionWhereInput = {
updated_at?: Prisma.DateTimeFilter<"PartnerAccountQuotaChargeTransaction"> | Date | string
partner_id?: Prisma.StringFilter<"PartnerAccountQuotaChargeTransaction"> | string
partner?: Prisma.XOR<Prisma.PartnerScalarRelationFilter, Prisma.PartnerWhereInput>
allocations?: Prisma.PartnerAccountQuotaAllocationListRelationFilter
credits?: Prisma.PartnerAccountQuotaCreditListRelationFilter
}
export type PartnerAccountQuotaChargeTransactionOrderByWithRelationInput = {
@@ -245,7 +245,7 @@ export type PartnerAccountQuotaChargeTransactionOrderByWithRelationInput = {
updated_at?: Prisma.SortOrder
partner_id?: Prisma.SortOrder
partner?: Prisma.PartnerOrderByWithRelationInput
allocations?: Prisma.PartnerAccountQuotaAllocationOrderByRelationAggregateInput
credits?: Prisma.PartnerAccountQuotaCreditOrderByRelationAggregateInput
_relevance?: Prisma.PartnerAccountQuotaChargeTransactionOrderByRelevanceInput
}
@@ -261,7 +261,7 @@ export type PartnerAccountQuotaChargeTransactionWhereUniqueInput = Prisma.AtLeas
updated_at?: Prisma.DateTimeFilter<"PartnerAccountQuotaChargeTransaction"> | Date | string
partner_id?: Prisma.StringFilter<"PartnerAccountQuotaChargeTransaction"> | string
partner?: Prisma.XOR<Prisma.PartnerScalarRelationFilter, Prisma.PartnerWhereInput>
allocations?: Prisma.PartnerAccountQuotaAllocationListRelationFilter
credits?: Prisma.PartnerAccountQuotaCreditListRelationFilter
}, "id" | "tracking_code">
export type PartnerAccountQuotaChargeTransactionOrderByWithAggregationInput = {
@@ -300,7 +300,7 @@ export type PartnerAccountQuotaChargeTransactionCreateInput = {
created_at?: Date | string
updated_at?: Date | string
partner: Prisma.PartnerCreateNestedOneWithoutAccount_quota_charge_transactionsInput
allocations?: Prisma.PartnerAccountQuotaAllocationCreateNestedManyWithoutCharge_transactionInput
credits?: Prisma.PartnerAccountQuotaCreditCreateNestedManyWithoutCharge_transactionInput
}
export type PartnerAccountQuotaChargeTransactionUncheckedCreateInput = {
@@ -311,7 +311,7 @@ export type PartnerAccountQuotaChargeTransactionUncheckedCreateInput = {
created_at?: Date | string
updated_at?: Date | string
partner_id: string
allocations?: Prisma.PartnerAccountQuotaAllocationUncheckedCreateNestedManyWithoutCharge_transactionInput
credits?: Prisma.PartnerAccountQuotaCreditUncheckedCreateNestedManyWithoutCharge_transactionInput
}
export type PartnerAccountQuotaChargeTransactionUpdateInput = {
@@ -322,7 +322,7 @@ export type PartnerAccountQuotaChargeTransactionUpdateInput = {
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
partner?: Prisma.PartnerUpdateOneRequiredWithoutAccount_quota_charge_transactionsNestedInput
allocations?: Prisma.PartnerAccountQuotaAllocationUpdateManyWithoutCharge_transactionNestedInput
credits?: Prisma.PartnerAccountQuotaCreditUpdateManyWithoutCharge_transactionNestedInput
}
export type PartnerAccountQuotaChargeTransactionUncheckedUpdateInput = {
@@ -333,7 +333,7 @@ export type PartnerAccountQuotaChargeTransactionUncheckedUpdateInput = {
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
partner_id?: Prisma.StringFieldUpdateOperationsInput | string
allocations?: Prisma.PartnerAccountQuotaAllocationUncheckedUpdateManyWithoutCharge_transactionNestedInput
credits?: Prisma.PartnerAccountQuotaCreditUncheckedUpdateManyWithoutCharge_transactionNestedInput
}
export type PartnerAccountQuotaChargeTransactionCreateManyInput = {
@@ -409,9 +409,9 @@ export type PartnerAccountQuotaChargeTransactionSumOrderByAggregateInput = {
purchased_count?: Prisma.SortOrder
}
export type PartnerAccountQuotaChargeTransactionScalarRelationFilter = {
is?: Prisma.PartnerAccountQuotaChargeTransactionWhereInput
isNot?: Prisma.PartnerAccountQuotaChargeTransactionWhereInput
export type PartnerAccountQuotaChargeTransactionNullableScalarRelationFilter = {
is?: Prisma.PartnerAccountQuotaChargeTransactionWhereInput | null
isNot?: Prisma.PartnerAccountQuotaChargeTransactionWhereInput | null
}
export type PartnerAccountQuotaChargeTransactionListRelationFilter = {
@@ -424,18 +424,20 @@ export type PartnerAccountQuotaChargeTransactionOrderByRelationAggregateInput =
_count?: Prisma.SortOrder
}
export type PartnerAccountQuotaChargeTransactionCreateNestedOneWithoutAllocationsInput = {
create?: Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionCreateWithoutAllocationsInput, Prisma.PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutAllocationsInput>
connectOrCreate?: Prisma.PartnerAccountQuotaChargeTransactionCreateOrConnectWithoutAllocationsInput
export type PartnerAccountQuotaChargeTransactionCreateNestedOneWithoutCreditsInput = {
create?: Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionCreateWithoutCreditsInput, Prisma.PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutCreditsInput>
connectOrCreate?: Prisma.PartnerAccountQuotaChargeTransactionCreateOrConnectWithoutCreditsInput
connect?: Prisma.PartnerAccountQuotaChargeTransactionWhereUniqueInput
}
export type PartnerAccountQuotaChargeTransactionUpdateOneRequiredWithoutAllocationsNestedInput = {
create?: Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionCreateWithoutAllocationsInput, Prisma.PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutAllocationsInput>
connectOrCreate?: Prisma.PartnerAccountQuotaChargeTransactionCreateOrConnectWithoutAllocationsInput
upsert?: Prisma.PartnerAccountQuotaChargeTransactionUpsertWithoutAllocationsInput
export type PartnerAccountQuotaChargeTransactionUpdateOneWithoutCreditsNestedInput = {
create?: Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionCreateWithoutCreditsInput, Prisma.PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutCreditsInput>
connectOrCreate?: Prisma.PartnerAccountQuotaChargeTransactionCreateOrConnectWithoutCreditsInput
upsert?: Prisma.PartnerAccountQuotaChargeTransactionUpsertWithoutCreditsInput
disconnect?: Prisma.PartnerAccountQuotaChargeTransactionWhereInput | boolean
delete?: Prisma.PartnerAccountQuotaChargeTransactionWhereInput | boolean
connect?: Prisma.PartnerAccountQuotaChargeTransactionWhereUniqueInput
update?: Prisma.XOR<Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionUpdateToOneWithWhereWithoutAllocationsInput, Prisma.PartnerAccountQuotaChargeTransactionUpdateWithoutAllocationsInput>, Prisma.PartnerAccountQuotaChargeTransactionUncheckedUpdateWithoutAllocationsInput>
update?: Prisma.XOR<Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionUpdateToOneWithWhereWithoutCreditsInput, Prisma.PartnerAccountQuotaChargeTransactionUpdateWithoutCreditsInput>, Prisma.PartnerAccountQuotaChargeTransactionUncheckedUpdateWithoutCreditsInput>
}
export type PartnerAccountQuotaChargeTransactionCreateNestedManyWithoutPartnerInput = {
@@ -480,7 +482,7 @@ export type PartnerAccountQuotaChargeTransactionUncheckedUpdateManyWithoutPartne
deleteMany?: Prisma.PartnerAccountQuotaChargeTransactionScalarWhereInput | Prisma.PartnerAccountQuotaChargeTransactionScalarWhereInput[]
}
export type PartnerAccountQuotaChargeTransactionCreateWithoutAllocationsInput = {
export type PartnerAccountQuotaChargeTransactionCreateWithoutCreditsInput = {
id?: string
activation_expires_at: Date | string
tracking_code: string
@@ -490,7 +492,7 @@ export type PartnerAccountQuotaChargeTransactionCreateWithoutAllocationsInput =
partner: Prisma.PartnerCreateNestedOneWithoutAccount_quota_charge_transactionsInput
}
export type PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutAllocationsInput = {
export type PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutCreditsInput = {
id?: string
activation_expires_at: Date | string
tracking_code: string
@@ -500,23 +502,23 @@ export type PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutAllocation
partner_id: string
}
export type PartnerAccountQuotaChargeTransactionCreateOrConnectWithoutAllocationsInput = {
export type PartnerAccountQuotaChargeTransactionCreateOrConnectWithoutCreditsInput = {
where: Prisma.PartnerAccountQuotaChargeTransactionWhereUniqueInput
create: Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionCreateWithoutAllocationsInput, Prisma.PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutAllocationsInput>
create: Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionCreateWithoutCreditsInput, Prisma.PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutCreditsInput>
}
export type PartnerAccountQuotaChargeTransactionUpsertWithoutAllocationsInput = {
update: Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionUpdateWithoutAllocationsInput, Prisma.PartnerAccountQuotaChargeTransactionUncheckedUpdateWithoutAllocationsInput>
create: Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionCreateWithoutAllocationsInput, Prisma.PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutAllocationsInput>
export type PartnerAccountQuotaChargeTransactionUpsertWithoutCreditsInput = {
update: Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionUpdateWithoutCreditsInput, Prisma.PartnerAccountQuotaChargeTransactionUncheckedUpdateWithoutCreditsInput>
create: Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionCreateWithoutCreditsInput, Prisma.PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutCreditsInput>
where?: Prisma.PartnerAccountQuotaChargeTransactionWhereInput
}
export type PartnerAccountQuotaChargeTransactionUpdateToOneWithWhereWithoutAllocationsInput = {
export type PartnerAccountQuotaChargeTransactionUpdateToOneWithWhereWithoutCreditsInput = {
where?: Prisma.PartnerAccountQuotaChargeTransactionWhereInput
data: Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionUpdateWithoutAllocationsInput, Prisma.PartnerAccountQuotaChargeTransactionUncheckedUpdateWithoutAllocationsInput>
data: Prisma.XOR<Prisma.PartnerAccountQuotaChargeTransactionUpdateWithoutCreditsInput, Prisma.PartnerAccountQuotaChargeTransactionUncheckedUpdateWithoutCreditsInput>
}
export type PartnerAccountQuotaChargeTransactionUpdateWithoutAllocationsInput = {
export type PartnerAccountQuotaChargeTransactionUpdateWithoutCreditsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
activation_expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
tracking_code?: Prisma.StringFieldUpdateOperationsInput | string
@@ -526,7 +528,7 @@ export type PartnerAccountQuotaChargeTransactionUpdateWithoutAllocationsInput =
partner?: Prisma.PartnerUpdateOneRequiredWithoutAccount_quota_charge_transactionsNestedInput
}
export type PartnerAccountQuotaChargeTransactionUncheckedUpdateWithoutAllocationsInput = {
export type PartnerAccountQuotaChargeTransactionUncheckedUpdateWithoutCreditsInput = {
id?: Prisma.StringFieldUpdateOperationsInput | string
activation_expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
tracking_code?: Prisma.StringFieldUpdateOperationsInput | string
@@ -543,7 +545,7 @@ export type PartnerAccountQuotaChargeTransactionCreateWithoutPartnerInput = {
purchased_count: number
created_at?: Date | string
updated_at?: Date | string
allocations?: Prisma.PartnerAccountQuotaAllocationCreateNestedManyWithoutCharge_transactionInput
credits?: Prisma.PartnerAccountQuotaCreditCreateNestedManyWithoutCharge_transactionInput
}
export type PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutPartnerInput = {
@@ -553,7 +555,7 @@ export type PartnerAccountQuotaChargeTransactionUncheckedCreateWithoutPartnerInp
purchased_count: number
created_at?: Date | string
updated_at?: Date | string
allocations?: Prisma.PartnerAccountQuotaAllocationUncheckedCreateNestedManyWithoutCharge_transactionInput
credits?: Prisma.PartnerAccountQuotaCreditUncheckedCreateNestedManyWithoutCharge_transactionInput
}
export type PartnerAccountQuotaChargeTransactionCreateOrConnectWithoutPartnerInput = {
@@ -611,7 +613,7 @@ export type PartnerAccountQuotaChargeTransactionUpdateWithoutPartnerInput = {
purchased_count?: Prisma.IntFieldUpdateOperationsInput | number
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
allocations?: Prisma.PartnerAccountQuotaAllocationUpdateManyWithoutCharge_transactionNestedInput
credits?: Prisma.PartnerAccountQuotaCreditUpdateManyWithoutCharge_transactionNestedInput
}
export type PartnerAccountQuotaChargeTransactionUncheckedUpdateWithoutPartnerInput = {
@@ -621,7 +623,7 @@ export type PartnerAccountQuotaChargeTransactionUncheckedUpdateWithoutPartnerInp
purchased_count?: Prisma.IntFieldUpdateOperationsInput | number
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
allocations?: Prisma.PartnerAccountQuotaAllocationUncheckedUpdateManyWithoutCharge_transactionNestedInput
credits?: Prisma.PartnerAccountQuotaCreditUncheckedUpdateManyWithoutCharge_transactionNestedInput
}
export type PartnerAccountQuotaChargeTransactionUncheckedUpdateManyWithoutPartnerInput = {
@@ -639,11 +641,11 @@ export type PartnerAccountQuotaChargeTransactionUncheckedUpdateManyWithoutPartne
*/
export type PartnerAccountQuotaChargeTransactionCountOutputType = {
allocations: number
credits: number
}
export type PartnerAccountQuotaChargeTransactionCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
allocations?: boolean | PartnerAccountQuotaChargeTransactionCountOutputTypeCountAllocationsArgs
credits?: boolean | PartnerAccountQuotaChargeTransactionCountOutputTypeCountCreditsArgs
}
/**
@@ -659,8 +661,8 @@ export type PartnerAccountQuotaChargeTransactionCountOutputTypeDefaultArgs<ExtAr
/**
* PartnerAccountQuotaChargeTransactionCountOutputType without action
*/
export type PartnerAccountQuotaChargeTransactionCountOutputTypeCountAllocationsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.PartnerAccountQuotaAllocationWhereInput
export type PartnerAccountQuotaChargeTransactionCountOutputTypeCountCreditsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
where?: Prisma.PartnerAccountQuotaCreditWhereInput
}
@@ -673,7 +675,7 @@ export type PartnerAccountQuotaChargeTransactionSelect<ExtArgs extends runtime.T
updated_at?: boolean
partner_id?: boolean
partner?: boolean | Prisma.PartnerDefaultArgs<ExtArgs>
allocations?: boolean | Prisma.PartnerAccountQuotaChargeTransaction$allocationsArgs<ExtArgs>
credits?: boolean | Prisma.PartnerAccountQuotaChargeTransaction$creditsArgs<ExtArgs>
_count?: boolean | Prisma.PartnerAccountQuotaChargeTransactionCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["partnerAccountQuotaChargeTransaction"]>
@@ -692,7 +694,7 @@ export type PartnerAccountQuotaChargeTransactionSelectScalar = {
export type PartnerAccountQuotaChargeTransactionOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "activation_expires_at" | "tracking_code" | "purchased_count" | "created_at" | "updated_at" | "partner_id", ExtArgs["result"]["partnerAccountQuotaChargeTransaction"]>
export type PartnerAccountQuotaChargeTransactionInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
partner?: boolean | Prisma.PartnerDefaultArgs<ExtArgs>
allocations?: boolean | Prisma.PartnerAccountQuotaChargeTransaction$allocationsArgs<ExtArgs>
credits?: boolean | Prisma.PartnerAccountQuotaChargeTransaction$creditsArgs<ExtArgs>
_count?: boolean | Prisma.PartnerAccountQuotaChargeTransactionCountOutputTypeDefaultArgs<ExtArgs>
}
@@ -700,7 +702,7 @@ export type $PartnerAccountQuotaChargeTransactionPayload<ExtArgs extends runtime
name: "PartnerAccountQuotaChargeTransaction"
objects: {
partner: Prisma.$PartnerPayload<ExtArgs>
allocations: Prisma.$PartnerAccountQuotaAllocationPayload<ExtArgs>[]
credits: Prisma.$PartnerAccountQuotaCreditPayload<ExtArgs>[]
}
scalars: runtime.Types.Extensions.GetPayloadResult<{
id: string
@@ -1051,7 +1053,7 @@ readonly fields: PartnerAccountQuotaChargeTransactionFieldRefs;
export interface Prisma__PartnerAccountQuotaChargeTransactionClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
readonly [Symbol.toStringTag]: "PrismaPromise"
partner<T extends Prisma.PartnerDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.PartnerDefaultArgs<ExtArgs>>): Prisma.Prisma__PartnerClient<runtime.Types.Result.GetResult<Prisma.$PartnerPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
allocations<T extends Prisma.PartnerAccountQuotaChargeTransaction$allocationsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.PartnerAccountQuotaChargeTransaction$allocationsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$PartnerAccountQuotaAllocationPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
credits<T extends Prisma.PartnerAccountQuotaChargeTransaction$creditsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.PartnerAccountQuotaChargeTransaction$creditsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$PartnerAccountQuotaCreditPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
@@ -1436,27 +1438,27 @@ export type PartnerAccountQuotaChargeTransactionDeleteManyArgs<ExtArgs extends r
}
/**
* PartnerAccountQuotaChargeTransaction.allocations
* PartnerAccountQuotaChargeTransaction.credits
*/
export type PartnerAccountQuotaChargeTransaction$allocationsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
export type PartnerAccountQuotaChargeTransaction$creditsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
/**
* Select specific fields to fetch from the PartnerAccountQuotaAllocation
* Select specific fields to fetch from the PartnerAccountQuotaCredit
*/
select?: Prisma.PartnerAccountQuotaAllocationSelect<ExtArgs> | null
select?: Prisma.PartnerAccountQuotaCreditSelect<ExtArgs> | null
/**
* Omit specific fields from the PartnerAccountQuotaAllocation
* Omit specific fields from the PartnerAccountQuotaCredit
*/
omit?: Prisma.PartnerAccountQuotaAllocationOmit<ExtArgs> | null
omit?: Prisma.PartnerAccountQuotaCreditOmit<ExtArgs> | null
/**
* Choose, which related nodes to fetch as well
*/
include?: Prisma.PartnerAccountQuotaAllocationInclude<ExtArgs> | null
where?: Prisma.PartnerAccountQuotaAllocationWhereInput
orderBy?: Prisma.PartnerAccountQuotaAllocationOrderByWithRelationInput | Prisma.PartnerAccountQuotaAllocationOrderByWithRelationInput[]
cursor?: Prisma.PartnerAccountQuotaAllocationWhereUniqueInput
include?: Prisma.PartnerAccountQuotaCreditInclude<ExtArgs> | null
where?: Prisma.PartnerAccountQuotaCreditWhereInput
orderBy?: Prisma.PartnerAccountQuotaCreditOrderByWithRelationInput | Prisma.PartnerAccountQuotaCreditOrderByWithRelationInput[]
cursor?: Prisma.PartnerAccountQuotaCreditWhereUniqueInput
take?: number
skip?: number
distinct?: Prisma.PartnerAccountQuotaAllocationScalarFieldEnum | Prisma.PartnerAccountQuotaAllocationScalarFieldEnum[]
distinct?: Prisma.PartnerAccountQuotaCreditScalarFieldEnum | Prisma.PartnerAccountQuotaCreditScalarFieldEnum[]
}
/**
File diff suppressed because it is too large Load Diff
@@ -24,6 +24,12 @@ export class PartnerLicensesService {
},
},
},
account_allocations: {
select: {
id: true,
account_id: true,
},
},
license: {
select: {
id: true,
@@ -24,8 +24,13 @@ export class PartnerActivatedLicensesService {
id: true,
starts_at: true,
expires_at: true,
license_id: true,
created_at: true,
account_allocations: {
select: {
id: true,
account_id: true,
},
},
business_activity: {
select: {
id: true,
@@ -46,7 +51,25 @@ export class PartnerActivatedLicensesService {
}),
])
return ResponseMapper.paginate(licenses, {
const mappedLicenses = licenses.map(license => {
const { account_allocations, business_activity, ...rest } = license
return {
...rest,
license: {
accounts_limit: account_allocations.length,
allocated_account_count: account_allocations.filter(
allocation => allocation.account_id !== null,
).length,
},
business_activity: {
...business_activity,
consumer_name: `${business_activity.consumer.first_name} ${business_activity.consumer.last_name}`,
},
}
})
return ResponseMapper.paginate(mappedLicenses, {
page,
pageSize,
count,
@@ -1,4 +1,4 @@
import { PartnerAccountQuotaAllocationWhereInput } from '@/generated/prisma/models'
import { PartnerAccountQuotaCreditWhereInput } from '@/generated/prisma/models'
import { PrismaService } from '@/prisma/prisma.service'
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from 'common/response/response-mapper'
@@ -8,14 +8,14 @@ export class PartnerAllocatedAccountsService {
constructor(private readonly prisma: PrismaService) {}
async findAll(partner_id: string, page = 1, pageSize = 10) {
const defaultWhere: PartnerAccountQuotaAllocationWhereInput = {
const defaultWhere: PartnerAccountQuotaCreditWhereInput = {
charge_transaction: {
partner_id,
},
}
const [allocations, count] = await this.prisma.$transaction(async tx => [
await tx.partnerAccountQuotaAllocation.findMany({
await tx.partnerAccountQuotaCredit.findMany({
where: defaultWhere,
skip: (page - 1) * pageSize,
take: pageSize,
@@ -24,7 +24,6 @@ export class PartnerAllocatedAccountsService {
created_at: true,
updated_at: true,
charge_transaction_id: true,
license_id: true,
charge_transaction: {
select: {
id: true,
@@ -33,21 +32,22 @@ export class PartnerAllocatedAccountsService {
created_at: true,
},
},
license: {
allocation: {
select: {
id: true,
accounts_limit: true,
activation: {
account: {
select: {
id: true,
business_activity_id: true,
pos: {
select: {
id: true,
},
},
},
},
},
},
},
}),
await tx.partnerAccountQuotaAllocation.count({
await tx.partnerAccountQuotaCredit.count({
where: defaultWhere,
}),
])
@@ -3,9 +3,9 @@ import {
isTrackingCodeUniqueViolation,
} from '@/common/utils/tracking-code-generator.util'
import {
PartnerAccountQuotaAllocationCreateInput,
PartnerAccountQuotaChargeTransactionSelect,
PartnerAccountQuotaChargeTransactionWhereInput,
PartnerAccountQuotaCreditCreateInput,
} from '@/generated/prisma/models'
import { PrismaService } from '@/prisma/prisma.service'
import { BadRequestException, Injectable } from '@nestjs/common'
@@ -40,10 +40,10 @@ export class PartnerAccountChargeTransactionService {
purchased_count: true,
_count: {
select: {
allocations: {
credits: {
where: {
license_id: {
not: null,
allocation: {
isNot: null,
},
},
},
@@ -120,9 +120,9 @@ export class PartnerAccountChargeTransactionService {
throw new BadRequestException('متاسفانه مشکلی پیش آمده است.')
}
const accountCreationPromises: any[] = []
const creditCreationPromises: any[] = []
for (let i = 0; i < data.quantity; i++) {
const account: PartnerAccountQuotaAllocationCreateInput = {
const credit: PartnerAccountQuotaCreditCreateInput = {
charge_transaction: {
connect: {
id: transaction.id,
@@ -130,20 +130,16 @@ export class PartnerAccountChargeTransactionService {
},
}
accountCreationPromises.push(
tx.partnerAccountQuotaAllocation.create({ data: account }),
creditCreationPromises.push(
tx.partnerAccountQuotaCredit.create({ data: credit }),
)
}
const createdAllocations = await Promise.all(accountCreationPromises)
const createdCredits = await Promise.all(creditCreationPromises)
if (
createdAllocations.some(
createdAllocation => createdAllocation.activation_id === null,
)
) {
if (createdCredits.some(createdCredit => createdCredit.activation_id === null)) {
throw new BadRequestException('متاسفانه مشکلی پیش آمده است. ')
}
return { transaction, createdAllocations }
return { transaction, createdCredits }
})
} catch (error) {
throw error
@@ -2,7 +2,6 @@ import { PrismaModule } from '@/prisma/prisma.module'
import { Module } from '@nestjs/common'
import { AdminPartnerActivatedLicensesModule } from './activatedLicenses/activatedLicenses.module'
import { AdminPartnerAllocatedAccountsModule } from './allocatedAccounts/allocatedAccounts.module'
import { PartnerAccountChargeTransactionModule } from './chargeAccountQoutaTransactions/chargeAccountQuotaTransactions.module'
import { AdminPartnerLicenseChargeTransactionModule } from './chargedLicenseTransactions/chargedLicenseTransactions.module'
import { AdminPartnerAccountsModule } from './partnerAccounts/accounts.module'
@@ -14,7 +13,7 @@ import { PartnersService } from './partners.service'
PrismaModule,
AdminPartnerLicenseChargeTransactionModule,
AdminPartnerActivatedLicensesModule,
AdminPartnerAllocatedAccountsModule,
// AdminPartnerAllocatedAccountsModule,
PartnerAccountChargeTransactionModule,
AdminPartnerAccountsModule,
],
+100 -103
View File
@@ -1,5 +1,4 @@
import { PasswordUtil } from '@/common/utils/password.util'
import { LicenseChargeTransaction } from '@/generated/prisma/client'
import {
AccountStatus,
AccountType,
@@ -14,6 +13,7 @@ import { CreatePartnerDto, UpdatePartnerDto } from './dto/partner.dto'
@Injectable()
export class PartnersService {
private now = new Date().getTime()
constructor(private readonly prisma: PrismaService) {}
private readonly defaultSelect: PartnerSelect = {
@@ -22,40 +22,107 @@ export class PartnersService {
code: true,
status: true,
created_at: true,
license_charge_transactions: {
select: {
activation_expires_at: true,
purchased_count: true,
_count: {
select: {
licenses: {
where: {
activation: {
isNot: null,
},
},
},
},
},
},
},
license_renew_charge_transactions: {
select: {
activation_expires_at: true,
purchased_count: true,
_count: {
select: {
license_renews: {
where: {
activation: {
isNot: undefined,
},
},
},
},
},
},
},
account_quota_charge_transactions: {
select: {
activation_expires_at: true,
purchased_count: true,
_count: {
select: {
credits: {
where: {
allocation_id: {
not: null,
},
},
},
},
},
},
},
}
private readonly separateLicenseCount = (
transactions: LicenseChargeTransaction[] | null,
) => {
function toDateOnlyString(date) {
return date.toISOString().slice(0, 10)
}
private readonly mapPartner = (partner: any) => {
const {
license_charge_transactions,
account_quota_charge_transactions,
license_renew_charge_transactions,
...rest
} = partner
const startOfTodayDate = toDateOnlyString(new Date())
const account_quota_status = { total: 0, used: 0, expired: 0 }
account_quota_charge_transactions.forEach((account_quota_charge_transaction: any) => {
const total = account_quota_charge_transaction.purchased_count
const used = account_quota_charge_transaction._count.credits
account_quota_status.total += total
account_quota_status.used += used
account_quota_status.expired +=
account_quota_charge_transaction.activation_expires_at.getTime() <= this.now
? total - used
: 0
})
const used = transactions?.reduce((sum, cur) => {
const license = cur as any
return sum + license.licenses.filter(license => license.activation).length || 0
}, 0)
const total = transactions?.reduce((sum, cur) => {
const license = cur as any
return sum + license.licenses.length || 0
}, 0)
const expired = transactions?.reduce((sum, cur) => {
const license = cur as any
const activationExpiresDate = toDateOnlyString(license.activation_expires_at)
if (startOfTodayDate > activationExpiresDate)
return sum + license.licenses.filter(license => !license.activation).length || 0
return sum
}, 0)
const licenses_status = { total: 0, used: 0, expired: 0 }
license_charge_transactions.forEach((license_charge_transaction: any) => {
const total = license_charge_transaction.purchased_count
const used = license_charge_transaction._count.licenses
licenses_status.total += total
licenses_status.used += used
licenses_status.expired +=
license_charge_transaction.activation_expires_at.getTime() <= this.now
? total - used
: 0
})
const license_renew_status = { total: 0, used: 0, expired: 0 }
license_renew_charge_transactions.forEach((license_renew_charge_transaction: any) => {
const total = license_renew_charge_transaction.purchased_count
const used = license_renew_charge_transaction._count.license_renews
license_renew_status.total += total
license_renew_status.used += used
license_renew_status.expired +=
license_renew_charge_transaction.activation_expires_at.getTime() <= this.now
? total - used
: 0
})
return {
total,
used,
expired,
...rest,
licenses_status,
license_renew_status,
account_quota_status,
}
}
@@ -64,88 +131,18 @@ export class PartnersService {
select: this.defaultSelect,
})
// const mappedPartners = partners.map(partner => {
// const { license_charge_transactions, account_quota_charge_transactions, ...rest } = partner
// const a = { total: 0, used: 0, expired: 0 }
const mappedPartners = partners.map(this.mapPartner)
// account_quota_charge_transactions.forEach(account_quota_charge_transaction => {
// a.total += account_quota_charge_transaction.
// })
// return {
// ...rest,
// licenses_status: this.separateLicenseCount(license_charge_transactions),
// }
// })
return ResponseMapper.list(partners)
return ResponseMapper.list(mappedPartners)
}
async findOne(id: string) {
const partner = await this.prisma.partner.findUniqueOrThrow({
where: { id },
select: {
...this.defaultSelect,
license_charge_transactions: {
select: {
purchased_count: true,
_count: {
select: {
licenses: {
where: {
activation: {
isNot: null,
},
},
},
},
},
},
},
account_quota_charge_transactions: {
select: {
purchased_count: true,
_count: {
select: {
allocations: {
where: {
license_id: null,
},
},
},
},
},
},
},
select: this.defaultSelect,
})
const { license_charge_transactions, account_quota_charge_transactions, ...rest } =
partner
const account_quota_status = { total: 0, used: 0, expired: 0 }
account_quota_charge_transactions.forEach(account_quota_charge_transaction => {
account_quota_status.total += account_quota_charge_transaction.purchased_count
account_quota_status.used += account_quota_charge_transaction._count.allocations
account_quota_status.expired +=
account_quota_charge_transaction.purchased_count -
account_quota_charge_transaction._count.allocations
})
const licenses_status = { total: 0, used: 0, expired: 0 }
license_charge_transactions.forEach(license_charge_transaction => {
licenses_status.total += license_charge_transaction.purchased_count
licenses_status.used += license_charge_transaction._count.licenses
licenses_status.expired +=
license_charge_transaction.purchased_count -
license_charge_transaction._count.licenses
})
const mappedPartner = {
...rest,
licenses_status,
account_quota_status,
}
return ResponseMapper.single(mappedPartner)
return ResponseMapper.single(this.mapPartner(partner))
}
async create(data: CreatePartnerDto) {
@@ -19,15 +19,7 @@ export class BusinessActivitiesService {
name: true,
},
},
complexes: {
select: {
_count: {
select: {
pos_list: true,
},
},
},
},
license_activation: {
select: {
id: true,
@@ -35,10 +27,14 @@ export class BusinessActivitiesService {
expires_at: true,
license: {
select: {
accounts_limit: true,
_count: {
activation: {
select: {
account_allocations: true,
account_allocations: {
select: {
id: true,
account_id: true,
},
},
},
},
},
@@ -50,17 +46,16 @@ export class BusinessActivitiesService {
private readonly prepareBusinessActivityResponse = (businessActivity: any) => {
const { license_activation, complexes, ...rest } = businessActivity
const { license, ...license_activation_rest } = license_activation
const { accounts_limit, _count } = license
const { account_allocations } = license.activation
return {
...rest,
license_info: {
...license_activation_rest,
accounts_limit: accounts_limit + _count.account_allocations,
allocated_account_count: complexes.reduce(
(acc: number, complex: any) => acc + complex._count.pos_list,
0,
),
accounts_limit: account_allocations.length,
allocated_account_count: account_allocations.filter(
allocation => allocation.account_id,
).length,
},
}
}
@@ -6,7 +6,6 @@ import {
POSStatus,
} from '@/generated/prisma/enums'
import { PosCreateInput, PosSelect, PosWhereInput } from '@/generated/prisma/models'
import { getBusinessActivityRemainingAccounts } from '@/modules/consumer/utils/getBusinessActivityRemainingAccounts.util'
import { PrismaService } from '@/prisma/prisma.service'
import { BadRequestException, Injectable } from '@nestjs/common'
import { ResponseMapper } from 'common/response/response-mapper'
@@ -24,6 +23,15 @@ export class ComplexPosesService {
status: true,
created_at: true,
pos_type: true,
account: {
select: {
account: {
select: {
username: true,
},
},
},
},
provider: {
select: {
@@ -74,6 +82,7 @@ export class ComplexPosesService {
defaultInsert = async (
consumer_id: string,
complex_id: string,
account_allocation_id: string,
data: CreatePosDto,
): Promise<PosCreateInput> => {
const { device_id, provider_id, username, password, ...rest } = data
@@ -88,6 +97,11 @@ export class ComplexPosesService {
account: {
create: {
role: ConsumerRole.OPERATOR,
account_allocation: {
connect: {
id: account_allocation_id,
},
},
account: {
create: {
username,
@@ -120,13 +134,25 @@ export class ComplexPosesService {
}
}
private readonly mapPos = (pos: any) => {
const { account, ...rest } = pos
const { account: accountInfo } = account
return {
...rest,
account: {
username: accountInfo.username,
},
}
}
async findAll(consumer_id: string, business_activity_id: string, complex_id: string) {
const poses = await this.prisma.pos.findMany({
where: this.defaultWhere(consumer_id, business_activity_id, complex_id),
select: this.defaultSelect,
})
return ResponseMapper.list(poses)
return ResponseMapper.list(poses.map(this.mapPos))
}
async findOne(
@@ -142,7 +168,7 @@ export class ComplexPosesService {
},
select: this.defaultSelect,
})
return ResponseMapper.single(pos)
return ResponseMapper.single(this.mapPos(pos))
}
async create(
@@ -151,13 +177,41 @@ export class ComplexPosesService {
complex_id: string,
data: CreatePosDto,
) {
const now = new Date()
const pos = await this.prisma.$transaction(async tx => {
const quota = await getBusinessActivityRemainingAccounts(tx, {
consumer_id,
business_activity_id,
const account_allocation = await tx.licenseAccountAllocation.findFirst({
where: {
account_id: null,
license_activation: {
business_activity_id,
business_activity: {
consumer_id,
},
OR: [
{
expires_at: {
gte: now,
},
},
{
license_renews: {
some: {
expires_at: {
gte: now,
},
},
},
},
],
},
},
select: {
id: true,
},
})
if (quota.remaining_accounts <= 0) {
if (!account_allocation) {
throw new BadRequestException(
`تعداد کاربرهای تخصیص داده شده برای این فعالیت تجاری به پایان رسیده است.`,
)
@@ -165,7 +219,12 @@ export class ComplexPosesService {
return await tx.pos.create({
data: {
...(await this.defaultInsert(consumer_id, complex_id, data)),
...(await this.defaultInsert(
consumer_id,
complex_id,
account_allocation.id,
data,
)),
status: POSStatus.ACTIVE,
},
})
@@ -1,7 +1,8 @@
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
import { PartnerInfo } from '@/common/decorators/partnerInfo.decorator'
import { Body, Controller, Get, Param, Patch } from '@nestjs/common'
import { ApiTags } from '@nestjs/swagger'
import { AccountsService } from './accounts.service'
import { CreateConsumerAccountDto, UpdateAccountDto } from './dto/account.dto'
import { UpdateAccountDto } from './dto/account.dto'
@ApiTags('PartnerConsumerAccounts')
@Controller('partner/consumers/:consumerId/accounts')
@@ -9,26 +10,39 @@ export class AccountsController {
constructor(private readonly accountsService: AccountsService) {}
@Get()
async findAll(@Param('consumerId') consumerId: string) {
return this.accountsService.findAll(consumerId)
async findAll(
@PartnerInfo('id') partnerId: string,
@Param('consumerId') consumerId: string,
) {
return this.accountsService.findAll(partnerId, consumerId)
}
@Get(':id')
async findOne(@Param('id') id: string) {
return this.accountsService.findOne(id)
async findOne(
@PartnerInfo('id') partnerId: string,
@Param('consumerId') consumerId: string,
@Param('id') id: string,
) {
return this.accountsService.findOne(partnerId, consumerId, id)
}
@Post()
async create(
@Param('consumerId') consumerId: string,
@Body() data: CreateConsumerAccountDto,
) {
return this.accountsService.create(consumerId, data)
}
// @Post()
// async create(
// @PartnerInfo('id') partnerId: string,
// @Param('consumerId') consumerId: string,
// @Body() data: CreateConsumerAccountDto,
// ) {
// return this.accountsService.create(partnerId, consumerId, data)
// }
@Patch(':id')
async update(@Param('id') id: string, @Body() data: UpdateAccountDto) {
return this.accountsService.update(id, data)
async update(
@PartnerInfo('id') partnerId: string,
@Param('consumerId') consumerId: string,
@Param('id') id: string,
@Body() data: UpdateAccountDto,
) {
return this.accountsService.update(partnerId, consumerId, id, data)
}
// @Delete(':id')
@@ -1,82 +1,113 @@
import { PasswordUtil } from '@/common/utils/password.util'
import { AccountStatus, AccountType } from '@/generated/prisma/enums'
import { ConsumerAccountSelect } from '@/generated/prisma/models'
import { PrismaService } from '@/prisma/prisma.service'
import { Injectable } from '@nestjs/common'
import { ResponseMapper } from 'common/response/response-mapper'
import { CreateConsumerAccountDto, UpdateAccountDto } from './dto/account.dto'
import { UpdateAccountDto } from './dto/account.dto'
@Injectable()
export class AccountsService {
constructor(private readonly prisma: PrismaService) {}
async findAll(consumer_id: string) {
const accounts = await this.prisma.consumerAccount.findMany({
where: { consumer_id },
private readonly default_select: ConsumerAccountSelect = {
id: true,
role: true,
created_at: true,
pos: {
select: {
id: true,
role: true,
created_at: true,
account: {
name: true,
complex: {
select: {
username: true,
status: true,
id: true,
name: true,
branch_code: true,
business_activity: {
select: {
id: true,
name: true,
},
},
},
},
},
},
account: {
select: {
username: true,
status: true,
},
},
}
private readonly defaultWhere = (partner_id, consumer_id) => ({
consumer_id,
consumer: {
partner_id,
},
})
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,
})
return ResponseMapper.list(accounts)
}
async findOne(id: string) {
async findOne(partner_id: string, consumer_id: string, id: string) {
const account = await this.prisma.consumerAccount.findMany({
where: { id },
select: {
id: true,
role: true,
created_at: true,
account: {
select: {
username: true,
status: true,
},
},
where: {
...this.defaultWhere(partner_id, consumer_id),
id,
},
select: this.default_select,
})
return ResponseMapper.single(account)
}
async create(consumerId: string, data: CreateConsumerAccountDto) {
const account = await this.prisma.consumerAccount.create({
data: {
role: data.role,
account: {
create: {
password: await PasswordUtil.hash(data.password),
status: AccountStatus.ACTIVE,
type: AccountType.CONSUMER,
username: data.username,
},
},
consumer: {
connect: {
id: consumerId,
},
},
permission: {
create: {},
},
},
})
return ResponseMapper.create(account)
}
// async create(partner_id: string, consumer_id: string, data: CreateConsumerAccountDto) {
// const account = await this.prisma.consumerAccount.create({
// data: {
// role: data.role,
// account: {
// create: {
// password: await PasswordUtil.hash(data.password),
// status: AccountStatus.ACTIVE,
// type: AccountType.CONSUMER,
// username: data.username,
// },
// },
// consumer: {
// connect: {
// id: consumer_id,
// },
// },
// permission: {
// create: {},
// },
// },
// })
// return ResponseMapper.create(account)
// }
async update(id: string, data: UpdateAccountDto) {
const account = await this.prisma.account.update({ where: { id }, data })
async update(
partner_id: string,
consumer_id: string,
id: string,
data: UpdateAccountDto,
) {
const account = await this.prisma.account.update({
where: {
...this.defaultWhere(partner_id, consumer_id),
id,
},
data,
})
return ResponseMapper.update(account)
}
async delete(id: string) {
await this.prisma.account.delete({ where: { id } })
return ResponseMapper.delete()
}
// async delete(partner_id: string, id: string) {
// await this.prisma.account.delete({ where: { id } })
// return ResponseMapper.delete()
// }
}
@@ -31,10 +31,11 @@ export class BusinessActivitiesController {
@Post()
async create(
@PartnerInfo('id') partnerId: string,
@Param('consumerId') consumerId: string,
@Body() data: CreateBusinessActivitiesDto,
) {
return this.businessActivitiesService.create(consumerId, data)
return this.businessActivitiesService.create(partnerId, consumerId, data)
}
@Put(':id')
@@ -1,6 +1,7 @@
import { BusinessActivitySelect } from '@/generated/prisma/models'
import { getPartnerFirstRemainingLicense } from '@/modules/partners/utils/getPartnerRemainingLicenses.util'
import { PrismaService } from '@/prisma/prisma.service'
import { Injectable } from '@nestjs/common'
import { BadRequestException, Injectable } from '@nestjs/common'
import { ResponseMapper } from 'common/response/response-mapper'
import { CreateBusinessActivitiesDto } from './dto/create-business-activities.dto'
@@ -8,6 +9,12 @@ import { CreateBusinessActivitiesDto } from './dto/create-business-activities.dt
export class BusinessActivitiesService {
constructor(private readonly prisma: PrismaService) {}
private readonly setExpireDate = (starts_at: Date) => {
return new Date(
new Date(starts_at).setFullYear(new Date(starts_at).getFullYear() + 1),
).toISOString()
}
defaultSelect: BusinessActivitySelect = {
id: true,
name: true,
@@ -27,10 +34,13 @@ export class BusinessActivitiesService {
expires_at: true,
license: {
select: {
accounts_limit: true,
_count: {
activation: {
select: {
account_allocations: true,
_count: {
select: {
account_allocations: true,
},
},
},
},
},
@@ -42,13 +52,13 @@ export class BusinessActivitiesService {
private readonly prepareBusinessActivityResponse = (businessActivity: any) => {
const { license_activation, ...rest } = businessActivity
const { license, ...license_activation_rest } = license_activation
const { accounts_limit, _count } = license
const { _count } = license.activation
return {
...rest,
license_info: {
...license_activation_rest,
accounts_limit: accounts_limit + _count.account_allocations,
accounts_limit: _count.account_allocations,
},
}
}
@@ -82,24 +92,80 @@ export class BusinessActivitiesService {
return ResponseMapper.single(this.prepareBusinessActivityResponse(businessActivity))
}
async create(consumer_id: string, data: CreateBusinessActivitiesDto) {
const { guild_id, ...rest } = data
const businessActivity = await this.prisma.businessActivity.create({
data: {
...rest,
guild: {
connect: {
id: data.guild_id,
async create(
partner_id: string,
consumer_id: string,
data: CreateBusinessActivitiesDto,
) {
const businessActivity = await this.prisma.$transaction(async tx => {
const license = await getPartnerFirstRemainingLicense(tx, { partner_id })
const { guild_id, license_starts_at, expires_at, ...rest } = data
const createdBusinessActivity = await tx.businessActivity.create({
data: {
...rest,
guild: {
connect: {
id: guild_id,
},
},
consumer: {
connect: {
id: consumer_id,
},
},
license_activation: {
create: {
starts_at: license_starts_at ?? new Date(),
expires_at:
expires_at ?? this.setExpireDate(new Date(license_starts_at || '')),
license: {
connect: {
id: license.id,
},
},
},
},
},
consumer: {
connect: {
id: consumer_id,
select: {
id: true,
license_activation: {
select: {
id: true,
},
},
},
},
select: this.defaultSelect,
})
const activationId = createdBusinessActivity.license_activation?.id
if (!activationId) {
throw new BadRequestException('لایسنس برای این فعالیت تجاری ایجاد نشد.')
}
const licenseAllocationCreation = Array.from({
length: license.accounts_limit,
}).map(() =>
tx.licenseAccountAllocation.create({
data: {
license_activation: {
connect: {
id: activationId,
},
},
},
}),
)
await Promise.all(licenseAllocationCreation)
return tx.businessActivity.findUniqueOrThrow({
where: {
id: createdBusinessActivity.id,
},
select: this.defaultSelect,
})
})
return ResponseMapper.create(businessActivity)
}
@@ -36,7 +36,7 @@ export class BusinessActivityComplexesController {
@Param('businessActivityId') businessActivityId: string,
@Body() data: CreateComplexDto,
) {
return this.service.create(businessActivityId, data)
return this.service.create(partnerId, businessActivityId, data)
}
@Patch(':id')
@@ -31,11 +31,11 @@ export class BusinessActivityComplexesService {
})
async findAll(partner_id: string, consumer_id: string, business_activity_id: string) {
const accounts = await this.prisma.complex.findMany({
const complexes = await this.prisma.complex.findMany({
where: this.defaultWhere(partner_id, consumer_id, business_activity_id),
select: this.defaultSelect,
})
return ResponseMapper.list(accounts)
return ResponseMapper.list(complexes)
}
async findOne(
@@ -44,18 +44,18 @@ export class BusinessActivityComplexesService {
business_activity_id: string,
id: string,
) {
const account = await this.prisma.complex.findUnique({
const complex = await this.prisma.complex.findUnique({
where: {
...this.defaultWhere(partner_id, consumer_id, business_activity_id),
id,
},
select: this.defaultSelect,
})
return ResponseMapper.single(account)
return ResponseMapper.single(complex)
}
async create(business_id: string, data: CreateComplexDto) {
const account = await this.prisma.complex.create({
async create(partner_id: string, business_id: string, data: CreateComplexDto) {
const complex = await this.prisma.complex.create({
data: {
...data,
business_activity: {
@@ -65,7 +65,7 @@ export class BusinessActivityComplexesService {
},
},
})
return ResponseMapper.create(account)
return ResponseMapper.create(complex)
}
async update(
@@ -75,11 +75,11 @@ export class BusinessActivityComplexesService {
id: string,
data: UpdateComplexDto,
) {
const account = await this.prisma.complex.update({
const complex = await this.prisma.complex.update({
where: { ...this.defaultWhere(partner_id, consumer_id, business_activity_id), id },
data,
})
return ResponseMapper.update(account)
return ResponseMapper.update(complex)
}
// async delete(id: string) {
@@ -1,8 +1,9 @@
import { POSStatus, POSType } from '@/generated/prisma/enums'
import { ApiProperty, PartialType } from '@nestjs/swagger'
import { CreateConsumerAccountDto } from '@/modules/partners/consumers/accounts/dto/account.dto'
import { ApiProperty, OmitType, PartialType } from '@nestjs/swagger'
import { IsEnum, IsOptional, IsString } from 'class-validator'
export class CreatePosDto {
export class CreatePosDto extends OmitType(CreateConsumerAccountDto, ['role']) {
@IsString()
@ApiProperty({})
name: string
@@ -31,10 +31,11 @@ export class ComplexPosesController {
@Post()
async create(
@PartnerInfo('id') partnerId: string,
@Param('businessActivityId') businessActivityId: string,
@Param('complexId') complexId: string,
@Body() data: CreatePosDto,
) {
return this.service.create(complexId, data)
return this.service.create(partnerId, businessActivityId, complexId, data)
}
@Patch(':id')
@@ -1,7 +1,13 @@
import { POSStatus } from '@/generated/prisma/enums'
import { PasswordUtil } from '@/common/utils/password.util'
import {
AccountStatus,
AccountType,
ConsumerRole,
POSStatus,
} from '@/generated/prisma/enums'
import { PosCreateInput, PosSelect } from '@/generated/prisma/models'
import { PrismaService } from '@/prisma/prisma.service'
import { Injectable } from '@nestjs/common'
import { BadRequestException, Injectable } from '@nestjs/common'
import { ResponseMapper } from 'common/response/response-mapper'
import { CreatePosDto, UpdatePosDto } from './dto/pos.dto'
@@ -18,6 +24,16 @@ export class ComplexPosesService {
created_at: true,
pos_type: true,
account: {
select: {
account: {
select: {
username: true,
},
},
},
},
provider: {
select: {
id: true,
@@ -67,10 +83,22 @@ export class ComplexPosesService {
},
})
private readonly mapPos = (pos: any) => {
const { account, ...rest } = pos
const { account: accountInfo } = account
return {
...rest,
account: {
username: accountInfo.username,
},
}
}
private readonly defaultInsert = (data: CreatePosDto, complex_id: string) => {
const { device_id, provider_id, ...rest } = data
return {
const dataToCreate: PosCreateInput = {
...rest,
complex: {
connect: {
@@ -91,15 +119,20 @@ export class ComplexPosesService {
},
}
: undefined,
} as PosCreateInput
}
return dataToCreate
}
async findAll(partner_id: string, business_activity_id: string, complex_id: string) {
const accounts = await this.prisma.pos.findMany({
const poses = await this.prisma.pos.findMany({
where: this.defaultWhere(partner_id, complex_id, business_activity_id),
select: this.defaultSelect,
})
return ResponseMapper.list(accounts)
const mappedPoses = poses.map(this.mapPos)
return ResponseMapper.list(mappedPoses)
}
async findOne(
@@ -108,21 +141,102 @@ export class ComplexPosesService {
complex_id: string,
id: string,
) {
const account = await this.prisma.pos.findUniqueOrThrow({
const pos = await this.prisma.pos.findUniqueOrThrow({
where: { ...this.defaultWhere(partner_id, complex_id, business_activity_id), id },
select: this.defaultSelect,
})
return ResponseMapper.single(account)
return ResponseMapper.single(this.mapPos(pos))
}
async create(complex_id: string, data: CreatePosDto) {
const account = await this.prisma.pos.create({
data: {
...this.defaultInsert(data, complex_id),
status: POSStatus.ACTIVE,
},
async create(
partner_id: string,
business_activity_id: string,
complex_id: string,
data: CreatePosDto,
) {
const pos = this.prisma.$transaction(async tx => {
const ba = await tx.businessActivity.findUniqueOrThrow({
where: {
id: business_activity_id,
consumer: {
partner_id,
},
},
select: {
consumer_id: true,
license_activation: {
select: {
_count: {
select: {
account_allocations: {
where: {
account_id: {
not: undefined,
},
},
},
},
},
},
},
},
})
if (!ba.license_activation?._count.account_allocations) {
throw new BadRequestException(
`محدودیت تعریف تعداد کاربران این فعالیت تجاری به پایان رسیده است.`,
)
}
const { device_id, provider_id, username, password, ...rest } = data
return await tx.pos.create({
data: {
...rest,
status: POSStatus.ACTIVE,
account: {
create: {
role: ConsumerRole.OPERATOR,
consumer: {
connect: {
id: ba.consumer_id,
},
},
account: {
create: {
username,
password: await PasswordUtil.hash(password),
type: AccountType.CONSUMER,
status: AccountStatus.ACTIVE,
},
},
},
},
complex: {
connect: {
id: complex_id,
},
},
device: device_id
? {
connect: {
id: device_id,
},
}
: undefined,
provider: provider_id
? {
connect: {
id: provider_id,
},
}
: undefined,
},
})
})
return ResponseMapper.create(account)
return ResponseMapper.create(pos)
}
async update(
@@ -133,7 +247,7 @@ export class ComplexPosesService {
data: UpdatePosDto,
) {
const { device_id, provider_id, ...rest } = data
const account = await this.prisma.pos.update({
const pos = await this.prisma.pos.update({
where: { ...this.defaultWhere(partner_id, complex_id, business_activity_id), id },
data: {
complex: {
@@ -158,7 +272,7 @@ export class ComplexPosesService {
...rest,
},
})
return ResponseMapper.update(account)
return ResponseMapper.update(pos)
}
// async delete(id: string) {
@@ -1,5 +1,5 @@
import { ApiProperty, PartialType } from '@nestjs/swagger'
import { IsString } from 'class-validator'
import { IsDateString, IsOptional, IsString } from 'class-validator'
export class CreateBusinessActivitiesDto {
@IsString()
@@ -11,8 +11,18 @@ export class CreateBusinessActivitiesDto {
economic_code: string
@IsString()
@ApiProperty({})
@ApiProperty({ required: true })
guild_id: string
@IsDateString()
@IsOptional()
@ApiProperty({ required: false })
license_starts_at: string
@IsDateString()
@IsOptional()
@ApiProperty({ required: false })
expires_at: string
}
export class UpdateBusinessActivityDto extends PartialType(CreateBusinessActivitiesDto) {}
+6 -1
View File
@@ -10,7 +10,12 @@ export class PartnerController {
constructor(private service: PartnerService) {}
@Get('')
async findOne(@PartnerInfo('id') partnerId: string) {
async me(@PartnerInfo('id') partnerId: string) {
return this.service.me(partnerId)
}
@Get('info')
async getInfo(@PartnerInfo('id') partnerId: string) {
return this.service.getInfo(partnerId)
}
+169 -15
View File
@@ -1,5 +1,5 @@
import { ResponseMapper } from '@/common/response/response-mapper'
import { PartnerSelect } from '@/generated/prisma/models'
import { PartnerAccountSelect } from '@/generated/prisma/models'
import { PrismaService } from '@/prisma/prisma.service'
import { Injectable } from '@nestjs/common'
import { UpdatePartnerProfileDto } from './dto/partner.dto'
@@ -8,23 +8,31 @@ import { UpdatePartnerProfileDto } from './dto/partner.dto'
export class PartnerService {
constructor(private readonly prisma: PrismaService) {}
private readonly defaultSelect: PartnerSelect = {
id: true,
name: true,
status: true,
account_quota_charge_transactions: {
private readonly defaultSelect: PartnerAccountSelect = {}
async me(partner_id: string) {
const partner = await this.prisma.partnerAccount.findUniqueOrThrow({
where: {
partner_id,
},
select: {
_count: {
id: true,
role: true,
account: {
select: {
allocations: {
where: {
license_id: undefined,
},
},
username: true,
},
},
partner: {
select: {
id: true,
name: true,
},
},
},
},
})
return ResponseMapper.single(partner)
}
async getInfo(partner_id: string) {
@@ -32,10 +40,156 @@ export class PartnerService {
where: {
id: partner_id,
},
select: this.defaultSelect,
select: {
id: true,
name: true,
code: true,
created_at: true,
license_charge_transactions: {
select: {
purchased_count: true,
activation_expires_at: true,
_count: {
select: {
licenses: {
where: {
activation: {
isNot: null,
},
},
},
},
},
},
},
account_quota_charge_transactions: {
select: {
purchased_count: true,
activation_expires_at: true,
_count: {
select: {
credits: {
where: {
charge_transaction: {
isNot: null,
},
allocation: {
isNot: null,
},
},
},
},
},
},
},
license_renew_charge_transactions: {
select: {
purchased_count: true,
activation_expires_at: true,
_count: {
select: {
license_renews: {
where: {
activation: {
isNot: undefined,
},
},
},
},
},
},
},
},
})
return ResponseMapper.single(partner)
const {
license_charge_transactions,
account_quota_charge_transactions,
license_renew_charge_transactions,
...partnerInfo
} = partner
const licenses_status = {
total_purchased: 0,
total_activated: 0,
total_expired: 0,
}
const account_quotas_status = {
total_purchased: 0,
total_activated: 0,
total_expired: 0,
}
const license_renews_status = {
total_purchased: 0,
total_activated: 0,
total_expired: 0,
}
const now = new Date()
const checkExpired = (expires_at: Date) => expires_at < now
const prepareData = (
items_count: number,
activation_expires_at: Date,
purchased_count: number,
) => {
let totalActivated = 0
let totalExpired = 0
if (!checkExpired(activation_expires_at)) {
totalActivated = items_count
} else {
totalExpired = items_count
}
return {
total_purchased: purchased_count,
total_activated: totalActivated,
total_expired: totalExpired,
}
}
license_charge_transactions.forEach(
({ _count, activation_expires_at, purchased_count }) => {
const status = prepareData(
_count.licenses,
activation_expires_at,
purchased_count,
)
licenses_status.total_purchased += status.total_purchased
licenses_status.total_activated += status.total_activated
licenses_status.total_expired += status.total_expired
},
)
account_quota_charge_transactions.forEach(
({ _count, activation_expires_at, purchased_count }) => {
const status = prepareData(_count.credits, activation_expires_at, purchased_count)
account_quotas_status.total_purchased += status.total_purchased
account_quotas_status.total_activated += status.total_activated
account_quotas_status.total_expired += status.total_expired
},
)
license_renew_charge_transactions.forEach(
({ _count, activation_expires_at, purchased_count }) => {
const status = prepareData(
_count.license_renews,
activation_expires_at,
purchased_count,
)
license_renews_status.total_purchased += status.total_purchased
license_renews_status.total_activated += status.total_activated
license_renews_status.total_expired += status.total_expired
},
)
return ResponseMapper.single({
licenses_status,
license_renews_status,
account_quotas_status,
...partnerInfo,
})
}
async updateInfo(partner_id: string, data: UpdatePartnerProfileDto) {
@@ -0,0 +1,97 @@
import { BadRequestException } from '@nestjs/common'
type PartnerBusinessActivityAllocationClient = {
licenseActivation: {
findFirst: (args: any) => Promise<any>
}
}
type GetPartnerBusinessActivityAllocationLimitsParams = {
partner_id: string
business_activity_id: string
referenceDate?: Date
}
export type PartnerBusinessActivityAllocationLimits = {
activation_id: string
total_credits: number
allocated_credits: number
remaining_credits: number
}
export const getPartnerBusinessActivityAllocationLimits = async (
prisma: PartnerBusinessActivityAllocationClient,
params: GetPartnerBusinessActivityAllocationLimitsParams,
): Promise<PartnerBusinessActivityAllocationLimits> => {
const { partner_id, business_activity_id, referenceDate = new Date() } = params
const startOfDay = new Date(referenceDate)
startOfDay.setHours(0, 0, 0, 0)
const activation = await prisma.licenseActivation.findFirst({
where: {
business_activity_id,
business_activity: {
consumer: {
partner_id,
},
},
OR: [
{
expires_at: {
gte: startOfDay,
},
},
{
license_renews: {
some: {
expires_at: {
gte: startOfDay,
},
},
},
},
],
},
select: {
id: true,
account_allocations: {
select: {
id: true,
account_id: true,
},
},
},
})
if (!activation) {
throw new BadRequestException('لایسنس فعال برای این فعالیت تجاری یافت نشد.')
}
const totalCredits = activation.account_allocations.length
const allocatedCredits = activation.account_allocations.filter(
account_allocation => account_allocation.account_id,
).length
return {
activation_id: activation.id,
total_credits: totalCredits,
allocated_credits: allocatedCredits,
remaining_credits: totalCredits - allocatedCredits,
}
}
export const ensurePartnerBusinessActivityHasRemainingAllocation = async (
prisma: PartnerBusinessActivityAllocationClient,
params: GetPartnerBusinessActivityAllocationLimitsParams,
) => {
const quota = await getPartnerBusinessActivityAllocationLimits(prisma, params)
if (quota.remaining_credits <= 0) {
throw new BadRequestException(
'محدودیت تخصیص حساب برای این فعالیت تجاری به پایان رسیده است.',
)
}
return quota
}
@@ -0,0 +1,94 @@
import { BadRequestException } from '@nestjs/common'
type PartnerRemainingLicensesClient = {
license: {
count: (args: any) => Promise<number>
findFirst: (args: any) => Promise<any>
}
}
type GetPartnerRemainingLicensesParams = {
partner_id: string
referenceDate?: Date
}
export const getPartnerRemainingLicenses = async (
prisma: PartnerRemainingLicensesClient,
params: GetPartnerRemainingLicensesParams,
) => {
const { partner_id, referenceDate = new Date() } = params
const startOfDay = new Date(referenceDate)
startOfDay.setHours(0, 0, 0, 0)
const remaining_count = await prisma.license.count({
where: {
activation: null,
charge_transaction: {
partner_id,
activation_expires_at: {
gte: startOfDay,
},
},
},
})
return {
remaining_count,
}
}
export const getPartnerFirstRemainingLicense = async (
prisma: PartnerRemainingLicensesClient,
params: GetPartnerRemainingLicensesParams,
) => {
const { partner_id, referenceDate = new Date() } = params
const startOfDay = new Date(referenceDate)
startOfDay.setHours(0, 0, 0, 0)
const license = await prisma.license.findFirst({
where: {
activation: null,
charge_transaction: {
partner_id,
activation_expires_at: {
gte: startOfDay,
},
},
},
orderBy: {
charge_transaction: {
activation_expires_at: 'asc',
},
},
select: {
id: true,
charge_transaction_id: true,
accounts_limit: true,
},
})
if (!license) {
throw new BadRequestException(
'لایسنس فعال و استفاده نشده برای این شریک تجاری وجود ندارد.',
)
}
return license
}
export const ensurePartnerHasRemainingLicense = async (
prisma: PartnerRemainingLicensesClient,
params: GetPartnerRemainingLicensesParams,
) => {
const quota = await getPartnerRemainingLicenses(prisma, params)
if (quota.remaining_count <= 0) {
throw new BadRequestException(
'لایسنس فعال و استفاده نشده برای این شریک تجاری وجود ندارد.',
)
}
return quota
}