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:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user