update license structures and setup file storage services
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE `goods` ADD COLUMN `image_url` VARCHAR(255) NULL;
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `consumer_id` on the `licenses` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `expires_at` on the `licenses` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `starts_at` on the `licenses` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `status` on the `licenses` table. All the data in the column will be lost.
|
||||
- A unique constraint covering the columns `[activated_license_id]` on the table `consumers` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `activation_expires_at` to the `licenses` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `charged_license_transaction_id` to the `licenses` table without a default value. This is not possible if the table is not empty.
|
||||
- Made the column `partner_id` on table `licenses` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `licenses` DROP FOREIGN KEY `licenses_consumer_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `licenses` DROP FOREIGN KEY `licenses_partner_id_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `licenses_consumer_id_key` ON `licenses`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `licenses_partner_id_fkey` ON `licenses`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `consumers` ADD COLUMN `activated_license_id` VARCHAR(191) NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `licenses` DROP COLUMN `consumer_id`,
|
||||
DROP COLUMN `expires_at`,
|
||||
DROP COLUMN `starts_at`,
|
||||
DROP COLUMN `status`,
|
||||
ADD COLUMN `activation_expires_at` DATETIME(3) NOT NULL,
|
||||
ADD COLUMN `charged_license_transaction_id` VARCHAR(191) NOT NULL,
|
||||
MODIFY `partner_id` VARCHAR(191) NOT NULL;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `activated_licenses` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`starts_at` DATETIME(3) NOT NULL,
|
||||
`expires_at` DATETIME(3) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`license_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `activated_licenses_id_key`(`id`),
|
||||
UNIQUE INDEX `activated_licenses_license_id_key`(`license_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `charged_license_transactions` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `consumers_activated_license_id_key` ON `consumers`(`activated_license_id`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `consumers` ADD CONSTRAINT `consumers_activated_license_id_fkey` FOREIGN KEY (`activated_license_id`) REFERENCES `activated_licenses`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `licenses` ADD CONSTRAINT `licenses_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `licenses` ADD CONSTRAINT `licenses_charged_license_transaction_id_fkey` FOREIGN KEY (`charged_license_transaction_id`) REFERENCES `charged_license_transactions`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `activated_licenses` ADD CONSTRAINT `activated_licenses_license_id_fkey` FOREIGN KEY (`license_id`) REFERENCES `licenses`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `charged_license_transactions` ADD CONSTRAINT `charged_license_transactions_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `activated_license_id` on the `consumers` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `activation_expires_at` on the `licenses` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `partner_id` on the `licenses` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `license_quota` on the `partners` table. All the data in the column will be lost.
|
||||
- Added the required column `consumer_id` to the `activated_licenses` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `activation_expires_at` to the `charged_license_transactions` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `consumers` DROP FOREIGN KEY `consumers_activated_license_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `licenses` DROP FOREIGN KEY `licenses_partner_id_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `consumers_activated_license_id_key` ON `consumers`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `licenses_partner_id_fkey` ON `licenses`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `activated_licenses` ADD COLUMN `consumer_id` VARCHAR(191) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `charged_license_transactions` ADD COLUMN `activation_expires_at` DATETIME(3) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `consumers` DROP COLUMN `activated_license_id`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `licenses` DROP COLUMN `activation_expires_at`,
|
||||
DROP COLUMN `partner_id`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `partners` DROP COLUMN `license_quota`;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `activated_licenses` ADD CONSTRAINT `activated_licenses_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -29,8 +29,7 @@ model Consumer {
|
||||
|
||||
consumer_accounts ConsumerAccount[]
|
||||
business_activities BusinessActivity[]
|
||||
|
||||
license License? @relation()
|
||||
activated_licenses ActivatedLicense[]
|
||||
|
||||
@@map("consumers")
|
||||
}
|
||||
|
||||
@@ -1,17 +1,45 @@
|
||||
model License {
|
||||
id String @id @default(uuid())
|
||||
starts_at DateTime
|
||||
expires_at DateTime
|
||||
status LicenseStatus
|
||||
id String @id @default(uuid())
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt() @db.Timestamp(0)
|
||||
|
||||
partner_id String?
|
||||
partner Partner? @relation(fields: [partner_id], references: [id])
|
||||
charged_license_transaction_id String
|
||||
charged_license_transaction ChargedLicenseTransactions @relation(fields: [charged_license_transaction_id], references: [id])
|
||||
|
||||
consumer_id String @unique
|
||||
consumer Consumer @relation(fields: [consumer_id], references: [id])
|
||||
activated_license ActivatedLicense?
|
||||
|
||||
@@map("licenses")
|
||||
}
|
||||
|
||||
model ActivatedLicense {
|
||||
id String @id @unique() @default(uuid())
|
||||
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])
|
||||
|
||||
consumer_id String
|
||||
consumer Consumer @relation(fields: [consumer_id], references: [id])
|
||||
|
||||
@@map("activated_licenses")
|
||||
}
|
||||
|
||||
model ChargedLicenseTransactions {
|
||||
id String @id @default(uuid())
|
||||
activation_expires_at DateTime
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt() @db.Timestamp(0)
|
||||
|
||||
partner_id String
|
||||
partner Partner @relation(fields: [partner_id], references: [id])
|
||||
|
||||
licenses License[]
|
||||
|
||||
@@map("charged_license_transactions")
|
||||
}
|
||||
|
||||
@@ -15,17 +15,16 @@ model PartnerAccount {
|
||||
}
|
||||
|
||||
model Partner {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
code String @unique()
|
||||
license_quota Int? @default(0)
|
||||
status PartnerStatus @default(ACTIVE)
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
code String @unique()
|
||||
status PartnerStatus @default(ACTIVE)
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(0)
|
||||
|
||||
licenses License[]
|
||||
partner_accounts PartnerAccount[]
|
||||
partner_accounts PartnerAccount[]
|
||||
chargedLicenseTransactions ChargedLicenseTransactions[]
|
||||
|
||||
@@map("partners")
|
||||
}
|
||||
|
||||
@@ -9,9 +9,11 @@ model Good {
|
||||
local_sku String? @unique() @db.VarChar(100)
|
||||
barcode String? @unique() @db.VarChar(100)
|
||||
base_sale_price Decimal? @default(0.00) @db.Decimal(15, 0)
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt @db.Timestamp(0)
|
||||
deleted_at DateTime? @db.Timestamp(0)
|
||||
image_url String? @db.VarChar(255)
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt @db.Timestamp(0)
|
||||
deleted_at DateTime? @db.Timestamp(0)
|
||||
|
||||
complex_id String?
|
||||
category_id String?
|
||||
|
||||
+43
-3
@@ -293,13 +293,12 @@ async function main() {
|
||||
// ****************** BA Start ****************** //
|
||||
|
||||
// ****************** partner Start ****************** //
|
||||
const partner = await prisma.partner.count()
|
||||
let partner = await prisma.partner.findFirst()
|
||||
if (!partner) {
|
||||
await prisma.partner.create({
|
||||
partner = await prisma.partner.create({
|
||||
data: {
|
||||
name: 'تیس',
|
||||
code: 'TIS',
|
||||
license_quota: 5,
|
||||
status: 'ACTIVE',
|
||||
partner_accounts: {
|
||||
create: {
|
||||
@@ -317,6 +316,47 @@ async function main() {
|
||||
},
|
||||
})
|
||||
}
|
||||
if (partner) {
|
||||
await prisma.$transaction(async tx => {
|
||||
const startOfToday = new Date()
|
||||
startOfToday.setHours(0, 0, 0, 0)
|
||||
|
||||
const month = startOfToday.getMonth()
|
||||
let year = startOfToday.getFullYear()
|
||||
let expMonth = month + 3
|
||||
if (expMonth > 11) {
|
||||
expMonth = expMonth - 11
|
||||
year = year + 1
|
||||
}
|
||||
|
||||
startOfToday.setFullYear(year)
|
||||
startOfToday.setMonth(expMonth)
|
||||
|
||||
const transaction = await tx.chargedLicenseTransactions.create({
|
||||
data: {
|
||||
activation_expires_at: startOfToday,
|
||||
partner: {
|
||||
connect: {
|
||||
id: partner.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
})
|
||||
if (transaction)
|
||||
await tx.license.create({
|
||||
data: {
|
||||
charged_license_transaction: {
|
||||
connect: {
|
||||
id: transaction.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// ****************** provider Start ****************** //
|
||||
const provider = await prisma.provider.count()
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import { PosModule } from './modules/pos/pos.module'
|
||||
import { SalesInvoiceItemsModule } from './modules/pos/sales-invoices/sales-invoice-items/sales-invoice-items.module'
|
||||
import { SalesInvoicePaymentsModule } from './modules/pos/sales-invoices/sales-invoice-payments/sales-invoice-payments.module'
|
||||
import { TriggerLogsModule } from './modules/trigger-logs/trigger-logs.module'
|
||||
import { UploaderModule } from './modules/uploaders/uploader.module'
|
||||
import { UploaderModule } from './modules/uploader/uploader.module'
|
||||
import { PrismaModule } from './prisma/prisma.module'
|
||||
|
||||
@Module({
|
||||
|
||||
@@ -16,3 +16,10 @@ export enum GoldKarat {
|
||||
KARAT_21 = '21',
|
||||
KARAT_24 = '24',
|
||||
}
|
||||
|
||||
export const UploadedFileTypes = {
|
||||
GOOD: 'good',
|
||||
SERVICE: 'service',
|
||||
PROFILE_AVATAR: 'profile_avatar',
|
||||
}
|
||||
export type UploadedFileTypes = (typeof UploadedFileTypes)[keyof typeof UploadedFileTypes]
|
||||
|
||||
@@ -39,7 +39,7 @@ export class ConsumerGuard {
|
||||
role: true,
|
||||
},
|
||||
},
|
||||
license: {
|
||||
activated_licenses: {
|
||||
select: {
|
||||
expires_at: true,
|
||||
},
|
||||
@@ -54,10 +54,14 @@ export class ConsumerGuard {
|
||||
const req = context.switchToHttp().getRequest<ExpressRequest>()
|
||||
|
||||
if (req.method !== 'GET') {
|
||||
if (!consumer.license?.expires_at) {
|
||||
if (!consumer.activated_licenses) {
|
||||
throw new ForbiddenException('برای کاربر شما لایسنس ایجاد نشده است.')
|
||||
}
|
||||
if (new Date().getTime() > new Date(consumer.license?.expires_at).getTime()) {
|
||||
if (
|
||||
consumer.activated_licenses.every(
|
||||
license => new Date().getTime() > new Date(license?.expires_at).getTime(),
|
||||
)
|
||||
) {
|
||||
throw new ForbiddenException('لایسنس شما منقضی شده است.')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ export class PosGuard {
|
||||
return false
|
||||
}
|
||||
|
||||
const startOfToday = new Date()
|
||||
startOfToday.setHours(0, 0, 0, 0)
|
||||
|
||||
const pos = await this.prisma.pos.findUnique({
|
||||
where: {
|
||||
id: posId,
|
||||
@@ -44,7 +47,20 @@ export class PosGuard {
|
||||
complex: {
|
||||
select: {
|
||||
id: true,
|
||||
business_activity_id: true,
|
||||
business_activity: {
|
||||
select: {
|
||||
id: true,
|
||||
consumer: {
|
||||
select: {
|
||||
activated_licenses: {
|
||||
select: {
|
||||
expires_at: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -54,6 +70,19 @@ export class PosGuard {
|
||||
throw new ForbiddenException('شما دسترسی لازم را ندارید.')
|
||||
}
|
||||
|
||||
if (req.method !== 'GET') {
|
||||
if (!pos.complex.business_activity.consumer.activated_licenses.length) {
|
||||
throw new ForbiddenException('برای کاربر شما لایسنس ایجاد نشده است.')
|
||||
}
|
||||
if (
|
||||
pos.complex.business_activity.consumer.activated_licenses.every(
|
||||
license => new Date().getTime() > new Date(license?.expires_at).getTime(),
|
||||
)
|
||||
) {
|
||||
throw new ForbiddenException('لایسنس شما منقضی شده است.')
|
||||
}
|
||||
}
|
||||
|
||||
const foundedAccount = await this.prisma.consumerAccount.findUnique({
|
||||
where: {
|
||||
id: tokenPayload.account_id,
|
||||
@@ -88,14 +117,12 @@ export class PosGuard {
|
||||
}
|
||||
if (
|
||||
accountPermissions?.business_permissions.some(
|
||||
p => p.business_id === pos.complex.business_activity_id,
|
||||
p => p.business_id === pos.complex.business_activity.id,
|
||||
)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
throw new ForbiddenException('شما دسترسی لازم را ندارید.')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { ITokenPayload } from '@/modules/auth/auth.utils'
|
||||
import {
|
||||
CanActivate,
|
||||
ExecutionContext,
|
||||
ForbiddenException,
|
||||
Injectable,
|
||||
UnauthorizedException,
|
||||
} from '@nestjs/common'
|
||||
@@ -63,14 +64,15 @@ export class JwtAuthGuard implements CanActivate {
|
||||
// if (req.url.startsWith('/api/v1/partner')) {
|
||||
// await this.partnerGuard.canActivate(tokenPayload, context)
|
||||
// }
|
||||
// if (req.url.startsWith('/api/v1/consumer')) {
|
||||
// await this.consumerGuard.canActivate(tokenPayload, context)
|
||||
// } else if (req.url.startsWith('/api/v1/pos')) {
|
||||
// // await this.consumerGuard.canActivate(tokenPayload, context)
|
||||
// await this.posGuard.canActivate(tokenPayload, context)
|
||||
// } else if (tokenPayload.type != 'ADMIN') {
|
||||
// throw new ForbiddenException('شما دسترسی لازم را ندارید')
|
||||
// }
|
||||
if (req.url.startsWith('/api/v1/consumer')) {
|
||||
await this.consumerGuard.canActivate(tokenPayload, context)
|
||||
} else if (req.url.startsWith('/api/v1/pos')) {
|
||||
// await this.consumerGuard.canActivate(tokenPayload, context)
|
||||
// await this.consumerGuard.canActivate(tokenPayload, context)
|
||||
await this.posGuard.canActivate(tokenPayload, context)
|
||||
} else if (tokenPayload.type != 'ADMIN') {
|
||||
throw new ForbiddenException('شما دسترسی لازم را ندارید')
|
||||
}
|
||||
return true
|
||||
} catch (err) {
|
||||
if (err) throw err
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export * from './consumerPayload.model'
|
||||
export * from './posPayload.model'
|
||||
export * from './tokenPayload.model'
|
||||
export * from './uploadedFileTypes.model'
|
||||
export * from './uploadFile.model'
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { UploadedFileTypes } from '@/common/enums/enums'
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import { IsEnum } from 'class-validator'
|
||||
|
||||
export class UploadImageDto {
|
||||
@ApiProperty({
|
||||
enum: UploadedFileTypes,
|
||||
example: UploadedFileTypes.GOOD,
|
||||
})
|
||||
@IsEnum(UploadedFileTypes)
|
||||
type: UploadedFileTypes
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export type TUploadedFileTypes = 'good' | 'service' | 'profile_avatar'
|
||||
@@ -72,6 +72,16 @@ export type Device = Prisma.DeviceModel
|
||||
*
|
||||
*/
|
||||
export type License = Prisma.LicenseModel
|
||||
/**
|
||||
* Model ActivatedLicense
|
||||
*
|
||||
*/
|
||||
export type ActivatedLicense = Prisma.ActivatedLicenseModel
|
||||
/**
|
||||
* Model ChargedLicenseTransactions
|
||||
*
|
||||
*/
|
||||
export type ChargedLicenseTransactions = Prisma.ChargedLicenseTransactionsModel
|
||||
/**
|
||||
* Model PartnerAccount
|
||||
*
|
||||
|
||||
@@ -92,6 +92,16 @@ export type Device = Prisma.DeviceModel
|
||||
*
|
||||
*/
|
||||
export type License = Prisma.LicenseModel
|
||||
/**
|
||||
* Model ActivatedLicense
|
||||
*
|
||||
*/
|
||||
export type ActivatedLicense = Prisma.ActivatedLicenseModel
|
||||
/**
|
||||
* Model ChargedLicenseTransactions
|
||||
*
|
||||
*/
|
||||
export type ChargedLicenseTransactions = Prisma.ChargedLicenseTransactionsModel
|
||||
/**
|
||||
* Model PartnerAccount
|
||||
*
|
||||
|
||||
@@ -212,23 +212,6 @@ export type EnumPOSTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedEnumPOSTypeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type EnumLicenseStatusFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.LicenseStatus | Prisma.EnumLicenseStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.LicenseStatus[]
|
||||
notIn?: $Enums.LicenseStatus[]
|
||||
not?: Prisma.NestedEnumLicenseStatusFilter<$PrismaModel> | $Enums.LicenseStatus
|
||||
}
|
||||
|
||||
export type EnumLicenseStatusWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.LicenseStatus | Prisma.EnumLicenseStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.LicenseStatus[]
|
||||
notIn?: $Enums.LicenseStatus[]
|
||||
not?: Prisma.NestedEnumLicenseStatusWithAggregatesFilter<$PrismaModel> | $Enums.LicenseStatus
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedEnumLicenseStatusFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedEnumLicenseStatusFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type EnumPartnerRoleFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.PartnerRole | Prisma.EnumPartnerRoleFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.PartnerRole[]
|
||||
@@ -246,17 +229,6 @@ export type EnumPartnerRoleWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedEnumPartnerRoleFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type IntNullableFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null
|
||||
}
|
||||
|
||||
export type EnumPartnerStatusFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.PartnerStatus | Prisma.EnumPartnerStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.PartnerStatus[]
|
||||
@@ -264,22 +236,6 @@ export type EnumPartnerStatusFilter<$PrismaModel = never> = {
|
||||
not?: Prisma.NestedEnumPartnerStatusFilter<$PrismaModel> | $Enums.PartnerStatus
|
||||
}
|
||||
|
||||
export type IntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatNullableFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type EnumPartnerStatusWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.PartnerStatus | Prisma.EnumPartnerStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.PartnerStatus[]
|
||||
@@ -824,23 +780,6 @@ export type NestedEnumPOSTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedEnumPOSTypeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedEnumLicenseStatusFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.LicenseStatus | Prisma.EnumLicenseStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.LicenseStatus[]
|
||||
notIn?: $Enums.LicenseStatus[]
|
||||
not?: Prisma.NestedEnumLicenseStatusFilter<$PrismaModel> | $Enums.LicenseStatus
|
||||
}
|
||||
|
||||
export type NestedEnumLicenseStatusWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.LicenseStatus | Prisma.EnumLicenseStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.LicenseStatus[]
|
||||
notIn?: $Enums.LicenseStatus[]
|
||||
not?: Prisma.NestedEnumLicenseStatusWithAggregatesFilter<$PrismaModel> | $Enums.LicenseStatus
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedEnumLicenseStatusFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedEnumLicenseStatusFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedEnumPartnerRoleFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.PartnerRole | Prisma.EnumPartnerRoleFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.PartnerRole[]
|
||||
@@ -865,33 +804,6 @@ export type NestedEnumPartnerStatusFilter<$PrismaModel = never> = {
|
||||
not?: Prisma.NestedEnumPartnerStatusFilter<$PrismaModel> | $Enums.PartnerStatus
|
||||
}
|
||||
|
||||
export type NestedIntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.IntFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatNullableFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedFloatNullableFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | null
|
||||
notIn?: number[] | null
|
||||
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedFloatNullableFilter<$PrismaModel> | number | null
|
||||
}
|
||||
|
||||
export type NestedEnumPartnerStatusWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.PartnerStatus | Prisma.EnumPartnerStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.PartnerStatus[]
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -395,6 +395,8 @@ export const ModelName = {
|
||||
DeviceBrand: 'DeviceBrand',
|
||||
Device: 'Device',
|
||||
License: 'License',
|
||||
ActivatedLicense: 'ActivatedLicense',
|
||||
ChargedLicenseTransactions: 'ChargedLicenseTransactions',
|
||||
PartnerAccount: 'PartnerAccount',
|
||||
Partner: 'Partner',
|
||||
PermissionConsumer: 'PermissionConsumer',
|
||||
@@ -431,7 +433,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" | "partnerAccount" | "partner" | "permissionConsumer" | "permissionPos" | "permissionComplex" | "permissionBusiness" | "providerAccount" | "provider" | "triggerLog" | "userDevices" | "customer" | "customerIndividual" | "customerLegal" | "good" | "goodCategory" | "guild" | "salesInvoice" | "salesInvoiceItem" | "salesInvoicePayment" | "service" | "serviceCategory"
|
||||
modelProps: "adminAccount" | "admin" | "account" | "consumerAccount" | "consumer" | "businessActivity" | "complex" | "pos" | "deviceBrand" | "device" | "license" | "activatedLicense" | "chargedLicenseTransactions" | "partnerAccount" | "partner" | "permissionConsumer" | "permissionPos" | "permissionComplex" | "permissionBusiness" | "providerAccount" | "provider" | "triggerLog" | "userDevices" | "customer" | "customerIndividual" | "customerLegal" | "good" | "goodCategory" | "guild" | "salesInvoice" | "salesInvoiceItem" | "salesInvoicePayment" | "service" | "serviceCategory"
|
||||
txIsolationLevel: TransactionIsolationLevel
|
||||
}
|
||||
model: {
|
||||
@@ -1161,6 +1163,138 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
ActivatedLicense: {
|
||||
payload: Prisma.$ActivatedLicensePayload<ExtArgs>
|
||||
fields: Prisma.ActivatedLicenseFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.ActivatedLicenseFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ActivatedLicensePayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.ActivatedLicenseFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ActivatedLicensePayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.ActivatedLicenseFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ActivatedLicensePayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.ActivatedLicenseFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ActivatedLicensePayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.ActivatedLicenseFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ActivatedLicensePayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.ActivatedLicenseCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ActivatedLicensePayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.ActivatedLicenseCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.ActivatedLicenseDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ActivatedLicensePayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.ActivatedLicenseUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ActivatedLicensePayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.ActivatedLicenseDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.ActivatedLicenseUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.ActivatedLicenseUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ActivatedLicensePayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.ActivatedLicenseAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateActivatedLicense>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.ActivatedLicenseGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ActivatedLicenseGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.ActivatedLicenseCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ActivatedLicenseCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
ChargedLicenseTransactions: {
|
||||
payload: Prisma.$ChargedLicenseTransactionsPayload<ExtArgs>
|
||||
fields: Prisma.ChargedLicenseTransactionsFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.ChargedLicenseTransactionsFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ChargedLicenseTransactionsPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.ChargedLicenseTransactionsFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ChargedLicenseTransactionsPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.ChargedLicenseTransactionsFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ChargedLicenseTransactionsPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.ChargedLicenseTransactionsFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ChargedLicenseTransactionsPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.ChargedLicenseTransactionsFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ChargedLicenseTransactionsPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.ChargedLicenseTransactionsCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ChargedLicenseTransactionsPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.ChargedLicenseTransactionsCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.ChargedLicenseTransactionsDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ChargedLicenseTransactionsPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.ChargedLicenseTransactionsUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ChargedLicenseTransactionsPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.ChargedLicenseTransactionsDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.ChargedLicenseTransactionsUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.ChargedLicenseTransactionsUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$ChargedLicenseTransactionsPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.ChargedLicenseTransactionsAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateChargedLicenseTransactions>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.ChargedLicenseTransactionsGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ChargedLicenseTransactionsGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.ChargedLicenseTransactionsCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.ChargedLicenseTransactionsCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
PartnerAccount: {
|
||||
payload: Prisma.$PartnerAccountPayload<ExtArgs>
|
||||
fields: Prisma.PartnerAccountFieldRefs
|
||||
@@ -2712,18 +2846,38 @@ export type DeviceScalarFieldEnum = (typeof DeviceScalarFieldEnum)[keyof typeof
|
||||
|
||||
export const LicenseScalarFieldEnum = {
|
||||
id: 'id',
|
||||
starts_at: 'starts_at',
|
||||
expires_at: 'expires_at',
|
||||
status: 'status',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
partner_id: 'partner_id',
|
||||
consumer_id: 'consumer_id'
|
||||
charged_license_transaction_id: 'charged_license_transaction_id'
|
||||
} as const
|
||||
|
||||
export type LicenseScalarFieldEnum = (typeof LicenseScalarFieldEnum)[keyof typeof LicenseScalarFieldEnum]
|
||||
|
||||
|
||||
export const ActivatedLicenseScalarFieldEnum = {
|
||||
id: 'id',
|
||||
starts_at: 'starts_at',
|
||||
expires_at: 'expires_at',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
license_id: 'license_id',
|
||||
consumer_id: 'consumer_id'
|
||||
} as const
|
||||
|
||||
export type ActivatedLicenseScalarFieldEnum = (typeof ActivatedLicenseScalarFieldEnum)[keyof typeof ActivatedLicenseScalarFieldEnum]
|
||||
|
||||
|
||||
export const ChargedLicenseTransactionsScalarFieldEnum = {
|
||||
id: 'id',
|
||||
activation_expires_at: 'activation_expires_at',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
partner_id: 'partner_id'
|
||||
} as const
|
||||
|
||||
export type ChargedLicenseTransactionsScalarFieldEnum = (typeof ChargedLicenseTransactionsScalarFieldEnum)[keyof typeof ChargedLicenseTransactionsScalarFieldEnum]
|
||||
|
||||
|
||||
export const PartnerAccountScalarFieldEnum = {
|
||||
id: 'id',
|
||||
role: 'role',
|
||||
@@ -2740,7 +2894,6 @@ export const PartnerScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
code: 'code',
|
||||
license_quota: 'license_quota',
|
||||
status: 'status',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at'
|
||||
@@ -2889,6 +3042,7 @@ export const GoodScalarFieldEnum = {
|
||||
local_sku: 'local_sku',
|
||||
barcode: 'barcode',
|
||||
base_sale_price: 'base_sale_price',
|
||||
image_url: 'image_url',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
deleted_at: 'deleted_at',
|
||||
@@ -3133,13 +3287,29 @@ export type DeviceOrderByRelevanceFieldEnum = (typeof DeviceOrderByRelevanceFiel
|
||||
|
||||
export const LicenseOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
partner_id: 'partner_id',
|
||||
consumer_id: 'consumer_id'
|
||||
charged_license_transaction_id: 'charged_license_transaction_id'
|
||||
} as const
|
||||
|
||||
export type LicenseOrderByRelevanceFieldEnum = (typeof LicenseOrderByRelevanceFieldEnum)[keyof typeof LicenseOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ActivatedLicenseOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
license_id: 'license_id',
|
||||
consumer_id: 'consumer_id'
|
||||
} as const
|
||||
|
||||
export type ActivatedLicenseOrderByRelevanceFieldEnum = (typeof ActivatedLicenseOrderByRelevanceFieldEnum)[keyof typeof ActivatedLicenseOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ChargedLicenseTransactionsOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
partner_id: 'partner_id'
|
||||
} as const
|
||||
|
||||
export type ChargedLicenseTransactionsOrderByRelevanceFieldEnum = (typeof ChargedLicenseTransactionsOrderByRelevanceFieldEnum)[keyof typeof ChargedLicenseTransactionsOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const PartnerAccountOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
partner_id: 'partner_id',
|
||||
@@ -3294,6 +3464,7 @@ export const GoodOrderByRelevanceFieldEnum = {
|
||||
description: 'description',
|
||||
local_sku: 'local_sku',
|
||||
barcode: 'barcode',
|
||||
image_url: 'image_url',
|
||||
complex_id: 'complex_id',
|
||||
category_id: 'category_id'
|
||||
} as const
|
||||
@@ -3442,13 +3613,6 @@ export type EnumPOSTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaMo
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'LicenseStatus'
|
||||
*/
|
||||
export type EnumLicenseStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'LicenseStatus'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'PartnerRole'
|
||||
*/
|
||||
@@ -3456,13 +3620,6 @@ export type EnumPartnerRoleFieldRefInput<$PrismaModel> = FieldRefInputType<$Pris
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Int'
|
||||
*/
|
||||
export type IntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'PartnerStatus'
|
||||
*/
|
||||
@@ -3498,6 +3655,13 @@ export type EnumProviderRoleFieldRefInput<$PrismaModel> = FieldRefInputType<$Pri
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Int'
|
||||
*/
|
||||
export type IntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Boolean'
|
||||
*/
|
||||
@@ -3666,6 +3830,8 @@ export type GlobalOmitConfig = {
|
||||
deviceBrand?: Prisma.DeviceBrandOmit
|
||||
device?: Prisma.DeviceOmit
|
||||
license?: Prisma.LicenseOmit
|
||||
activatedLicense?: Prisma.ActivatedLicenseOmit
|
||||
chargedLicenseTransactions?: Prisma.ChargedLicenseTransactionsOmit
|
||||
partnerAccount?: Prisma.PartnerAccountOmit
|
||||
partner?: Prisma.PartnerOmit
|
||||
permissionConsumer?: Prisma.PermissionConsumerOmit
|
||||
|
||||
@@ -62,6 +62,8 @@ export const ModelName = {
|
||||
DeviceBrand: 'DeviceBrand',
|
||||
Device: 'Device',
|
||||
License: 'License',
|
||||
ActivatedLicense: 'ActivatedLicense',
|
||||
ChargedLicenseTransactions: 'ChargedLicenseTransactions',
|
||||
PartnerAccount: 'PartnerAccount',
|
||||
Partner: 'Partner',
|
||||
PermissionConsumer: 'PermissionConsumer',
|
||||
@@ -227,18 +229,38 @@ export type DeviceScalarFieldEnum = (typeof DeviceScalarFieldEnum)[keyof typeof
|
||||
|
||||
export const LicenseScalarFieldEnum = {
|
||||
id: 'id',
|
||||
starts_at: 'starts_at',
|
||||
expires_at: 'expires_at',
|
||||
status: 'status',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
partner_id: 'partner_id',
|
||||
consumer_id: 'consumer_id'
|
||||
charged_license_transaction_id: 'charged_license_transaction_id'
|
||||
} as const
|
||||
|
||||
export type LicenseScalarFieldEnum = (typeof LicenseScalarFieldEnum)[keyof typeof LicenseScalarFieldEnum]
|
||||
|
||||
|
||||
export const ActivatedLicenseScalarFieldEnum = {
|
||||
id: 'id',
|
||||
starts_at: 'starts_at',
|
||||
expires_at: 'expires_at',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
license_id: 'license_id',
|
||||
consumer_id: 'consumer_id'
|
||||
} as const
|
||||
|
||||
export type ActivatedLicenseScalarFieldEnum = (typeof ActivatedLicenseScalarFieldEnum)[keyof typeof ActivatedLicenseScalarFieldEnum]
|
||||
|
||||
|
||||
export const ChargedLicenseTransactionsScalarFieldEnum = {
|
||||
id: 'id',
|
||||
activation_expires_at: 'activation_expires_at',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
partner_id: 'partner_id'
|
||||
} as const
|
||||
|
||||
export type ChargedLicenseTransactionsScalarFieldEnum = (typeof ChargedLicenseTransactionsScalarFieldEnum)[keyof typeof ChargedLicenseTransactionsScalarFieldEnum]
|
||||
|
||||
|
||||
export const PartnerAccountScalarFieldEnum = {
|
||||
id: 'id',
|
||||
role: 'role',
|
||||
@@ -255,7 +277,6 @@ export const PartnerScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
code: 'code',
|
||||
license_quota: 'license_quota',
|
||||
status: 'status',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at'
|
||||
@@ -404,6 +425,7 @@ export const GoodScalarFieldEnum = {
|
||||
local_sku: 'local_sku',
|
||||
barcode: 'barcode',
|
||||
base_sale_price: 'base_sale_price',
|
||||
image_url: 'image_url',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
deleted_at: 'deleted_at',
|
||||
@@ -648,13 +670,29 @@ export type DeviceOrderByRelevanceFieldEnum = (typeof DeviceOrderByRelevanceFiel
|
||||
|
||||
export const LicenseOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
partner_id: 'partner_id',
|
||||
consumer_id: 'consumer_id'
|
||||
charged_license_transaction_id: 'charged_license_transaction_id'
|
||||
} as const
|
||||
|
||||
export type LicenseOrderByRelevanceFieldEnum = (typeof LicenseOrderByRelevanceFieldEnum)[keyof typeof LicenseOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ActivatedLicenseOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
license_id: 'license_id',
|
||||
consumer_id: 'consumer_id'
|
||||
} as const
|
||||
|
||||
export type ActivatedLicenseOrderByRelevanceFieldEnum = (typeof ActivatedLicenseOrderByRelevanceFieldEnum)[keyof typeof ActivatedLicenseOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const ChargedLicenseTransactionsOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
partner_id: 'partner_id'
|
||||
} as const
|
||||
|
||||
export type ChargedLicenseTransactionsOrderByRelevanceFieldEnum = (typeof ChargedLicenseTransactionsOrderByRelevanceFieldEnum)[keyof typeof ChargedLicenseTransactionsOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const PartnerAccountOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
partner_id: 'partner_id',
|
||||
@@ -809,6 +847,7 @@ export const GoodOrderByRelevanceFieldEnum = {
|
||||
description: 'description',
|
||||
local_sku: 'local_sku',
|
||||
barcode: 'barcode',
|
||||
image_url: 'image_url',
|
||||
complex_id: 'complex_id',
|
||||
category_id: 'category_id'
|
||||
} as const
|
||||
|
||||
@@ -19,6 +19,8 @@ export type * from './models/Pos.js'
|
||||
export type * from './models/DeviceBrand.js'
|
||||
export type * from './models/Device.js'
|
||||
export type * from './models/License.js'
|
||||
export type * from './models/ActivatedLicense.js'
|
||||
export type * from './models/ChargedLicenseTransactions.js'
|
||||
export type * from './models/PartnerAccount.js'
|
||||
export type * from './models/Partner.js'
|
||||
export type * from './models/PermissionConsumer.js'
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -200,7 +200,7 @@ export type ConsumerWhereInput = {
|
||||
updated_at?: Prisma.DateTimeFilter<"Consumer"> | Date | string
|
||||
consumer_accounts?: Prisma.ConsumerAccountListRelationFilter
|
||||
business_activities?: Prisma.BusinessActivityListRelationFilter
|
||||
license?: Prisma.XOR<Prisma.LicenseNullableScalarRelationFilter, Prisma.LicenseWhereInput> | null
|
||||
activated_licenses?: Prisma.ActivatedLicenseListRelationFilter
|
||||
}
|
||||
|
||||
export type ConsumerOrderByWithRelationInput = {
|
||||
@@ -213,7 +213,7 @@ export type ConsumerOrderByWithRelationInput = {
|
||||
updated_at?: Prisma.SortOrder
|
||||
consumer_accounts?: Prisma.ConsumerAccountOrderByRelationAggregateInput
|
||||
business_activities?: Prisma.BusinessActivityOrderByRelationAggregateInput
|
||||
license?: Prisma.LicenseOrderByWithRelationInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseOrderByRelationAggregateInput
|
||||
_relevance?: Prisma.ConsumerOrderByRelevanceInput
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ export type ConsumerWhereUniqueInput = Prisma.AtLeast<{
|
||||
updated_at?: Prisma.DateTimeFilter<"Consumer"> | Date | string
|
||||
consumer_accounts?: Prisma.ConsumerAccountListRelationFilter
|
||||
business_activities?: Prisma.BusinessActivityListRelationFilter
|
||||
license?: Prisma.XOR<Prisma.LicenseNullableScalarRelationFilter, Prisma.LicenseWhereInput> | null
|
||||
activated_licenses?: Prisma.ActivatedLicenseListRelationFilter
|
||||
}, "id" | "mobile_number">
|
||||
|
||||
export type ConsumerOrderByWithAggregationInput = {
|
||||
@@ -269,7 +269,7 @@ export type ConsumerCreateInput = {
|
||||
updated_at?: Date | string
|
||||
consumer_accounts?: Prisma.ConsumerAccountCreateNestedManyWithoutConsumerInput
|
||||
business_activities?: Prisma.BusinessActivityCreateNestedManyWithoutConsumerInput
|
||||
license?: Prisma.LicenseCreateNestedOneWithoutConsumerInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseCreateNestedManyWithoutConsumerInput
|
||||
}
|
||||
|
||||
export type ConsumerUncheckedCreateInput = {
|
||||
@@ -282,7 +282,7 @@ export type ConsumerUncheckedCreateInput = {
|
||||
updated_at?: Date | string
|
||||
consumer_accounts?: Prisma.ConsumerAccountUncheckedCreateNestedManyWithoutConsumerInput
|
||||
business_activities?: Prisma.BusinessActivityUncheckedCreateNestedManyWithoutConsumerInput
|
||||
license?: Prisma.LicenseUncheckedCreateNestedOneWithoutConsumerInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseUncheckedCreateNestedManyWithoutConsumerInput
|
||||
}
|
||||
|
||||
export type ConsumerUpdateInput = {
|
||||
@@ -295,7 +295,7 @@ export type ConsumerUpdateInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer_accounts?: Prisma.ConsumerAccountUpdateManyWithoutConsumerNestedInput
|
||||
business_activities?: Prisma.BusinessActivityUpdateManyWithoutConsumerNestedInput
|
||||
license?: Prisma.LicenseUpdateOneWithoutConsumerNestedInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseUpdateManyWithoutConsumerNestedInput
|
||||
}
|
||||
|
||||
export type ConsumerUncheckedUpdateInput = {
|
||||
@@ -308,7 +308,7 @@ export type ConsumerUncheckedUpdateInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer_accounts?: Prisma.ConsumerAccountUncheckedUpdateManyWithoutConsumerNestedInput
|
||||
business_activities?: Prisma.BusinessActivityUncheckedUpdateManyWithoutConsumerNestedInput
|
||||
license?: Prisma.LicenseUncheckedUpdateOneWithoutConsumerNestedInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseUncheckedUpdateManyWithoutConsumerNestedInput
|
||||
}
|
||||
|
||||
export type ConsumerCreateManyInput = {
|
||||
@@ -414,18 +414,18 @@ export type ConsumerUpdateOneRequiredWithoutBusiness_activitiesNestedInput = {
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.ConsumerUpdateToOneWithWhereWithoutBusiness_activitiesInput, Prisma.ConsumerUpdateWithoutBusiness_activitiesInput>, Prisma.ConsumerUncheckedUpdateWithoutBusiness_activitiesInput>
|
||||
}
|
||||
|
||||
export type ConsumerCreateNestedOneWithoutLicenseInput = {
|
||||
create?: Prisma.XOR<Prisma.ConsumerCreateWithoutLicenseInput, Prisma.ConsumerUncheckedCreateWithoutLicenseInput>
|
||||
connectOrCreate?: Prisma.ConsumerCreateOrConnectWithoutLicenseInput
|
||||
export type ConsumerCreateNestedOneWithoutActivated_licensesInput = {
|
||||
create?: Prisma.XOR<Prisma.ConsumerCreateWithoutActivated_licensesInput, Prisma.ConsumerUncheckedCreateWithoutActivated_licensesInput>
|
||||
connectOrCreate?: Prisma.ConsumerCreateOrConnectWithoutActivated_licensesInput
|
||||
connect?: Prisma.ConsumerWhereUniqueInput
|
||||
}
|
||||
|
||||
export type ConsumerUpdateOneRequiredWithoutLicenseNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.ConsumerCreateWithoutLicenseInput, Prisma.ConsumerUncheckedCreateWithoutLicenseInput>
|
||||
connectOrCreate?: Prisma.ConsumerCreateOrConnectWithoutLicenseInput
|
||||
upsert?: Prisma.ConsumerUpsertWithoutLicenseInput
|
||||
export type ConsumerUpdateOneRequiredWithoutActivated_licensesNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.ConsumerCreateWithoutActivated_licensesInput, Prisma.ConsumerUncheckedCreateWithoutActivated_licensesInput>
|
||||
connectOrCreate?: Prisma.ConsumerCreateOrConnectWithoutActivated_licensesInput
|
||||
upsert?: Prisma.ConsumerUpsertWithoutActivated_licensesInput
|
||||
connect?: Prisma.ConsumerWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.ConsumerUpdateToOneWithWhereWithoutLicenseInput, Prisma.ConsumerUpdateWithoutLicenseInput>, Prisma.ConsumerUncheckedUpdateWithoutLicenseInput>
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.ConsumerUpdateToOneWithWhereWithoutActivated_licensesInput, Prisma.ConsumerUpdateWithoutActivated_licensesInput>, Prisma.ConsumerUncheckedUpdateWithoutActivated_licensesInput>
|
||||
}
|
||||
|
||||
export type ConsumerCreateWithoutConsumer_accountsInput = {
|
||||
@@ -437,7 +437,7 @@ export type ConsumerCreateWithoutConsumer_accountsInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
business_activities?: Prisma.BusinessActivityCreateNestedManyWithoutConsumerInput
|
||||
license?: Prisma.LicenseCreateNestedOneWithoutConsumerInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseCreateNestedManyWithoutConsumerInput
|
||||
}
|
||||
|
||||
export type ConsumerUncheckedCreateWithoutConsumer_accountsInput = {
|
||||
@@ -449,7 +449,7 @@ export type ConsumerUncheckedCreateWithoutConsumer_accountsInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
business_activities?: Prisma.BusinessActivityUncheckedCreateNestedManyWithoutConsumerInput
|
||||
license?: Prisma.LicenseUncheckedCreateNestedOneWithoutConsumerInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseUncheckedCreateNestedManyWithoutConsumerInput
|
||||
}
|
||||
|
||||
export type ConsumerCreateOrConnectWithoutConsumer_accountsInput = {
|
||||
@@ -477,7 +477,7 @@ export type ConsumerUpdateWithoutConsumer_accountsInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
business_activities?: Prisma.BusinessActivityUpdateManyWithoutConsumerNestedInput
|
||||
license?: Prisma.LicenseUpdateOneWithoutConsumerNestedInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseUpdateManyWithoutConsumerNestedInput
|
||||
}
|
||||
|
||||
export type ConsumerUncheckedUpdateWithoutConsumer_accountsInput = {
|
||||
@@ -489,7 +489,7 @@ export type ConsumerUncheckedUpdateWithoutConsumer_accountsInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
business_activities?: Prisma.BusinessActivityUncheckedUpdateManyWithoutConsumerNestedInput
|
||||
license?: Prisma.LicenseUncheckedUpdateOneWithoutConsumerNestedInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseUncheckedUpdateManyWithoutConsumerNestedInput
|
||||
}
|
||||
|
||||
export type ConsumerCreateWithoutBusiness_activitiesInput = {
|
||||
@@ -501,7 +501,7 @@ export type ConsumerCreateWithoutBusiness_activitiesInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumer_accounts?: Prisma.ConsumerAccountCreateNestedManyWithoutConsumerInput
|
||||
license?: Prisma.LicenseCreateNestedOneWithoutConsumerInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseCreateNestedManyWithoutConsumerInput
|
||||
}
|
||||
|
||||
export type ConsumerUncheckedCreateWithoutBusiness_activitiesInput = {
|
||||
@@ -513,7 +513,7 @@ export type ConsumerUncheckedCreateWithoutBusiness_activitiesInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumer_accounts?: Prisma.ConsumerAccountUncheckedCreateNestedManyWithoutConsumerInput
|
||||
license?: Prisma.LicenseUncheckedCreateNestedOneWithoutConsumerInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseUncheckedCreateNestedManyWithoutConsumerInput
|
||||
}
|
||||
|
||||
export type ConsumerCreateOrConnectWithoutBusiness_activitiesInput = {
|
||||
@@ -541,7 +541,7 @@ export type ConsumerUpdateWithoutBusiness_activitiesInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer_accounts?: Prisma.ConsumerAccountUpdateManyWithoutConsumerNestedInput
|
||||
license?: Prisma.LicenseUpdateOneWithoutConsumerNestedInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseUpdateManyWithoutConsumerNestedInput
|
||||
}
|
||||
|
||||
export type ConsumerUncheckedUpdateWithoutBusiness_activitiesInput = {
|
||||
@@ -553,10 +553,10 @@ export type ConsumerUncheckedUpdateWithoutBusiness_activitiesInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer_accounts?: Prisma.ConsumerAccountUncheckedUpdateManyWithoutConsumerNestedInput
|
||||
license?: Prisma.LicenseUncheckedUpdateOneWithoutConsumerNestedInput
|
||||
activated_licenses?: Prisma.ActivatedLicenseUncheckedUpdateManyWithoutConsumerNestedInput
|
||||
}
|
||||
|
||||
export type ConsumerCreateWithoutLicenseInput = {
|
||||
export type ConsumerCreateWithoutActivated_licensesInput = {
|
||||
id?: string
|
||||
mobile_number: string
|
||||
first_name: string
|
||||
@@ -568,7 +568,7 @@ export type ConsumerCreateWithoutLicenseInput = {
|
||||
business_activities?: Prisma.BusinessActivityCreateNestedManyWithoutConsumerInput
|
||||
}
|
||||
|
||||
export type ConsumerUncheckedCreateWithoutLicenseInput = {
|
||||
export type ConsumerUncheckedCreateWithoutActivated_licensesInput = {
|
||||
id?: string
|
||||
mobile_number: string
|
||||
first_name: string
|
||||
@@ -580,23 +580,23 @@ export type ConsumerUncheckedCreateWithoutLicenseInput = {
|
||||
business_activities?: Prisma.BusinessActivityUncheckedCreateNestedManyWithoutConsumerInput
|
||||
}
|
||||
|
||||
export type ConsumerCreateOrConnectWithoutLicenseInput = {
|
||||
export type ConsumerCreateOrConnectWithoutActivated_licensesInput = {
|
||||
where: Prisma.ConsumerWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.ConsumerCreateWithoutLicenseInput, Prisma.ConsumerUncheckedCreateWithoutLicenseInput>
|
||||
create: Prisma.XOR<Prisma.ConsumerCreateWithoutActivated_licensesInput, Prisma.ConsumerUncheckedCreateWithoutActivated_licensesInput>
|
||||
}
|
||||
|
||||
export type ConsumerUpsertWithoutLicenseInput = {
|
||||
update: Prisma.XOR<Prisma.ConsumerUpdateWithoutLicenseInput, Prisma.ConsumerUncheckedUpdateWithoutLicenseInput>
|
||||
create: Prisma.XOR<Prisma.ConsumerCreateWithoutLicenseInput, Prisma.ConsumerUncheckedCreateWithoutLicenseInput>
|
||||
export type ConsumerUpsertWithoutActivated_licensesInput = {
|
||||
update: Prisma.XOR<Prisma.ConsumerUpdateWithoutActivated_licensesInput, Prisma.ConsumerUncheckedUpdateWithoutActivated_licensesInput>
|
||||
create: Prisma.XOR<Prisma.ConsumerCreateWithoutActivated_licensesInput, Prisma.ConsumerUncheckedCreateWithoutActivated_licensesInput>
|
||||
where?: Prisma.ConsumerWhereInput
|
||||
}
|
||||
|
||||
export type ConsumerUpdateToOneWithWhereWithoutLicenseInput = {
|
||||
export type ConsumerUpdateToOneWithWhereWithoutActivated_licensesInput = {
|
||||
where?: Prisma.ConsumerWhereInput
|
||||
data: Prisma.XOR<Prisma.ConsumerUpdateWithoutLicenseInput, Prisma.ConsumerUncheckedUpdateWithoutLicenseInput>
|
||||
data: Prisma.XOR<Prisma.ConsumerUpdateWithoutActivated_licensesInput, Prisma.ConsumerUncheckedUpdateWithoutActivated_licensesInput>
|
||||
}
|
||||
|
||||
export type ConsumerUpdateWithoutLicenseInput = {
|
||||
export type ConsumerUpdateWithoutActivated_licensesInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
mobile_number?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
first_name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -608,7 +608,7 @@ export type ConsumerUpdateWithoutLicenseInput = {
|
||||
business_activities?: Prisma.BusinessActivityUpdateManyWithoutConsumerNestedInput
|
||||
}
|
||||
|
||||
export type ConsumerUncheckedUpdateWithoutLicenseInput = {
|
||||
export type ConsumerUncheckedUpdateWithoutActivated_licensesInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
mobile_number?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
first_name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -628,11 +628,13 @@ export type ConsumerUncheckedUpdateWithoutLicenseInput = {
|
||||
export type ConsumerCountOutputType = {
|
||||
consumer_accounts: number
|
||||
business_activities: number
|
||||
activated_licenses: number
|
||||
}
|
||||
|
||||
export type ConsumerCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
consumer_accounts?: boolean | ConsumerCountOutputTypeCountConsumer_accountsArgs
|
||||
business_activities?: boolean | ConsumerCountOutputTypeCountBusiness_activitiesArgs
|
||||
activated_licenses?: boolean | ConsumerCountOutputTypeCountActivated_licensesArgs
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -659,6 +661,13 @@ export type ConsumerCountOutputTypeCountBusiness_activitiesArgs<ExtArgs extends
|
||||
where?: Prisma.BusinessActivityWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* ConsumerCountOutputType without action
|
||||
*/
|
||||
export type ConsumerCountOutputTypeCountActivated_licensesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.ActivatedLicenseWhereInput
|
||||
}
|
||||
|
||||
|
||||
export type ConsumerSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
@@ -670,7 +679,7 @@ export type ConsumerSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
||||
updated_at?: boolean
|
||||
consumer_accounts?: boolean | Prisma.Consumer$consumer_accountsArgs<ExtArgs>
|
||||
business_activities?: boolean | Prisma.Consumer$business_activitiesArgs<ExtArgs>
|
||||
license?: boolean | Prisma.Consumer$licenseArgs<ExtArgs>
|
||||
activated_licenses?: boolean | Prisma.Consumer$activated_licensesArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.ConsumerCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["consumer"]>
|
||||
|
||||
@@ -690,7 +699,7 @@ export type ConsumerOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
export type ConsumerInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
consumer_accounts?: boolean | Prisma.Consumer$consumer_accountsArgs<ExtArgs>
|
||||
business_activities?: boolean | Prisma.Consumer$business_activitiesArgs<ExtArgs>
|
||||
license?: boolean | Prisma.Consumer$licenseArgs<ExtArgs>
|
||||
activated_licenses?: boolean | Prisma.Consumer$activated_licensesArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.ConsumerCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
|
||||
@@ -699,7 +708,7 @@ export type $ConsumerPayload<ExtArgs extends runtime.Types.Extensions.InternalAr
|
||||
objects: {
|
||||
consumer_accounts: Prisma.$ConsumerAccountPayload<ExtArgs>[]
|
||||
business_activities: Prisma.$BusinessActivityPayload<ExtArgs>[]
|
||||
license: Prisma.$LicensePayload<ExtArgs> | null
|
||||
activated_licenses: Prisma.$ActivatedLicensePayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
@@ -1051,7 +1060,7 @@ export interface Prisma__ConsumerClient<T, Null = never, ExtArgs extends runtime
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
consumer_accounts<T extends Prisma.Consumer$consumer_accountsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Consumer$consumer_accountsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ConsumerAccountPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
business_activities<T extends Prisma.Consumer$business_activitiesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Consumer$business_activitiesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$BusinessActivityPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
license<T extends Prisma.Consumer$licenseArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Consumer$licenseArgs<ExtArgs>>): Prisma.Prisma__LicenseClient<runtime.Types.Result.GetResult<Prisma.$LicensePayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
activated_licenses<T extends Prisma.Consumer$activated_licensesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Consumer$activated_licensesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ActivatedLicensePayload<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.
|
||||
@@ -1479,22 +1488,27 @@ export type Consumer$business_activitiesArgs<ExtArgs extends runtime.Types.Exten
|
||||
}
|
||||
|
||||
/**
|
||||
* Consumer.license
|
||||
* Consumer.activated_licenses
|
||||
*/
|
||||
export type Consumer$licenseArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
export type Consumer$activated_licensesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the License
|
||||
* Select specific fields to fetch from the ActivatedLicense
|
||||
*/
|
||||
select?: Prisma.LicenseSelect<ExtArgs> | null
|
||||
select?: Prisma.ActivatedLicenseSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the License
|
||||
* Omit specific fields from the ActivatedLicense
|
||||
*/
|
||||
omit?: Prisma.LicenseOmit<ExtArgs> | null
|
||||
omit?: Prisma.ActivatedLicenseOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.LicenseInclude<ExtArgs> | null
|
||||
where?: Prisma.LicenseWhereInput
|
||||
include?: Prisma.ActivatedLicenseInclude<ExtArgs> | null
|
||||
where?: Prisma.ActivatedLicenseWhereInput
|
||||
orderBy?: Prisma.ActivatedLicenseOrderByWithRelationInput | Prisma.ActivatedLicenseOrderByWithRelationInput[]
|
||||
cursor?: Prisma.ActivatedLicenseWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.ActivatedLicenseScalarFieldEnum | Prisma.ActivatedLicenseScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,6 +45,7 @@ export type GoodMinAggregateOutputType = {
|
||||
local_sku: string | null
|
||||
barcode: string | null
|
||||
base_sale_price: runtime.Decimal | null
|
||||
image_url: string | null
|
||||
created_at: Date | null
|
||||
updated_at: Date | null
|
||||
deleted_at: Date | null
|
||||
@@ -63,6 +64,7 @@ export type GoodMaxAggregateOutputType = {
|
||||
local_sku: string | null
|
||||
barcode: string | null
|
||||
base_sale_price: runtime.Decimal | null
|
||||
image_url: string | null
|
||||
created_at: Date | null
|
||||
updated_at: Date | null
|
||||
deleted_at: Date | null
|
||||
@@ -81,6 +83,7 @@ export type GoodCountAggregateOutputType = {
|
||||
local_sku: number
|
||||
barcode: number
|
||||
base_sale_price: number
|
||||
image_url: number
|
||||
created_at: number
|
||||
updated_at: number
|
||||
deleted_at: number
|
||||
@@ -109,6 +112,7 @@ export type GoodMinAggregateInputType = {
|
||||
local_sku?: true
|
||||
barcode?: true
|
||||
base_sale_price?: true
|
||||
image_url?: true
|
||||
created_at?: true
|
||||
updated_at?: true
|
||||
deleted_at?: true
|
||||
@@ -127,6 +131,7 @@ export type GoodMaxAggregateInputType = {
|
||||
local_sku?: true
|
||||
barcode?: true
|
||||
base_sale_price?: true
|
||||
image_url?: true
|
||||
created_at?: true
|
||||
updated_at?: true
|
||||
deleted_at?: true
|
||||
@@ -145,6 +150,7 @@ export type GoodCountAggregateInputType = {
|
||||
local_sku?: true
|
||||
barcode?: true
|
||||
base_sale_price?: true
|
||||
image_url?: true
|
||||
created_at?: true
|
||||
updated_at?: true
|
||||
deleted_at?: true
|
||||
@@ -250,6 +256,7 @@ export type GoodGroupByOutputType = {
|
||||
local_sku: string | null
|
||||
barcode: string | null
|
||||
base_sale_price: runtime.Decimal | null
|
||||
image_url: string | null
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
@@ -291,6 +298,7 @@ export type GoodWhereInput = {
|
||||
local_sku?: Prisma.StringNullableFilter<"Good"> | string | null
|
||||
barcode?: Prisma.StringNullableFilter<"Good"> | string | null
|
||||
base_sale_price?: Prisma.DecimalNullableFilter<"Good"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.StringNullableFilter<"Good"> | string | null
|
||||
created_at?: Prisma.DateTimeFilter<"Good"> | Date | string
|
||||
updated_at?: Prisma.DateTimeFilter<"Good"> | Date | string
|
||||
deleted_at?: Prisma.DateTimeNullableFilter<"Good"> | Date | string | null
|
||||
@@ -312,6 +320,7 @@ export type GoodOrderByWithRelationInput = {
|
||||
local_sku?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
barcode?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
base_sale_price?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
image_url?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
deleted_at?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
@@ -337,6 +346,7 @@ export type GoodWhereUniqueInput = Prisma.AtLeast<{
|
||||
pricing_model?: Prisma.EnumGoodPricingModelFilter<"Good"> | $Enums.GoodPricingModel
|
||||
description?: Prisma.StringNullableFilter<"Good"> | string | null
|
||||
base_sale_price?: Prisma.DecimalNullableFilter<"Good"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.StringNullableFilter<"Good"> | string | null
|
||||
created_at?: Prisma.DateTimeFilter<"Good"> | Date | string
|
||||
updated_at?: Prisma.DateTimeFilter<"Good"> | Date | string
|
||||
deleted_at?: Prisma.DateTimeNullableFilter<"Good"> | Date | string | null
|
||||
@@ -358,6 +368,7 @@ export type GoodOrderByWithAggregationInput = {
|
||||
local_sku?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
barcode?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
base_sale_price?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
image_url?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
deleted_at?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
@@ -384,6 +395,7 @@ export type GoodScalarWhereWithAggregatesInput = {
|
||||
local_sku?: Prisma.StringNullableWithAggregatesFilter<"Good"> | string | null
|
||||
barcode?: Prisma.StringNullableWithAggregatesFilter<"Good"> | string | null
|
||||
base_sale_price?: Prisma.DecimalNullableWithAggregatesFilter<"Good"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.StringNullableWithAggregatesFilter<"Good"> | string | null
|
||||
created_at?: Prisma.DateTimeWithAggregatesFilter<"Good"> | Date | string
|
||||
updated_at?: Prisma.DateTimeWithAggregatesFilter<"Good"> | Date | string
|
||||
deleted_at?: Prisma.DateTimeNullableWithAggregatesFilter<"Good"> | Date | string | null
|
||||
@@ -402,6 +414,7 @@ export type GoodCreateInput = {
|
||||
local_sku?: string | null
|
||||
barcode?: string | null
|
||||
base_sale_price?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
deleted_at?: Date | string | null
|
||||
@@ -421,6 +434,7 @@ export type GoodUncheckedCreateInput = {
|
||||
local_sku?: string | null
|
||||
barcode?: string | null
|
||||
base_sale_price?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
deleted_at?: Date | string | null
|
||||
@@ -440,6 +454,7 @@ export type GoodUpdateInput = {
|
||||
local_sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
base_sale_price?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -459,6 +474,7 @@ export type GoodUncheckedUpdateInput = {
|
||||
local_sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
base_sale_price?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -478,6 +494,7 @@ export type GoodCreateManyInput = {
|
||||
local_sku?: string | null
|
||||
barcode?: string | null
|
||||
base_sale_price?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
deleted_at?: Date | string | null
|
||||
@@ -496,6 +513,7 @@ export type GoodUpdateManyMutationInput = {
|
||||
local_sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
base_sale_price?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -512,6 +530,7 @@ export type GoodUncheckedUpdateManyInput = {
|
||||
local_sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
base_sale_price?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -546,6 +565,7 @@ export type GoodCountOrderByAggregateInput = {
|
||||
local_sku?: Prisma.SortOrder
|
||||
barcode?: Prisma.SortOrder
|
||||
base_sale_price?: Prisma.SortOrder
|
||||
image_url?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
deleted_at?: Prisma.SortOrder
|
||||
@@ -568,6 +588,7 @@ export type GoodMaxOrderByAggregateInput = {
|
||||
local_sku?: Prisma.SortOrder
|
||||
barcode?: Prisma.SortOrder
|
||||
base_sale_price?: Prisma.SortOrder
|
||||
image_url?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
deleted_at?: Prisma.SortOrder
|
||||
@@ -586,6 +607,7 @@ export type GoodMinOrderByAggregateInput = {
|
||||
local_sku?: Prisma.SortOrder
|
||||
barcode?: Prisma.SortOrder
|
||||
base_sale_price?: Prisma.SortOrder
|
||||
image_url?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
deleted_at?: Prisma.SortOrder
|
||||
@@ -733,6 +755,7 @@ export type GoodCreateWithoutComplexInput = {
|
||||
local_sku?: string | null
|
||||
barcode?: string | null
|
||||
base_sale_price?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
deleted_at?: Date | string | null
|
||||
@@ -751,6 +774,7 @@ export type GoodUncheckedCreateWithoutComplexInput = {
|
||||
local_sku?: string | null
|
||||
barcode?: string | null
|
||||
base_sale_price?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
deleted_at?: Date | string | null
|
||||
@@ -798,6 +822,7 @@ export type GoodScalarWhereInput = {
|
||||
local_sku?: Prisma.StringNullableFilter<"Good"> | string | null
|
||||
barcode?: Prisma.StringNullableFilter<"Good"> | string | null
|
||||
base_sale_price?: Prisma.DecimalNullableFilter<"Good"> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.StringNullableFilter<"Good"> | string | null
|
||||
created_at?: Prisma.DateTimeFilter<"Good"> | Date | string
|
||||
updated_at?: Prisma.DateTimeFilter<"Good"> | Date | string
|
||||
deleted_at?: Prisma.DateTimeNullableFilter<"Good"> | Date | string | null
|
||||
@@ -816,6 +841,7 @@ export type GoodCreateWithoutCategoryInput = {
|
||||
local_sku?: string | null
|
||||
barcode?: string | null
|
||||
base_sale_price?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
deleted_at?: Date | string | null
|
||||
@@ -834,6 +860,7 @@ export type GoodUncheckedCreateWithoutCategoryInput = {
|
||||
local_sku?: string | null
|
||||
barcode?: string | null
|
||||
base_sale_price?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
deleted_at?: Date | string | null
|
||||
@@ -878,6 +905,7 @@ export type GoodCreateWithoutSales_invoice_itemsInput = {
|
||||
local_sku?: string | null
|
||||
barcode?: string | null
|
||||
base_sale_price?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
deleted_at?: Date | string | null
|
||||
@@ -896,6 +924,7 @@ export type GoodUncheckedCreateWithoutSales_invoice_itemsInput = {
|
||||
local_sku?: string | null
|
||||
barcode?: string | null
|
||||
base_sale_price?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
deleted_at?: Date | string | null
|
||||
@@ -930,6 +959,7 @@ export type GoodUpdateWithoutSales_invoice_itemsInput = {
|
||||
local_sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
base_sale_price?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -948,6 +978,7 @@ export type GoodUncheckedUpdateWithoutSales_invoice_itemsInput = {
|
||||
local_sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
base_sale_price?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -966,6 +997,7 @@ export type GoodCreateManyComplexInput = {
|
||||
local_sku?: string | null
|
||||
barcode?: string | null
|
||||
base_sale_price?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
deleted_at?: Date | string | null
|
||||
@@ -983,6 +1015,7 @@ export type GoodUpdateWithoutComplexInput = {
|
||||
local_sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
base_sale_price?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -1001,6 +1034,7 @@ export type GoodUncheckedUpdateWithoutComplexInput = {
|
||||
local_sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
base_sale_price?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -1019,6 +1053,7 @@ export type GoodUncheckedUpdateManyWithoutComplexInput = {
|
||||
local_sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
base_sale_price?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -1036,6 +1071,7 @@ export type GoodCreateManyCategoryInput = {
|
||||
local_sku?: string | null
|
||||
barcode?: string | null
|
||||
base_sale_price?: runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
deleted_at?: Date | string | null
|
||||
@@ -1053,6 +1089,7 @@ export type GoodUpdateWithoutCategoryInput = {
|
||||
local_sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
base_sale_price?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -1071,6 +1108,7 @@ export type GoodUncheckedUpdateWithoutCategoryInput = {
|
||||
local_sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
base_sale_price?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -1089,6 +1127,7 @@ export type GoodUncheckedUpdateManyWithoutCategoryInput = {
|
||||
local_sku?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
barcode?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
base_sale_price?: Prisma.NullableDecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
image_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||
@@ -1137,6 +1176,7 @@ export type GoodSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
|
||||
local_sku?: boolean
|
||||
barcode?: boolean
|
||||
base_sale_price?: boolean
|
||||
image_url?: boolean
|
||||
created_at?: boolean
|
||||
updated_at?: boolean
|
||||
deleted_at?: boolean
|
||||
@@ -1161,6 +1201,7 @@ export type GoodSelectScalar = {
|
||||
local_sku?: boolean
|
||||
barcode?: boolean
|
||||
base_sale_price?: boolean
|
||||
image_url?: boolean
|
||||
created_at?: boolean
|
||||
updated_at?: boolean
|
||||
deleted_at?: boolean
|
||||
@@ -1168,7 +1209,7 @@ export type GoodSelectScalar = {
|
||||
category_id?: boolean
|
||||
}
|
||||
|
||||
export type GoodOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "is_default_guild_good" | "sku" | "unit_type" | "pricing_model" | "description" | "local_sku" | "barcode" | "base_sale_price" | "created_at" | "updated_at" | "deleted_at" | "complex_id" | "category_id", ExtArgs["result"]["good"]>
|
||||
export type GoodOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "is_default_guild_good" | "sku" | "unit_type" | "pricing_model" | "description" | "local_sku" | "barcode" | "base_sale_price" | "image_url" | "created_at" | "updated_at" | "deleted_at" | "complex_id" | "category_id", ExtArgs["result"]["good"]>
|
||||
export type GoodInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
category?: boolean | Prisma.Good$categoryArgs<ExtArgs>
|
||||
complex?: boolean | Prisma.Good$complexArgs<ExtArgs>
|
||||
@@ -1194,6 +1235,7 @@ export type $GoodPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
local_sku: string | null
|
||||
barcode: string | null
|
||||
base_sale_price: runtime.Decimal | null
|
||||
image_url: string | null
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
deleted_at: Date | null
|
||||
@@ -1581,6 +1623,7 @@ export interface GoodFieldRefs {
|
||||
readonly local_sku: Prisma.FieldRef<"Good", 'String'>
|
||||
readonly barcode: Prisma.FieldRef<"Good", 'String'>
|
||||
readonly base_sale_price: Prisma.FieldRef<"Good", 'Decimal'>
|
||||
readonly image_url: Prisma.FieldRef<"Good", 'String'>
|
||||
readonly created_at: Prisma.FieldRef<"Good", 'DateTime'>
|
||||
readonly updated_at: Prisma.FieldRef<"Good", 'DateTime'>
|
||||
readonly deleted_at: Prisma.FieldRef<"Good", 'DateTime'>
|
||||
|
||||
@@ -26,70 +26,46 @@ export type AggregateLicense = {
|
||||
|
||||
export type LicenseMinAggregateOutputType = {
|
||||
id: string | null
|
||||
starts_at: Date | null
|
||||
expires_at: Date | null
|
||||
status: $Enums.LicenseStatus | null
|
||||
created_at: Date | null
|
||||
updated_at: Date | null
|
||||
partner_id: string | null
|
||||
consumer_id: string | null
|
||||
charged_license_transaction_id: string | null
|
||||
}
|
||||
|
||||
export type LicenseMaxAggregateOutputType = {
|
||||
id: string | null
|
||||
starts_at: Date | null
|
||||
expires_at: Date | null
|
||||
status: $Enums.LicenseStatus | null
|
||||
created_at: Date | null
|
||||
updated_at: Date | null
|
||||
partner_id: string | null
|
||||
consumer_id: string | null
|
||||
charged_license_transaction_id: string | null
|
||||
}
|
||||
|
||||
export type LicenseCountAggregateOutputType = {
|
||||
id: number
|
||||
starts_at: number
|
||||
expires_at: number
|
||||
status: number
|
||||
created_at: number
|
||||
updated_at: number
|
||||
partner_id: number
|
||||
consumer_id: number
|
||||
charged_license_transaction_id: number
|
||||
_all: number
|
||||
}
|
||||
|
||||
|
||||
export type LicenseMinAggregateInputType = {
|
||||
id?: true
|
||||
starts_at?: true
|
||||
expires_at?: true
|
||||
status?: true
|
||||
created_at?: true
|
||||
updated_at?: true
|
||||
partner_id?: true
|
||||
consumer_id?: true
|
||||
charged_license_transaction_id?: true
|
||||
}
|
||||
|
||||
export type LicenseMaxAggregateInputType = {
|
||||
id?: true
|
||||
starts_at?: true
|
||||
expires_at?: true
|
||||
status?: true
|
||||
created_at?: true
|
||||
updated_at?: true
|
||||
partner_id?: true
|
||||
consumer_id?: true
|
||||
charged_license_transaction_id?: true
|
||||
}
|
||||
|
||||
export type LicenseCountAggregateInputType = {
|
||||
id?: true
|
||||
starts_at?: true
|
||||
expires_at?: true
|
||||
status?: true
|
||||
created_at?: true
|
||||
updated_at?: true
|
||||
partner_id?: true
|
||||
consumer_id?: true
|
||||
charged_license_transaction_id?: true
|
||||
_all?: true
|
||||
}
|
||||
|
||||
@@ -167,13 +143,9 @@ export type LicenseGroupByArgs<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
|
||||
export type LicenseGroupByOutputType = {
|
||||
id: string
|
||||
starts_at: Date
|
||||
expires_at: Date
|
||||
status: $Enums.LicenseStatus
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
partner_id: string | null
|
||||
consumer_id: string
|
||||
charged_license_transaction_id: string
|
||||
_count: LicenseCountAggregateOutputType | null
|
||||
_min: LicenseMinAggregateOutputType | null
|
||||
_max: LicenseMaxAggregateOutputType | null
|
||||
@@ -199,56 +171,40 @@ export type LicenseWhereInput = {
|
||||
OR?: Prisma.LicenseWhereInput[]
|
||||
NOT?: Prisma.LicenseWhereInput | Prisma.LicenseWhereInput[]
|
||||
id?: Prisma.StringFilter<"License"> | string
|
||||
starts_at?: Prisma.DateTimeFilter<"License"> | Date | string
|
||||
expires_at?: Prisma.DateTimeFilter<"License"> | Date | string
|
||||
status?: Prisma.EnumLicenseStatusFilter<"License"> | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeFilter<"License"> | Date | string
|
||||
updated_at?: Prisma.DateTimeFilter<"License"> | Date | string
|
||||
partner_id?: Prisma.StringNullableFilter<"License"> | string | null
|
||||
consumer_id?: Prisma.StringFilter<"License"> | string
|
||||
partner?: Prisma.XOR<Prisma.PartnerNullableScalarRelationFilter, Prisma.PartnerWhereInput> | null
|
||||
consumer?: Prisma.XOR<Prisma.ConsumerScalarRelationFilter, Prisma.ConsumerWhereInput>
|
||||
charged_license_transaction_id?: Prisma.StringFilter<"License"> | string
|
||||
charged_license_transaction?: Prisma.XOR<Prisma.ChargedLicenseTransactionsScalarRelationFilter, Prisma.ChargedLicenseTransactionsWhereInput>
|
||||
activated_license?: Prisma.XOR<Prisma.ActivatedLicenseNullableScalarRelationFilter, Prisma.ActivatedLicenseWhereInput> | null
|
||||
}
|
||||
|
||||
export type LicenseOrderByWithRelationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
starts_at?: Prisma.SortOrder
|
||||
expires_at?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
partner_id?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
consumer_id?: Prisma.SortOrder
|
||||
partner?: Prisma.PartnerOrderByWithRelationInput
|
||||
consumer?: Prisma.ConsumerOrderByWithRelationInput
|
||||
charged_license_transaction_id?: Prisma.SortOrder
|
||||
charged_license_transaction?: Prisma.ChargedLicenseTransactionsOrderByWithRelationInput
|
||||
activated_license?: Prisma.ActivatedLicenseOrderByWithRelationInput
|
||||
_relevance?: Prisma.LicenseOrderByRelevanceInput
|
||||
}
|
||||
|
||||
export type LicenseWhereUniqueInput = Prisma.AtLeast<{
|
||||
id?: string
|
||||
consumer_id?: string
|
||||
AND?: Prisma.LicenseWhereInput | Prisma.LicenseWhereInput[]
|
||||
OR?: Prisma.LicenseWhereInput[]
|
||||
NOT?: Prisma.LicenseWhereInput | Prisma.LicenseWhereInput[]
|
||||
starts_at?: Prisma.DateTimeFilter<"License"> | Date | string
|
||||
expires_at?: Prisma.DateTimeFilter<"License"> | Date | string
|
||||
status?: Prisma.EnumLicenseStatusFilter<"License"> | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeFilter<"License"> | Date | string
|
||||
updated_at?: Prisma.DateTimeFilter<"License"> | Date | string
|
||||
partner_id?: Prisma.StringNullableFilter<"License"> | string | null
|
||||
partner?: Prisma.XOR<Prisma.PartnerNullableScalarRelationFilter, Prisma.PartnerWhereInput> | null
|
||||
consumer?: Prisma.XOR<Prisma.ConsumerScalarRelationFilter, Prisma.ConsumerWhereInput>
|
||||
}, "id" | "consumer_id">
|
||||
charged_license_transaction_id?: Prisma.StringFilter<"License"> | string
|
||||
charged_license_transaction?: Prisma.XOR<Prisma.ChargedLicenseTransactionsScalarRelationFilter, Prisma.ChargedLicenseTransactionsWhereInput>
|
||||
activated_license?: Prisma.XOR<Prisma.ActivatedLicenseNullableScalarRelationFilter, Prisma.ActivatedLicenseWhereInput> | null
|
||||
}, "id">
|
||||
|
||||
export type LicenseOrderByWithAggregationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
starts_at?: Prisma.SortOrder
|
||||
expires_at?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
partner_id?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
consumer_id?: Prisma.SortOrder
|
||||
charged_license_transaction_id?: Prisma.SortOrder
|
||||
_count?: Prisma.LicenseCountOrderByAggregateInput
|
||||
_max?: Prisma.LicenseMaxOrderByAggregateInput
|
||||
_min?: Prisma.LicenseMinOrderByAggregateInput
|
||||
@@ -259,93 +215,61 @@ export type LicenseScalarWhereWithAggregatesInput = {
|
||||
OR?: Prisma.LicenseScalarWhereWithAggregatesInput[]
|
||||
NOT?: Prisma.LicenseScalarWhereWithAggregatesInput | Prisma.LicenseScalarWhereWithAggregatesInput[]
|
||||
id?: Prisma.StringWithAggregatesFilter<"License"> | string
|
||||
starts_at?: Prisma.DateTimeWithAggregatesFilter<"License"> | Date | string
|
||||
expires_at?: Prisma.DateTimeWithAggregatesFilter<"License"> | Date | string
|
||||
status?: Prisma.EnumLicenseStatusWithAggregatesFilter<"License"> | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeWithAggregatesFilter<"License"> | Date | string
|
||||
updated_at?: Prisma.DateTimeWithAggregatesFilter<"License"> | Date | string
|
||||
partner_id?: Prisma.StringNullableWithAggregatesFilter<"License"> | string | null
|
||||
consumer_id?: Prisma.StringWithAggregatesFilter<"License"> | string
|
||||
charged_license_transaction_id?: Prisma.StringWithAggregatesFilter<"License"> | string
|
||||
}
|
||||
|
||||
export type LicenseCreateInput = {
|
||||
id?: string
|
||||
starts_at: Date | string
|
||||
expires_at: Date | string
|
||||
status: $Enums.LicenseStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
partner?: Prisma.PartnerCreateNestedOneWithoutLicensesInput
|
||||
consumer: Prisma.ConsumerCreateNestedOneWithoutLicenseInput
|
||||
charged_license_transaction: Prisma.ChargedLicenseTransactionsCreateNestedOneWithoutLicensesInput
|
||||
activated_license?: Prisma.ActivatedLicenseCreateNestedOneWithoutLicenseInput
|
||||
}
|
||||
|
||||
export type LicenseUncheckedCreateInput = {
|
||||
id?: string
|
||||
starts_at: Date | string
|
||||
expires_at: Date | string
|
||||
status: $Enums.LicenseStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
partner_id?: string | null
|
||||
consumer_id: string
|
||||
charged_license_transaction_id: string
|
||||
activated_license?: Prisma.ActivatedLicenseUncheckedCreateNestedOneWithoutLicenseInput
|
||||
}
|
||||
|
||||
export type LicenseUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
starts_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
status?: Prisma.EnumLicenseStatusFieldUpdateOperationsInput | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
partner?: Prisma.PartnerUpdateOneWithoutLicensesNestedInput
|
||||
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutLicenseNestedInput
|
||||
charged_license_transaction?: Prisma.ChargedLicenseTransactionsUpdateOneRequiredWithoutLicensesNestedInput
|
||||
activated_license?: Prisma.ActivatedLicenseUpdateOneWithoutLicenseNestedInput
|
||||
}
|
||||
|
||||
export type LicenseUncheckedUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
starts_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
status?: Prisma.EnumLicenseStatusFieldUpdateOperationsInput | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
partner_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
charged_license_transaction_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
activated_license?: Prisma.ActivatedLicenseUncheckedUpdateOneWithoutLicenseNestedInput
|
||||
}
|
||||
|
||||
export type LicenseCreateManyInput = {
|
||||
id?: string
|
||||
starts_at: Date | string
|
||||
expires_at: Date | string
|
||||
status: $Enums.LicenseStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
partner_id?: string | null
|
||||
consumer_id: string
|
||||
charged_license_transaction_id: string
|
||||
}
|
||||
|
||||
export type LicenseUpdateManyMutationInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
starts_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
status?: Prisma.EnumLicenseStatusFieldUpdateOperationsInput | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type LicenseUncheckedUpdateManyInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
starts_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
status?: Prisma.EnumLicenseStatusFieldUpdateOperationsInput | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
partner_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
}
|
||||
|
||||
export type LicenseNullableScalarRelationFilter = {
|
||||
is?: Prisma.LicenseWhereInput | null
|
||||
isNot?: Prisma.LicenseWhereInput | null
|
||||
charged_license_transaction_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
}
|
||||
|
||||
export type LicenseOrderByRelevanceInput = {
|
||||
@@ -356,35 +280,28 @@ export type LicenseOrderByRelevanceInput = {
|
||||
|
||||
export type LicenseCountOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
starts_at?: Prisma.SortOrder
|
||||
expires_at?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
partner_id?: Prisma.SortOrder
|
||||
consumer_id?: Prisma.SortOrder
|
||||
charged_license_transaction_id?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type LicenseMaxOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
starts_at?: Prisma.SortOrder
|
||||
expires_at?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
partner_id?: Prisma.SortOrder
|
||||
consumer_id?: Prisma.SortOrder
|
||||
charged_license_transaction_id?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type LicenseMinOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
starts_at?: Prisma.SortOrder
|
||||
expires_at?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
partner_id?: Prisma.SortOrder
|
||||
consumer_id?: Prisma.SortOrder
|
||||
charged_license_transaction_id?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type LicenseScalarRelationFilter = {
|
||||
is?: Prisma.LicenseWhereInput
|
||||
isNot?: Prisma.LicenseWhereInput
|
||||
}
|
||||
|
||||
export type LicenseListRelationFilter = {
|
||||
@@ -397,184 +314,144 @@ export type LicenseOrderByRelationAggregateInput = {
|
||||
_count?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type LicenseCreateNestedOneWithoutConsumerInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutConsumerInput, Prisma.LicenseUncheckedCreateWithoutConsumerInput>
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutConsumerInput
|
||||
export type LicenseCreateNestedOneWithoutActivated_licenseInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutActivated_licenseInput, Prisma.LicenseUncheckedCreateWithoutActivated_licenseInput>
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutActivated_licenseInput
|
||||
connect?: Prisma.LicenseWhereUniqueInput
|
||||
}
|
||||
|
||||
export type LicenseUncheckedCreateNestedOneWithoutConsumerInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutConsumerInput, Prisma.LicenseUncheckedCreateWithoutConsumerInput>
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutConsumerInput
|
||||
export type LicenseUpdateOneRequiredWithoutActivated_licenseNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutActivated_licenseInput, Prisma.LicenseUncheckedCreateWithoutActivated_licenseInput>
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutActivated_licenseInput
|
||||
upsert?: Prisma.LicenseUpsertWithoutActivated_licenseInput
|
||||
connect?: Prisma.LicenseWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.LicenseUpdateToOneWithWhereWithoutActivated_licenseInput, Prisma.LicenseUpdateWithoutActivated_licenseInput>, Prisma.LicenseUncheckedUpdateWithoutActivated_licenseInput>
|
||||
}
|
||||
|
||||
export type LicenseUpdateOneWithoutConsumerNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutConsumerInput, Prisma.LicenseUncheckedCreateWithoutConsumerInput>
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutConsumerInput
|
||||
upsert?: Prisma.LicenseUpsertWithoutConsumerInput
|
||||
disconnect?: Prisma.LicenseWhereInput | boolean
|
||||
delete?: Prisma.LicenseWhereInput | boolean
|
||||
connect?: Prisma.LicenseWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.LicenseUpdateToOneWithWhereWithoutConsumerInput, Prisma.LicenseUpdateWithoutConsumerInput>, Prisma.LicenseUncheckedUpdateWithoutConsumerInput>
|
||||
}
|
||||
|
||||
export type LicenseUncheckedUpdateOneWithoutConsumerNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutConsumerInput, Prisma.LicenseUncheckedCreateWithoutConsumerInput>
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutConsumerInput
|
||||
upsert?: Prisma.LicenseUpsertWithoutConsumerInput
|
||||
disconnect?: Prisma.LicenseWhereInput | boolean
|
||||
delete?: Prisma.LicenseWhereInput | boolean
|
||||
connect?: Prisma.LicenseWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.LicenseUpdateToOneWithWhereWithoutConsumerInput, Prisma.LicenseUpdateWithoutConsumerInput>, Prisma.LicenseUncheckedUpdateWithoutConsumerInput>
|
||||
}
|
||||
|
||||
export type EnumLicenseStatusFieldUpdateOperationsInput = {
|
||||
set?: $Enums.LicenseStatus
|
||||
}
|
||||
|
||||
export type LicenseCreateNestedManyWithoutPartnerInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutPartnerInput, Prisma.LicenseUncheckedCreateWithoutPartnerInput> | Prisma.LicenseCreateWithoutPartnerInput[] | Prisma.LicenseUncheckedCreateWithoutPartnerInput[]
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutPartnerInput | Prisma.LicenseCreateOrConnectWithoutPartnerInput[]
|
||||
createMany?: Prisma.LicenseCreateManyPartnerInputEnvelope
|
||||
export type LicenseCreateNestedManyWithoutCharged_license_transactionInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutCharged_license_transactionInput, Prisma.LicenseUncheckedCreateWithoutCharged_license_transactionInput> | Prisma.LicenseCreateWithoutCharged_license_transactionInput[] | Prisma.LicenseUncheckedCreateWithoutCharged_license_transactionInput[]
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutCharged_license_transactionInput | Prisma.LicenseCreateOrConnectWithoutCharged_license_transactionInput[]
|
||||
createMany?: Prisma.LicenseCreateManyCharged_license_transactionInputEnvelope
|
||||
connect?: Prisma.LicenseWhereUniqueInput | Prisma.LicenseWhereUniqueInput[]
|
||||
}
|
||||
|
||||
export type LicenseUncheckedCreateNestedManyWithoutPartnerInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutPartnerInput, Prisma.LicenseUncheckedCreateWithoutPartnerInput> | Prisma.LicenseCreateWithoutPartnerInput[] | Prisma.LicenseUncheckedCreateWithoutPartnerInput[]
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutPartnerInput | Prisma.LicenseCreateOrConnectWithoutPartnerInput[]
|
||||
createMany?: Prisma.LicenseCreateManyPartnerInputEnvelope
|
||||
export type LicenseUncheckedCreateNestedManyWithoutCharged_license_transactionInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutCharged_license_transactionInput, Prisma.LicenseUncheckedCreateWithoutCharged_license_transactionInput> | Prisma.LicenseCreateWithoutCharged_license_transactionInput[] | Prisma.LicenseUncheckedCreateWithoutCharged_license_transactionInput[]
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutCharged_license_transactionInput | Prisma.LicenseCreateOrConnectWithoutCharged_license_transactionInput[]
|
||||
createMany?: Prisma.LicenseCreateManyCharged_license_transactionInputEnvelope
|
||||
connect?: Prisma.LicenseWhereUniqueInput | Prisma.LicenseWhereUniqueInput[]
|
||||
}
|
||||
|
||||
export type LicenseUpdateManyWithoutPartnerNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutPartnerInput, Prisma.LicenseUncheckedCreateWithoutPartnerInput> | Prisma.LicenseCreateWithoutPartnerInput[] | Prisma.LicenseUncheckedCreateWithoutPartnerInput[]
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutPartnerInput | Prisma.LicenseCreateOrConnectWithoutPartnerInput[]
|
||||
upsert?: Prisma.LicenseUpsertWithWhereUniqueWithoutPartnerInput | Prisma.LicenseUpsertWithWhereUniqueWithoutPartnerInput[]
|
||||
createMany?: Prisma.LicenseCreateManyPartnerInputEnvelope
|
||||
export type LicenseUpdateManyWithoutCharged_license_transactionNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutCharged_license_transactionInput, Prisma.LicenseUncheckedCreateWithoutCharged_license_transactionInput> | Prisma.LicenseCreateWithoutCharged_license_transactionInput[] | Prisma.LicenseUncheckedCreateWithoutCharged_license_transactionInput[]
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutCharged_license_transactionInput | Prisma.LicenseCreateOrConnectWithoutCharged_license_transactionInput[]
|
||||
upsert?: Prisma.LicenseUpsertWithWhereUniqueWithoutCharged_license_transactionInput | Prisma.LicenseUpsertWithWhereUniqueWithoutCharged_license_transactionInput[]
|
||||
createMany?: Prisma.LicenseCreateManyCharged_license_transactionInputEnvelope
|
||||
set?: Prisma.LicenseWhereUniqueInput | Prisma.LicenseWhereUniqueInput[]
|
||||
disconnect?: Prisma.LicenseWhereUniqueInput | Prisma.LicenseWhereUniqueInput[]
|
||||
delete?: Prisma.LicenseWhereUniqueInput | Prisma.LicenseWhereUniqueInput[]
|
||||
connect?: Prisma.LicenseWhereUniqueInput | Prisma.LicenseWhereUniqueInput[]
|
||||
update?: Prisma.LicenseUpdateWithWhereUniqueWithoutPartnerInput | Prisma.LicenseUpdateWithWhereUniqueWithoutPartnerInput[]
|
||||
updateMany?: Prisma.LicenseUpdateManyWithWhereWithoutPartnerInput | Prisma.LicenseUpdateManyWithWhereWithoutPartnerInput[]
|
||||
update?: Prisma.LicenseUpdateWithWhereUniqueWithoutCharged_license_transactionInput | Prisma.LicenseUpdateWithWhereUniqueWithoutCharged_license_transactionInput[]
|
||||
updateMany?: Prisma.LicenseUpdateManyWithWhereWithoutCharged_license_transactionInput | Prisma.LicenseUpdateManyWithWhereWithoutCharged_license_transactionInput[]
|
||||
deleteMany?: Prisma.LicenseScalarWhereInput | Prisma.LicenseScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type LicenseUncheckedUpdateManyWithoutPartnerNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutPartnerInput, Prisma.LicenseUncheckedCreateWithoutPartnerInput> | Prisma.LicenseCreateWithoutPartnerInput[] | Prisma.LicenseUncheckedCreateWithoutPartnerInput[]
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutPartnerInput | Prisma.LicenseCreateOrConnectWithoutPartnerInput[]
|
||||
upsert?: Prisma.LicenseUpsertWithWhereUniqueWithoutPartnerInput | Prisma.LicenseUpsertWithWhereUniqueWithoutPartnerInput[]
|
||||
createMany?: Prisma.LicenseCreateManyPartnerInputEnvelope
|
||||
export type LicenseUncheckedUpdateManyWithoutCharged_license_transactionNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.LicenseCreateWithoutCharged_license_transactionInput, Prisma.LicenseUncheckedCreateWithoutCharged_license_transactionInput> | Prisma.LicenseCreateWithoutCharged_license_transactionInput[] | Prisma.LicenseUncheckedCreateWithoutCharged_license_transactionInput[]
|
||||
connectOrCreate?: Prisma.LicenseCreateOrConnectWithoutCharged_license_transactionInput | Prisma.LicenseCreateOrConnectWithoutCharged_license_transactionInput[]
|
||||
upsert?: Prisma.LicenseUpsertWithWhereUniqueWithoutCharged_license_transactionInput | Prisma.LicenseUpsertWithWhereUniqueWithoutCharged_license_transactionInput[]
|
||||
createMany?: Prisma.LicenseCreateManyCharged_license_transactionInputEnvelope
|
||||
set?: Prisma.LicenseWhereUniqueInput | Prisma.LicenseWhereUniqueInput[]
|
||||
disconnect?: Prisma.LicenseWhereUniqueInput | Prisma.LicenseWhereUniqueInput[]
|
||||
delete?: Prisma.LicenseWhereUniqueInput | Prisma.LicenseWhereUniqueInput[]
|
||||
connect?: Prisma.LicenseWhereUniqueInput | Prisma.LicenseWhereUniqueInput[]
|
||||
update?: Prisma.LicenseUpdateWithWhereUniqueWithoutPartnerInput | Prisma.LicenseUpdateWithWhereUniqueWithoutPartnerInput[]
|
||||
updateMany?: Prisma.LicenseUpdateManyWithWhereWithoutPartnerInput | Prisma.LicenseUpdateManyWithWhereWithoutPartnerInput[]
|
||||
update?: Prisma.LicenseUpdateWithWhereUniqueWithoutCharged_license_transactionInput | Prisma.LicenseUpdateWithWhereUniqueWithoutCharged_license_transactionInput[]
|
||||
updateMany?: Prisma.LicenseUpdateManyWithWhereWithoutCharged_license_transactionInput | Prisma.LicenseUpdateManyWithWhereWithoutCharged_license_transactionInput[]
|
||||
deleteMany?: Prisma.LicenseScalarWhereInput | Prisma.LicenseScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type LicenseCreateWithoutConsumerInput = {
|
||||
export type LicenseCreateWithoutActivated_licenseInput = {
|
||||
id?: string
|
||||
starts_at: Date | string
|
||||
expires_at: Date | string
|
||||
status: $Enums.LicenseStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
partner?: Prisma.PartnerCreateNestedOneWithoutLicensesInput
|
||||
charged_license_transaction: Prisma.ChargedLicenseTransactionsCreateNestedOneWithoutLicensesInput
|
||||
}
|
||||
|
||||
export type LicenseUncheckedCreateWithoutConsumerInput = {
|
||||
export type LicenseUncheckedCreateWithoutActivated_licenseInput = {
|
||||
id?: string
|
||||
starts_at: Date | string
|
||||
expires_at: Date | string
|
||||
status: $Enums.LicenseStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
partner_id?: string | null
|
||||
charged_license_transaction_id: string
|
||||
}
|
||||
|
||||
export type LicenseCreateOrConnectWithoutConsumerInput = {
|
||||
export type LicenseCreateOrConnectWithoutActivated_licenseInput = {
|
||||
where: Prisma.LicenseWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.LicenseCreateWithoutConsumerInput, Prisma.LicenseUncheckedCreateWithoutConsumerInput>
|
||||
create: Prisma.XOR<Prisma.LicenseCreateWithoutActivated_licenseInput, Prisma.LicenseUncheckedCreateWithoutActivated_licenseInput>
|
||||
}
|
||||
|
||||
export type LicenseUpsertWithoutConsumerInput = {
|
||||
update: Prisma.XOR<Prisma.LicenseUpdateWithoutConsumerInput, Prisma.LicenseUncheckedUpdateWithoutConsumerInput>
|
||||
create: Prisma.XOR<Prisma.LicenseCreateWithoutConsumerInput, Prisma.LicenseUncheckedCreateWithoutConsumerInput>
|
||||
export type LicenseUpsertWithoutActivated_licenseInput = {
|
||||
update: Prisma.XOR<Prisma.LicenseUpdateWithoutActivated_licenseInput, Prisma.LicenseUncheckedUpdateWithoutActivated_licenseInput>
|
||||
create: Prisma.XOR<Prisma.LicenseCreateWithoutActivated_licenseInput, Prisma.LicenseUncheckedCreateWithoutActivated_licenseInput>
|
||||
where?: Prisma.LicenseWhereInput
|
||||
}
|
||||
|
||||
export type LicenseUpdateToOneWithWhereWithoutConsumerInput = {
|
||||
export type LicenseUpdateToOneWithWhereWithoutActivated_licenseInput = {
|
||||
where?: Prisma.LicenseWhereInput
|
||||
data: Prisma.XOR<Prisma.LicenseUpdateWithoutConsumerInput, Prisma.LicenseUncheckedUpdateWithoutConsumerInput>
|
||||
data: Prisma.XOR<Prisma.LicenseUpdateWithoutActivated_licenseInput, Prisma.LicenseUncheckedUpdateWithoutActivated_licenseInput>
|
||||
}
|
||||
|
||||
export type LicenseUpdateWithoutConsumerInput = {
|
||||
export type LicenseUpdateWithoutActivated_licenseInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
starts_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
status?: Prisma.EnumLicenseStatusFieldUpdateOperationsInput | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
partner?: Prisma.PartnerUpdateOneWithoutLicensesNestedInput
|
||||
charged_license_transaction?: Prisma.ChargedLicenseTransactionsUpdateOneRequiredWithoutLicensesNestedInput
|
||||
}
|
||||
|
||||
export type LicenseUncheckedUpdateWithoutConsumerInput = {
|
||||
export type LicenseUncheckedUpdateWithoutActivated_licenseInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
starts_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
status?: Prisma.EnumLicenseStatusFieldUpdateOperationsInput | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
partner_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
charged_license_transaction_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
}
|
||||
|
||||
export type LicenseCreateWithoutPartnerInput = {
|
||||
export type LicenseCreateWithoutCharged_license_transactionInput = {
|
||||
id?: string
|
||||
starts_at: Date | string
|
||||
expires_at: Date | string
|
||||
status: $Enums.LicenseStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumer: Prisma.ConsumerCreateNestedOneWithoutLicenseInput
|
||||
activated_license?: Prisma.ActivatedLicenseCreateNestedOneWithoutLicenseInput
|
||||
}
|
||||
|
||||
export type LicenseUncheckedCreateWithoutPartnerInput = {
|
||||
export type LicenseUncheckedCreateWithoutCharged_license_transactionInput = {
|
||||
id?: string
|
||||
starts_at: Date | string
|
||||
expires_at: Date | string
|
||||
status: $Enums.LicenseStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumer_id: string
|
||||
activated_license?: Prisma.ActivatedLicenseUncheckedCreateNestedOneWithoutLicenseInput
|
||||
}
|
||||
|
||||
export type LicenseCreateOrConnectWithoutPartnerInput = {
|
||||
export type LicenseCreateOrConnectWithoutCharged_license_transactionInput = {
|
||||
where: Prisma.LicenseWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.LicenseCreateWithoutPartnerInput, Prisma.LicenseUncheckedCreateWithoutPartnerInput>
|
||||
create: Prisma.XOR<Prisma.LicenseCreateWithoutCharged_license_transactionInput, Prisma.LicenseUncheckedCreateWithoutCharged_license_transactionInput>
|
||||
}
|
||||
|
||||
export type LicenseCreateManyPartnerInputEnvelope = {
|
||||
data: Prisma.LicenseCreateManyPartnerInput | Prisma.LicenseCreateManyPartnerInput[]
|
||||
export type LicenseCreateManyCharged_license_transactionInputEnvelope = {
|
||||
data: Prisma.LicenseCreateManyCharged_license_transactionInput | Prisma.LicenseCreateManyCharged_license_transactionInput[]
|
||||
skipDuplicates?: boolean
|
||||
}
|
||||
|
||||
export type LicenseUpsertWithWhereUniqueWithoutPartnerInput = {
|
||||
export type LicenseUpsertWithWhereUniqueWithoutCharged_license_transactionInput = {
|
||||
where: Prisma.LicenseWhereUniqueInput
|
||||
update: Prisma.XOR<Prisma.LicenseUpdateWithoutPartnerInput, Prisma.LicenseUncheckedUpdateWithoutPartnerInput>
|
||||
create: Prisma.XOR<Prisma.LicenseCreateWithoutPartnerInput, Prisma.LicenseUncheckedCreateWithoutPartnerInput>
|
||||
update: Prisma.XOR<Prisma.LicenseUpdateWithoutCharged_license_transactionInput, Prisma.LicenseUncheckedUpdateWithoutCharged_license_transactionInput>
|
||||
create: Prisma.XOR<Prisma.LicenseCreateWithoutCharged_license_transactionInput, Prisma.LicenseUncheckedCreateWithoutCharged_license_transactionInput>
|
||||
}
|
||||
|
||||
export type LicenseUpdateWithWhereUniqueWithoutPartnerInput = {
|
||||
export type LicenseUpdateWithWhereUniqueWithoutCharged_license_transactionInput = {
|
||||
where: Prisma.LicenseWhereUniqueInput
|
||||
data: Prisma.XOR<Prisma.LicenseUpdateWithoutPartnerInput, Prisma.LicenseUncheckedUpdateWithoutPartnerInput>
|
||||
data: Prisma.XOR<Prisma.LicenseUpdateWithoutCharged_license_transactionInput, Prisma.LicenseUncheckedUpdateWithoutCharged_license_transactionInput>
|
||||
}
|
||||
|
||||
export type LicenseUpdateManyWithWhereWithoutPartnerInput = {
|
||||
export type LicenseUpdateManyWithWhereWithoutCharged_license_transactionInput = {
|
||||
where: Prisma.LicenseScalarWhereInput
|
||||
data: Prisma.XOR<Prisma.LicenseUpdateManyMutationInput, Prisma.LicenseUncheckedUpdateManyWithoutPartnerInput>
|
||||
data: Prisma.XOR<Prisma.LicenseUpdateManyMutationInput, Prisma.LicenseUncheckedUpdateManyWithoutCharged_license_transactionInput>
|
||||
}
|
||||
|
||||
export type LicenseScalarWhereInput = {
|
||||
@@ -582,104 +459,74 @@ export type LicenseScalarWhereInput = {
|
||||
OR?: Prisma.LicenseScalarWhereInput[]
|
||||
NOT?: Prisma.LicenseScalarWhereInput | Prisma.LicenseScalarWhereInput[]
|
||||
id?: Prisma.StringFilter<"License"> | string
|
||||
starts_at?: Prisma.DateTimeFilter<"License"> | Date | string
|
||||
expires_at?: Prisma.DateTimeFilter<"License"> | Date | string
|
||||
status?: Prisma.EnumLicenseStatusFilter<"License"> | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeFilter<"License"> | Date | string
|
||||
updated_at?: Prisma.DateTimeFilter<"License"> | Date | string
|
||||
partner_id?: Prisma.StringNullableFilter<"License"> | string | null
|
||||
consumer_id?: Prisma.StringFilter<"License"> | string
|
||||
charged_license_transaction_id?: Prisma.StringFilter<"License"> | string
|
||||
}
|
||||
|
||||
export type LicenseCreateManyPartnerInput = {
|
||||
export type LicenseCreateManyCharged_license_transactionInput = {
|
||||
id?: string
|
||||
starts_at: Date | string
|
||||
expires_at: Date | string
|
||||
status: $Enums.LicenseStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumer_id: string
|
||||
}
|
||||
|
||||
export type LicenseUpdateWithoutPartnerInput = {
|
||||
export type LicenseUpdateWithoutCharged_license_transactionInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
starts_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
status?: Prisma.EnumLicenseStatusFieldUpdateOperationsInput | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutLicenseNestedInput
|
||||
activated_license?: Prisma.ActivatedLicenseUpdateOneWithoutLicenseNestedInput
|
||||
}
|
||||
|
||||
export type LicenseUncheckedUpdateWithoutPartnerInput = {
|
||||
export type LicenseUncheckedUpdateWithoutCharged_license_transactionInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
starts_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
status?: Prisma.EnumLicenseStatusFieldUpdateOperationsInput | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
activated_license?: Prisma.ActivatedLicenseUncheckedUpdateOneWithoutLicenseNestedInput
|
||||
}
|
||||
|
||||
export type LicenseUncheckedUpdateManyWithoutPartnerInput = {
|
||||
export type LicenseUncheckedUpdateManyWithoutCharged_license_transactionInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
starts_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
expires_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
status?: Prisma.EnumLicenseStatusFieldUpdateOperationsInput | $Enums.LicenseStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
}
|
||||
|
||||
|
||||
|
||||
export type LicenseSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
starts_at?: boolean
|
||||
expires_at?: boolean
|
||||
status?: boolean
|
||||
created_at?: boolean
|
||||
updated_at?: boolean
|
||||
partner_id?: boolean
|
||||
consumer_id?: boolean
|
||||
partner?: boolean | Prisma.License$partnerArgs<ExtArgs>
|
||||
consumer?: boolean | Prisma.ConsumerDefaultArgs<ExtArgs>
|
||||
charged_license_transaction_id?: boolean
|
||||
charged_license_transaction?: boolean | Prisma.ChargedLicenseTransactionsDefaultArgs<ExtArgs>
|
||||
activated_license?: boolean | Prisma.License$activated_licenseArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["license"]>
|
||||
|
||||
|
||||
|
||||
export type LicenseSelectScalar = {
|
||||
id?: boolean
|
||||
starts_at?: boolean
|
||||
expires_at?: boolean
|
||||
status?: boolean
|
||||
created_at?: boolean
|
||||
updated_at?: boolean
|
||||
partner_id?: boolean
|
||||
consumer_id?: boolean
|
||||
charged_license_transaction_id?: boolean
|
||||
}
|
||||
|
||||
export type LicenseOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "starts_at" | "expires_at" | "status" | "created_at" | "updated_at" | "partner_id" | "consumer_id", ExtArgs["result"]["license"]>
|
||||
export type LicenseOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "created_at" | "updated_at" | "charged_license_transaction_id", ExtArgs["result"]["license"]>
|
||||
export type LicenseInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
partner?: boolean | Prisma.License$partnerArgs<ExtArgs>
|
||||
consumer?: boolean | Prisma.ConsumerDefaultArgs<ExtArgs>
|
||||
charged_license_transaction?: boolean | Prisma.ChargedLicenseTransactionsDefaultArgs<ExtArgs>
|
||||
activated_license?: boolean | Prisma.License$activated_licenseArgs<ExtArgs>
|
||||
}
|
||||
|
||||
export type $LicensePayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
name: "License"
|
||||
objects: {
|
||||
partner: Prisma.$PartnerPayload<ExtArgs> | null
|
||||
consumer: Prisma.$ConsumerPayload<ExtArgs>
|
||||
charged_license_transaction: Prisma.$ChargedLicenseTransactionsPayload<ExtArgs>
|
||||
activated_license: Prisma.$ActivatedLicensePayload<ExtArgs> | null
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
starts_at: Date
|
||||
expires_at: Date
|
||||
status: $Enums.LicenseStatus
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
partner_id: string | null
|
||||
consumer_id: string
|
||||
charged_license_transaction_id: string
|
||||
}, ExtArgs["result"]["license"]>
|
||||
composites: {}
|
||||
}
|
||||
@@ -1020,8 +867,8 @@ readonly fields: LicenseFieldRefs;
|
||||
*/
|
||||
export interface Prisma__LicenseClient<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.License$partnerArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.License$partnerArgs<ExtArgs>>): Prisma.Prisma__PartnerClient<runtime.Types.Result.GetResult<Prisma.$PartnerPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
consumer<T extends Prisma.ConsumerDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ConsumerDefaultArgs<ExtArgs>>): Prisma.Prisma__ConsumerClient<runtime.Types.Result.GetResult<Prisma.$ConsumerPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
|
||||
charged_license_transaction<T extends Prisma.ChargedLicenseTransactionsDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ChargedLicenseTransactionsDefaultArgs<ExtArgs>>): Prisma.Prisma__ChargedLicenseTransactionsClient<runtime.Types.Result.GetResult<Prisma.$ChargedLicenseTransactionsPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
|
||||
activated_license<T extends Prisma.License$activated_licenseArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.License$activated_licenseArgs<ExtArgs>>): Prisma.Prisma__ActivatedLicenseClient<runtime.Types.Result.GetResult<Prisma.$ActivatedLicensePayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -1052,13 +899,9 @@ export interface Prisma__LicenseClient<T, Null = never, ExtArgs extends runtime.
|
||||
*/
|
||||
export interface LicenseFieldRefs {
|
||||
readonly id: Prisma.FieldRef<"License", 'String'>
|
||||
readonly starts_at: Prisma.FieldRef<"License", 'DateTime'>
|
||||
readonly expires_at: Prisma.FieldRef<"License", 'DateTime'>
|
||||
readonly status: Prisma.FieldRef<"License", 'LicenseStatus'>
|
||||
readonly created_at: Prisma.FieldRef<"License", 'DateTime'>
|
||||
readonly updated_at: Prisma.FieldRef<"License", 'DateTime'>
|
||||
readonly partner_id: Prisma.FieldRef<"License", 'String'>
|
||||
readonly consumer_id: Prisma.FieldRef<"License", 'String'>
|
||||
readonly charged_license_transaction_id: Prisma.FieldRef<"License", 'String'>
|
||||
}
|
||||
|
||||
|
||||
@@ -1402,22 +1245,22 @@ export type LicenseDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.Inter
|
||||
}
|
||||
|
||||
/**
|
||||
* License.partner
|
||||
* License.activated_license
|
||||
*/
|
||||
export type License$partnerArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
export type License$activated_licenseArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the Partner
|
||||
* Select specific fields to fetch from the ActivatedLicense
|
||||
*/
|
||||
select?: Prisma.PartnerSelect<ExtArgs> | null
|
||||
select?: Prisma.ActivatedLicenseSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the Partner
|
||||
* Omit specific fields from the ActivatedLicense
|
||||
*/
|
||||
omit?: Prisma.PartnerOmit<ExtArgs> | null
|
||||
omit?: Prisma.ActivatedLicenseOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.PartnerInclude<ExtArgs> | null
|
||||
where?: Prisma.PartnerWhereInput
|
||||
include?: Prisma.ActivatedLicenseInclude<ExtArgs> | null
|
||||
where?: Prisma.ActivatedLicenseWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,25 +20,14 @@ export type PartnerModel = runtime.Types.Result.DefaultSelection<Prisma.$Partner
|
||||
|
||||
export type AggregatePartner = {
|
||||
_count: PartnerCountAggregateOutputType | null
|
||||
_avg: PartnerAvgAggregateOutputType | null
|
||||
_sum: PartnerSumAggregateOutputType | null
|
||||
_min: PartnerMinAggregateOutputType | null
|
||||
_max: PartnerMaxAggregateOutputType | null
|
||||
}
|
||||
|
||||
export type PartnerAvgAggregateOutputType = {
|
||||
license_quota: number | null
|
||||
}
|
||||
|
||||
export type PartnerSumAggregateOutputType = {
|
||||
license_quota: number | null
|
||||
}
|
||||
|
||||
export type PartnerMinAggregateOutputType = {
|
||||
id: string | null
|
||||
name: string | null
|
||||
code: string | null
|
||||
license_quota: number | null
|
||||
status: $Enums.PartnerStatus | null
|
||||
created_at: Date | null
|
||||
updated_at: Date | null
|
||||
@@ -48,7 +37,6 @@ export type PartnerMaxAggregateOutputType = {
|
||||
id: string | null
|
||||
name: string | null
|
||||
code: string | null
|
||||
license_quota: number | null
|
||||
status: $Enums.PartnerStatus | null
|
||||
created_at: Date | null
|
||||
updated_at: Date | null
|
||||
@@ -58,7 +46,6 @@ export type PartnerCountAggregateOutputType = {
|
||||
id: number
|
||||
name: number
|
||||
code: number
|
||||
license_quota: number
|
||||
status: number
|
||||
created_at: number
|
||||
updated_at: number
|
||||
@@ -66,19 +53,10 @@ export type PartnerCountAggregateOutputType = {
|
||||
}
|
||||
|
||||
|
||||
export type PartnerAvgAggregateInputType = {
|
||||
license_quota?: true
|
||||
}
|
||||
|
||||
export type PartnerSumAggregateInputType = {
|
||||
license_quota?: true
|
||||
}
|
||||
|
||||
export type PartnerMinAggregateInputType = {
|
||||
id?: true
|
||||
name?: true
|
||||
code?: true
|
||||
license_quota?: true
|
||||
status?: true
|
||||
created_at?: true
|
||||
updated_at?: true
|
||||
@@ -88,7 +66,6 @@ export type PartnerMaxAggregateInputType = {
|
||||
id?: true
|
||||
name?: true
|
||||
code?: true
|
||||
license_quota?: true
|
||||
status?: true
|
||||
created_at?: true
|
||||
updated_at?: true
|
||||
@@ -98,7 +75,6 @@ export type PartnerCountAggregateInputType = {
|
||||
id?: true
|
||||
name?: true
|
||||
code?: true
|
||||
license_quota?: true
|
||||
status?: true
|
||||
created_at?: true
|
||||
updated_at?: true
|
||||
@@ -140,18 +116,6 @@ export type PartnerAggregateArgs<ExtArgs extends runtime.Types.Extensions.Intern
|
||||
* Count returned Partners
|
||||
**/
|
||||
_count?: true | PartnerCountAggregateInputType
|
||||
/**
|
||||
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
|
||||
*
|
||||
* Select which fields to average
|
||||
**/
|
||||
_avg?: PartnerAvgAggregateInputType
|
||||
/**
|
||||
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
|
||||
*
|
||||
* Select which fields to sum
|
||||
**/
|
||||
_sum?: PartnerSumAggregateInputType
|
||||
/**
|
||||
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
|
||||
*
|
||||
@@ -185,8 +149,6 @@ export type PartnerGroupByArgs<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
take?: number
|
||||
skip?: number
|
||||
_count?: PartnerCountAggregateInputType | true
|
||||
_avg?: PartnerAvgAggregateInputType
|
||||
_sum?: PartnerSumAggregateInputType
|
||||
_min?: PartnerMinAggregateInputType
|
||||
_max?: PartnerMaxAggregateInputType
|
||||
}
|
||||
@@ -195,13 +157,10 @@ export type PartnerGroupByOutputType = {
|
||||
id: string
|
||||
name: string
|
||||
code: string
|
||||
license_quota: number | null
|
||||
status: $Enums.PartnerStatus
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
_count: PartnerCountAggregateOutputType | null
|
||||
_avg: PartnerAvgAggregateOutputType | null
|
||||
_sum: PartnerSumAggregateOutputType | null
|
||||
_min: PartnerMinAggregateOutputType | null
|
||||
_max: PartnerMaxAggregateOutputType | null
|
||||
}
|
||||
@@ -228,24 +187,22 @@ export type PartnerWhereInput = {
|
||||
id?: Prisma.StringFilter<"Partner"> | string
|
||||
name?: Prisma.StringFilter<"Partner"> | string
|
||||
code?: Prisma.StringFilter<"Partner"> | string
|
||||
license_quota?: Prisma.IntNullableFilter<"Partner"> | number | null
|
||||
status?: Prisma.EnumPartnerStatusFilter<"Partner"> | $Enums.PartnerStatus
|
||||
created_at?: Prisma.DateTimeFilter<"Partner"> | Date | string
|
||||
updated_at?: Prisma.DateTimeFilter<"Partner"> | Date | string
|
||||
licenses?: Prisma.LicenseListRelationFilter
|
||||
partner_accounts?: Prisma.PartnerAccountListRelationFilter
|
||||
chargedLicenseTransactions?: Prisma.ChargedLicenseTransactionsListRelationFilter
|
||||
}
|
||||
|
||||
export type PartnerOrderByWithRelationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
code?: Prisma.SortOrder
|
||||
license_quota?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
licenses?: Prisma.LicenseOrderByRelationAggregateInput
|
||||
partner_accounts?: Prisma.PartnerAccountOrderByRelationAggregateInput
|
||||
chargedLicenseTransactions?: Prisma.ChargedLicenseTransactionsOrderByRelationAggregateInput
|
||||
_relevance?: Prisma.PartnerOrderByRelevanceInput
|
||||
}
|
||||
|
||||
@@ -256,27 +213,23 @@ export type PartnerWhereUniqueInput = Prisma.AtLeast<{
|
||||
OR?: Prisma.PartnerWhereInput[]
|
||||
NOT?: Prisma.PartnerWhereInput | Prisma.PartnerWhereInput[]
|
||||
name?: Prisma.StringFilter<"Partner"> | string
|
||||
license_quota?: Prisma.IntNullableFilter<"Partner"> | number | null
|
||||
status?: Prisma.EnumPartnerStatusFilter<"Partner"> | $Enums.PartnerStatus
|
||||
created_at?: Prisma.DateTimeFilter<"Partner"> | Date | string
|
||||
updated_at?: Prisma.DateTimeFilter<"Partner"> | Date | string
|
||||
licenses?: Prisma.LicenseListRelationFilter
|
||||
partner_accounts?: Prisma.PartnerAccountListRelationFilter
|
||||
chargedLicenseTransactions?: Prisma.ChargedLicenseTransactionsListRelationFilter
|
||||
}, "id" | "code">
|
||||
|
||||
export type PartnerOrderByWithAggregationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
code?: Prisma.SortOrder
|
||||
license_quota?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
_count?: Prisma.PartnerCountOrderByAggregateInput
|
||||
_avg?: Prisma.PartnerAvgOrderByAggregateInput
|
||||
_max?: Prisma.PartnerMaxOrderByAggregateInput
|
||||
_min?: Prisma.PartnerMinOrderByAggregateInput
|
||||
_sum?: Prisma.PartnerSumOrderByAggregateInput
|
||||
}
|
||||
|
||||
export type PartnerScalarWhereWithAggregatesInput = {
|
||||
@@ -286,7 +239,6 @@ export type PartnerScalarWhereWithAggregatesInput = {
|
||||
id?: Prisma.StringWithAggregatesFilter<"Partner"> | string
|
||||
name?: Prisma.StringWithAggregatesFilter<"Partner"> | string
|
||||
code?: Prisma.StringWithAggregatesFilter<"Partner"> | string
|
||||
license_quota?: Prisma.IntNullableWithAggregatesFilter<"Partner"> | number | null
|
||||
status?: Prisma.EnumPartnerStatusWithAggregatesFilter<"Partner"> | $Enums.PartnerStatus
|
||||
created_at?: Prisma.DateTimeWithAggregatesFilter<"Partner"> | Date | string
|
||||
updated_at?: Prisma.DateTimeWithAggregatesFilter<"Partner"> | Date | string
|
||||
@@ -296,55 +248,50 @@ export type PartnerCreateInput = {
|
||||
id?: string
|
||||
name: string
|
||||
code: string
|
||||
license_quota?: number | null
|
||||
status?: $Enums.PartnerStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
licenses?: Prisma.LicenseCreateNestedManyWithoutPartnerInput
|
||||
partner_accounts?: Prisma.PartnerAccountCreateNestedManyWithoutPartnerInput
|
||||
chargedLicenseTransactions?: Prisma.ChargedLicenseTransactionsCreateNestedManyWithoutPartnerInput
|
||||
}
|
||||
|
||||
export type PartnerUncheckedCreateInput = {
|
||||
id?: string
|
||||
name: string
|
||||
code: string
|
||||
license_quota?: number | null
|
||||
status?: $Enums.PartnerStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
licenses?: Prisma.LicenseUncheckedCreateNestedManyWithoutPartnerInput
|
||||
partner_accounts?: Prisma.PartnerAccountUncheckedCreateNestedManyWithoutPartnerInput
|
||||
chargedLicenseTransactions?: Prisma.ChargedLicenseTransactionsUncheckedCreateNestedManyWithoutPartnerInput
|
||||
}
|
||||
|
||||
export type PartnerUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
license_quota?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
licenses?: Prisma.LicenseUpdateManyWithoutPartnerNestedInput
|
||||
partner_accounts?: Prisma.PartnerAccountUpdateManyWithoutPartnerNestedInput
|
||||
chargedLicenseTransactions?: Prisma.ChargedLicenseTransactionsUpdateManyWithoutPartnerNestedInput
|
||||
}
|
||||
|
||||
export type PartnerUncheckedUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
license_quota?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
licenses?: Prisma.LicenseUncheckedUpdateManyWithoutPartnerNestedInput
|
||||
partner_accounts?: Prisma.PartnerAccountUncheckedUpdateManyWithoutPartnerNestedInput
|
||||
chargedLicenseTransactions?: Prisma.ChargedLicenseTransactionsUncheckedUpdateManyWithoutPartnerNestedInput
|
||||
}
|
||||
|
||||
export type PartnerCreateManyInput = {
|
||||
id?: string
|
||||
name: string
|
||||
code: string
|
||||
license_quota?: number | null
|
||||
status?: $Enums.PartnerStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
@@ -354,7 +301,6 @@ export type PartnerUpdateManyMutationInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
license_quota?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -364,17 +310,11 @@ export type PartnerUncheckedUpdateManyInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
license_quota?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type PartnerNullableScalarRelationFilter = {
|
||||
is?: Prisma.PartnerWhereInput | null
|
||||
isNot?: Prisma.PartnerWhereInput | null
|
||||
}
|
||||
|
||||
export type PartnerScalarRelationFilter = {
|
||||
is?: Prisma.PartnerWhereInput
|
||||
isNot?: Prisma.PartnerWhereInput
|
||||
@@ -390,21 +330,15 @@ export type PartnerCountOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
code?: Prisma.SortOrder
|
||||
license_quota?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type PartnerAvgOrderByAggregateInput = {
|
||||
license_quota?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type PartnerMaxOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
code?: Prisma.SortOrder
|
||||
license_quota?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
@@ -414,30 +348,23 @@ export type PartnerMinOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
code?: Prisma.SortOrder
|
||||
license_quota?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type PartnerSumOrderByAggregateInput = {
|
||||
license_quota?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
export type PartnerCreateNestedOneWithoutLicensesInput = {
|
||||
create?: Prisma.XOR<Prisma.PartnerCreateWithoutLicensesInput, Prisma.PartnerUncheckedCreateWithoutLicensesInput>
|
||||
connectOrCreate?: Prisma.PartnerCreateOrConnectWithoutLicensesInput
|
||||
export type PartnerCreateNestedOneWithoutChargedLicenseTransactionsInput = {
|
||||
create?: Prisma.XOR<Prisma.PartnerCreateWithoutChargedLicenseTransactionsInput, Prisma.PartnerUncheckedCreateWithoutChargedLicenseTransactionsInput>
|
||||
connectOrCreate?: Prisma.PartnerCreateOrConnectWithoutChargedLicenseTransactionsInput
|
||||
connect?: Prisma.PartnerWhereUniqueInput
|
||||
}
|
||||
|
||||
export type PartnerUpdateOneWithoutLicensesNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.PartnerCreateWithoutLicensesInput, Prisma.PartnerUncheckedCreateWithoutLicensesInput>
|
||||
connectOrCreate?: Prisma.PartnerCreateOrConnectWithoutLicensesInput
|
||||
upsert?: Prisma.PartnerUpsertWithoutLicensesInput
|
||||
disconnect?: Prisma.PartnerWhereInput | boolean
|
||||
delete?: Prisma.PartnerWhereInput | boolean
|
||||
export type PartnerUpdateOneRequiredWithoutChargedLicenseTransactionsNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.PartnerCreateWithoutChargedLicenseTransactionsInput, Prisma.PartnerUncheckedCreateWithoutChargedLicenseTransactionsInput>
|
||||
connectOrCreate?: Prisma.PartnerCreateOrConnectWithoutChargedLicenseTransactionsInput
|
||||
upsert?: Prisma.PartnerUpsertWithoutChargedLicenseTransactionsInput
|
||||
connect?: Prisma.PartnerWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.PartnerUpdateToOneWithWhereWithoutLicensesInput, Prisma.PartnerUpdateWithoutLicensesInput>, Prisma.PartnerUncheckedUpdateWithoutLicensesInput>
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.PartnerUpdateToOneWithWhereWithoutChargedLicenseTransactionsInput, Prisma.PartnerUpdateWithoutChargedLicenseTransactionsInput>, Prisma.PartnerUncheckedUpdateWithoutChargedLicenseTransactionsInput>
|
||||
}
|
||||
|
||||
export type PartnerCreateNestedOneWithoutPartner_accountsInput = {
|
||||
@@ -454,72 +381,60 @@ export type PartnerUpdateOneRequiredWithoutPartner_accountsNestedInput = {
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.PartnerUpdateToOneWithWhereWithoutPartner_accountsInput, Prisma.PartnerUpdateWithoutPartner_accountsInput>, Prisma.PartnerUncheckedUpdateWithoutPartner_accountsInput>
|
||||
}
|
||||
|
||||
export type NullableIntFieldUpdateOperationsInput = {
|
||||
set?: number | null
|
||||
increment?: number
|
||||
decrement?: number
|
||||
multiply?: number
|
||||
divide?: number
|
||||
}
|
||||
|
||||
export type EnumPartnerStatusFieldUpdateOperationsInput = {
|
||||
set?: $Enums.PartnerStatus
|
||||
}
|
||||
|
||||
export type PartnerCreateWithoutLicensesInput = {
|
||||
export type PartnerCreateWithoutChargedLicenseTransactionsInput = {
|
||||
id?: string
|
||||
name: string
|
||||
code: string
|
||||
license_quota?: number | null
|
||||
status?: $Enums.PartnerStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
partner_accounts?: Prisma.PartnerAccountCreateNestedManyWithoutPartnerInput
|
||||
}
|
||||
|
||||
export type PartnerUncheckedCreateWithoutLicensesInput = {
|
||||
export type PartnerUncheckedCreateWithoutChargedLicenseTransactionsInput = {
|
||||
id?: string
|
||||
name: string
|
||||
code: string
|
||||
license_quota?: number | null
|
||||
status?: $Enums.PartnerStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
partner_accounts?: Prisma.PartnerAccountUncheckedCreateNestedManyWithoutPartnerInput
|
||||
}
|
||||
|
||||
export type PartnerCreateOrConnectWithoutLicensesInput = {
|
||||
export type PartnerCreateOrConnectWithoutChargedLicenseTransactionsInput = {
|
||||
where: Prisma.PartnerWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.PartnerCreateWithoutLicensesInput, Prisma.PartnerUncheckedCreateWithoutLicensesInput>
|
||||
create: Prisma.XOR<Prisma.PartnerCreateWithoutChargedLicenseTransactionsInput, Prisma.PartnerUncheckedCreateWithoutChargedLicenseTransactionsInput>
|
||||
}
|
||||
|
||||
export type PartnerUpsertWithoutLicensesInput = {
|
||||
update: Prisma.XOR<Prisma.PartnerUpdateWithoutLicensesInput, Prisma.PartnerUncheckedUpdateWithoutLicensesInput>
|
||||
create: Prisma.XOR<Prisma.PartnerCreateWithoutLicensesInput, Prisma.PartnerUncheckedCreateWithoutLicensesInput>
|
||||
export type PartnerUpsertWithoutChargedLicenseTransactionsInput = {
|
||||
update: Prisma.XOR<Prisma.PartnerUpdateWithoutChargedLicenseTransactionsInput, Prisma.PartnerUncheckedUpdateWithoutChargedLicenseTransactionsInput>
|
||||
create: Prisma.XOR<Prisma.PartnerCreateWithoutChargedLicenseTransactionsInput, Prisma.PartnerUncheckedCreateWithoutChargedLicenseTransactionsInput>
|
||||
where?: Prisma.PartnerWhereInput
|
||||
}
|
||||
|
||||
export type PartnerUpdateToOneWithWhereWithoutLicensesInput = {
|
||||
export type PartnerUpdateToOneWithWhereWithoutChargedLicenseTransactionsInput = {
|
||||
where?: Prisma.PartnerWhereInput
|
||||
data: Prisma.XOR<Prisma.PartnerUpdateWithoutLicensesInput, Prisma.PartnerUncheckedUpdateWithoutLicensesInput>
|
||||
data: Prisma.XOR<Prisma.PartnerUpdateWithoutChargedLicenseTransactionsInput, Prisma.PartnerUncheckedUpdateWithoutChargedLicenseTransactionsInput>
|
||||
}
|
||||
|
||||
export type PartnerUpdateWithoutLicensesInput = {
|
||||
export type PartnerUpdateWithoutChargedLicenseTransactionsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
license_quota?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
partner_accounts?: Prisma.PartnerAccountUpdateManyWithoutPartnerNestedInput
|
||||
}
|
||||
|
||||
export type PartnerUncheckedUpdateWithoutLicensesInput = {
|
||||
export type PartnerUncheckedUpdateWithoutChargedLicenseTransactionsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
license_quota?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -530,22 +445,20 @@ export type PartnerCreateWithoutPartner_accountsInput = {
|
||||
id?: string
|
||||
name: string
|
||||
code: string
|
||||
license_quota?: number | null
|
||||
status?: $Enums.PartnerStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
licenses?: Prisma.LicenseCreateNestedManyWithoutPartnerInput
|
||||
chargedLicenseTransactions?: Prisma.ChargedLicenseTransactionsCreateNestedManyWithoutPartnerInput
|
||||
}
|
||||
|
||||
export type PartnerUncheckedCreateWithoutPartner_accountsInput = {
|
||||
id?: string
|
||||
name: string
|
||||
code: string
|
||||
license_quota?: number | null
|
||||
status?: $Enums.PartnerStatus
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
licenses?: Prisma.LicenseUncheckedCreateNestedManyWithoutPartnerInput
|
||||
chargedLicenseTransactions?: Prisma.ChargedLicenseTransactionsUncheckedCreateNestedManyWithoutPartnerInput
|
||||
}
|
||||
|
||||
export type PartnerCreateOrConnectWithoutPartner_accountsInput = {
|
||||
@@ -568,22 +481,20 @@ export type PartnerUpdateWithoutPartner_accountsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
license_quota?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
licenses?: Prisma.LicenseUpdateManyWithoutPartnerNestedInput
|
||||
chargedLicenseTransactions?: Prisma.ChargedLicenseTransactionsUpdateManyWithoutPartnerNestedInput
|
||||
}
|
||||
|
||||
export type PartnerUncheckedUpdateWithoutPartner_accountsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
license_quota?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
licenses?: Prisma.LicenseUncheckedUpdateManyWithoutPartnerNestedInput
|
||||
chargedLicenseTransactions?: Prisma.ChargedLicenseTransactionsUncheckedUpdateManyWithoutPartnerNestedInput
|
||||
}
|
||||
|
||||
|
||||
@@ -592,13 +503,13 @@ export type PartnerUncheckedUpdateWithoutPartner_accountsInput = {
|
||||
*/
|
||||
|
||||
export type PartnerCountOutputType = {
|
||||
licenses: number
|
||||
partner_accounts: number
|
||||
chargedLicenseTransactions: number
|
||||
}
|
||||
|
||||
export type PartnerCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
licenses?: boolean | PartnerCountOutputTypeCountLicensesArgs
|
||||
partner_accounts?: boolean | PartnerCountOutputTypeCountPartner_accountsArgs
|
||||
chargedLicenseTransactions?: boolean | PartnerCountOutputTypeCountChargedLicenseTransactionsArgs
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -614,15 +525,15 @@ export type PartnerCountOutputTypeDefaultArgs<ExtArgs extends runtime.Types.Exte
|
||||
/**
|
||||
* PartnerCountOutputType without action
|
||||
*/
|
||||
export type PartnerCountOutputTypeCountLicensesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.LicenseWhereInput
|
||||
export type PartnerCountOutputTypeCountPartner_accountsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.PartnerAccountWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* PartnerCountOutputType without action
|
||||
*/
|
||||
export type PartnerCountOutputTypeCountPartner_accountsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.PartnerAccountWhereInput
|
||||
export type PartnerCountOutputTypeCountChargedLicenseTransactionsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.ChargedLicenseTransactionsWhereInput
|
||||
}
|
||||
|
||||
|
||||
@@ -630,12 +541,11 @@ export type PartnerSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
||||
id?: boolean
|
||||
name?: boolean
|
||||
code?: boolean
|
||||
license_quota?: boolean
|
||||
status?: boolean
|
||||
created_at?: boolean
|
||||
updated_at?: boolean
|
||||
licenses?: boolean | Prisma.Partner$licensesArgs<ExtArgs>
|
||||
partner_accounts?: boolean | Prisma.Partner$partner_accountsArgs<ExtArgs>
|
||||
chargedLicenseTransactions?: boolean | Prisma.Partner$chargedLicenseTransactionsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.PartnerCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["partner"]>
|
||||
|
||||
@@ -645,30 +555,28 @@ export type PartnerSelectScalar = {
|
||||
id?: boolean
|
||||
name?: boolean
|
||||
code?: boolean
|
||||
license_quota?: boolean
|
||||
status?: boolean
|
||||
created_at?: boolean
|
||||
updated_at?: boolean
|
||||
}
|
||||
|
||||
export type PartnerOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "code" | "license_quota" | "status" | "created_at" | "updated_at", ExtArgs["result"]["partner"]>
|
||||
export type PartnerOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "code" | "status" | "created_at" | "updated_at", ExtArgs["result"]["partner"]>
|
||||
export type PartnerInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
licenses?: boolean | Prisma.Partner$licensesArgs<ExtArgs>
|
||||
partner_accounts?: boolean | Prisma.Partner$partner_accountsArgs<ExtArgs>
|
||||
chargedLicenseTransactions?: boolean | Prisma.Partner$chargedLicenseTransactionsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.PartnerCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
|
||||
export type $PartnerPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
name: "Partner"
|
||||
objects: {
|
||||
licenses: Prisma.$LicensePayload<ExtArgs>[]
|
||||
partner_accounts: Prisma.$PartnerAccountPayload<ExtArgs>[]
|
||||
chargedLicenseTransactions: Prisma.$ChargedLicenseTransactionsPayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
name: string
|
||||
code: string
|
||||
license_quota: number | null
|
||||
status: $Enums.PartnerStatus
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
@@ -1012,8 +920,8 @@ readonly fields: PartnerFieldRefs;
|
||||
*/
|
||||
export interface Prisma__PartnerClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
licenses<T extends Prisma.Partner$licensesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Partner$licensesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$LicensePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
partner_accounts<T extends Prisma.Partner$partner_accountsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Partner$partner_accountsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$PartnerAccountPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
chargedLicenseTransactions<T extends Prisma.Partner$chargedLicenseTransactionsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Partner$chargedLicenseTransactionsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ChargedLicenseTransactionsPayload<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.
|
||||
@@ -1046,7 +954,6 @@ export interface PartnerFieldRefs {
|
||||
readonly id: Prisma.FieldRef<"Partner", 'String'>
|
||||
readonly name: Prisma.FieldRef<"Partner", 'String'>
|
||||
readonly code: Prisma.FieldRef<"Partner", 'String'>
|
||||
readonly license_quota: Prisma.FieldRef<"Partner", 'Int'>
|
||||
readonly status: Prisma.FieldRef<"Partner", 'PartnerStatus'>
|
||||
readonly created_at: Prisma.FieldRef<"Partner", 'DateTime'>
|
||||
readonly updated_at: Prisma.FieldRef<"Partner", 'DateTime'>
|
||||
@@ -1392,30 +1299,6 @@ export type PartnerDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.Inter
|
||||
limit?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Partner.licenses
|
||||
*/
|
||||
export type Partner$licensesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the License
|
||||
*/
|
||||
select?: Prisma.LicenseSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the License
|
||||
*/
|
||||
omit?: Prisma.LicenseOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.LicenseInclude<ExtArgs> | null
|
||||
where?: Prisma.LicenseWhereInput
|
||||
orderBy?: Prisma.LicenseOrderByWithRelationInput | Prisma.LicenseOrderByWithRelationInput[]
|
||||
cursor?: Prisma.LicenseWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.LicenseScalarFieldEnum | Prisma.LicenseScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Partner.partner_accounts
|
||||
*/
|
||||
@@ -1440,6 +1323,30 @@ export type Partner$partner_accountsArgs<ExtArgs extends runtime.Types.Extension
|
||||
distinct?: Prisma.PartnerAccountScalarFieldEnum | Prisma.PartnerAccountScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Partner.chargedLicenseTransactions
|
||||
*/
|
||||
export type Partner$chargedLicenseTransactionsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the ChargedLicenseTransactions
|
||||
*/
|
||||
select?: Prisma.ChargedLicenseTransactionsSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the ChargedLicenseTransactions
|
||||
*/
|
||||
omit?: Prisma.ChargedLicenseTransactionsOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.ChargedLicenseTransactionsInclude<ExtArgs> | null
|
||||
where?: Prisma.ChargedLicenseTransactionsWhereInput
|
||||
orderBy?: Prisma.ChargedLicenseTransactionsOrderByWithRelationInput | Prisma.ChargedLicenseTransactionsOrderByWithRelationInput[]
|
||||
cursor?: Prisma.ChargedLicenseTransactionsWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.ChargedLicenseTransactionsScalarFieldEnum | Prisma.ChargedLicenseTransactionsScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Partner without action
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
|
||||
import { AdminUsersService } from './consumers.service'
|
||||
import { AdminConsumersService } from './consumers.service'
|
||||
import { CreateConsumerDto, UpdateConsumerDto } from './dto/consumer.dto'
|
||||
|
||||
@Controller('admin/consumers')
|
||||
export class AdminUsersController {
|
||||
constructor(private readonly usersService: AdminUsersService) {}
|
||||
constructor(private readonly usersService: AdminConsumersService) {}
|
||||
|
||||
@Get()
|
||||
async findAll() {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Module } from '@nestjs/common'
|
||||
import { AdminUserAccountsModule } from './accounts/accounts.module'
|
||||
import { AdminConsumerBusinessActivitiesModule } from './business-activities/business-activities.module'
|
||||
import { AdminUsersController } from './consumers.controller'
|
||||
import { AdminUsersService } from './consumers.service'
|
||||
import { AdminConsumersService } from './consumers.service'
|
||||
import { AdminConsumerLicensesModule } from './licenses/licenses.module'
|
||||
|
||||
@Module({
|
||||
@@ -14,7 +14,7 @@ import { AdminConsumerLicensesModule } from './licenses/licenses.module'
|
||||
AdminConsumerLicensesModule,
|
||||
],
|
||||
controllers: [AdminUsersController],
|
||||
providers: [AdminUsersService],
|
||||
providers: [AdminConsumersService],
|
||||
exports: [AdminUserAccountsModule],
|
||||
})
|
||||
export class AdminConsumersModule {}
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
AccountStatus,
|
||||
AccountType,
|
||||
ConsumerRole,
|
||||
LicenseStatus,
|
||||
PartnerStatus,
|
||||
} from '@/generated/prisma/enums'
|
||||
import { ConsumerCreateInput, ConsumerSelect } from '@/generated/prisma/models'
|
||||
@@ -13,7 +12,7 @@ import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import { CreateConsumerDto, UpdateConsumerDto } from './dto/consumer.dto'
|
||||
|
||||
@Injectable()
|
||||
export class AdminUsersService {
|
||||
export class AdminConsumersService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
private readonly defaultSelect: ConsumerSelect = {
|
||||
@@ -23,22 +22,67 @@ export class AdminUsersService {
|
||||
mobile_number: true,
|
||||
status: true,
|
||||
created_at: true,
|
||||
license: {
|
||||
activated_licenses: {
|
||||
select: {
|
||||
id: true,
|
||||
starts_at: true,
|
||||
expires_at: true,
|
||||
status: true,
|
||||
partner: {
|
||||
license: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
charged_license_transaction: {
|
||||
select: {
|
||||
partner: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
private readonly mapConsumer = (consumer: any) => {
|
||||
const { activated_licenses, ...rest } = consumer
|
||||
|
||||
let lastLicense: any = null
|
||||
|
||||
if (consumer.activated_licenses.length) {
|
||||
lastLicense = consumer.activated_licenses[0]
|
||||
if (consumer.activated_licenses.length > 1) {
|
||||
const activeLicenseInfo = consumer.activated_licenses.find(
|
||||
activated_license => activated_license.expires_at,
|
||||
)
|
||||
|
||||
if (!activeLicenseInfo) {
|
||||
consumer.activated_licenses.sort((a, b) =>
|
||||
a.expires_at > b.expires_at ? 1 : -1,
|
||||
)
|
||||
lastLicense = consumer.activated_licenses[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
...rest,
|
||||
fullname: `${rest?.first_name} ${rest?.last_name}`,
|
||||
license_info: this.prepareLicenseInfo(lastLicense),
|
||||
}
|
||||
}
|
||||
|
||||
private readonly prepareLicenseInfo = (latestLicense: any) => {
|
||||
if (!latestLicense) return null
|
||||
const { license, ...rest } = latestLicense
|
||||
|
||||
return {
|
||||
...rest,
|
||||
partner: license.charged_license_transaction.partner,
|
||||
}
|
||||
}
|
||||
|
||||
async findAll() {
|
||||
const [consumers, count] = await this.prisma.$transaction([
|
||||
this.prisma.consumer.findMany({
|
||||
@@ -46,32 +90,24 @@ export class AdminUsersService {
|
||||
}),
|
||||
this.prisma.consumer.count(),
|
||||
])
|
||||
return ResponseMapper.paginate(
|
||||
consumers.map(consumer => ({
|
||||
...consumer,
|
||||
fullname: `${consumer.first_name} ${consumer.last_name}`,
|
||||
})),
|
||||
{ count },
|
||||
)
|
||||
|
||||
return ResponseMapper.paginate(consumers.map(this.mapConsumer), { count })
|
||||
}
|
||||
|
||||
async findOne(id: string) {
|
||||
this.prisma.license.findFirst({
|
||||
where: {},
|
||||
})
|
||||
const consumer = await this.prisma.consumer.findUniqueOrThrow({
|
||||
where: { id },
|
||||
select: this.defaultSelect,
|
||||
})
|
||||
|
||||
return ResponseMapper.single({
|
||||
...consumer,
|
||||
fullname: `${consumer?.first_name} ${consumer?.last_name}`,
|
||||
})
|
||||
return ResponseMapper.single(this.mapConsumer(consumer))
|
||||
}
|
||||
|
||||
async create(data: CreateConsumerDto) {
|
||||
const { username, password, license, ...rest } = data
|
||||
const startOfToday = new Date()
|
||||
startOfToday.setHours(0, 0, 0, 0)
|
||||
|
||||
const { username, password, partner_id, ...rest } = data
|
||||
const dataToCreate: ConsumerCreateInput = {
|
||||
...rest,
|
||||
consumer_accounts: {
|
||||
@@ -88,52 +124,37 @@ export class AdminUsersService {
|
||||
},
|
||||
},
|
||||
}
|
||||
if (license) {
|
||||
if (license.partner_id) {
|
||||
const partner = await this.prisma.partner.findUnique({
|
||||
where: {
|
||||
id: license.partner_id,
|
||||
status: PartnerStatus.ACTIVE,
|
||||
if (partner_id) {
|
||||
const partnerLicense = await this.prisma.license.findFirst({
|
||||
where: {
|
||||
charged_license_transaction: {
|
||||
partner: {
|
||||
id: partner_id,
|
||||
status: PartnerStatus.ACTIVE,
|
||||
},
|
||||
},
|
||||
select: {
|
||||
name: true,
|
||||
license_quota: true,
|
||||
_count: {
|
||||
select: {
|
||||
licenses: true,
|
||||
activated_license: null,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
charged_license_transaction: {
|
||||
select: {
|
||||
partner: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
status: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (!partner) {
|
||||
throw new BadRequestException('متاسفانه شریک تجاری مورد نظر شما یافت نشد')
|
||||
}
|
||||
const partnerLicensesRemainsQuota =
|
||||
partner.license_quota || 0 - partner._count.licenses
|
||||
|
||||
if (!partnerLicensesRemainsQuota) {
|
||||
throw new BadRequestException(
|
||||
`تعداد لایسنسهای فعلی شریک تجاری ${partner.name} به پایان رسیده است`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
dataToCreate.license = {
|
||||
create: {
|
||||
starts_at: license.starts_at,
|
||||
expires_at: new Date(
|
||||
new Date(license.starts_at).setFullYear(
|
||||
new Date(license.starts_at).getFullYear() + 1,
|
||||
),
|
||||
).toISOString(),
|
||||
status: LicenseStatus.ACTIVE,
|
||||
partner: {
|
||||
connect: {
|
||||
id: license.partner_id,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (!partnerLicense) {
|
||||
throw new BadRequestException(
|
||||
`تعداد لایسنسهای فعلی شریک تجاری به پایان رسیده است.`,
|
||||
)
|
||||
}
|
||||
}
|
||||
return this.prisma.consumer.create({
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { ConsumerStatus } from '@/generated/prisma/enums'
|
||||
import { ApiProperty, OmitType, PartialType } from '@nestjs/swagger'
|
||||
import { IsEnum, IsObject, IsString } from 'class-validator'
|
||||
import { CreateLicenseDto } from '../licenses/dto/license.dto'
|
||||
import { IsEnum, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreateConsumerDto {
|
||||
@IsString()
|
||||
@@ -24,14 +23,13 @@ export class CreateConsumerDto {
|
||||
@ApiProperty({ required: true })
|
||||
password: string
|
||||
|
||||
@IsObject()
|
||||
@ApiProperty()
|
||||
license: CreateLicenseDto
|
||||
@IsOptional()
|
||||
partner_id: string
|
||||
}
|
||||
export class UpdateConsumerDto extends OmitType(PartialType(CreateConsumerDto), [
|
||||
'password',
|
||||
'username',
|
||||
'license',
|
||||
]) {
|
||||
@IsEnum(ConsumerStatus)
|
||||
@ApiProperty({ enum: ConsumerStatus })
|
||||
|
||||
@@ -17,7 +17,10 @@ export class CreateLicenseDto {
|
||||
)
|
||||
expires_at?: Date
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
nullable: false,
|
||||
})
|
||||
partner_id: string
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Body, Controller, Param, Patch, Post } from '@nestjs/common'
|
||||
import { Body, Controller, Get, Param, Post } from '@nestjs/common'
|
||||
import { ApiTags } from '@nestjs/swagger'
|
||||
import { CreateLicenseDto, UpdateLicenseDto } from './dto/license.dto'
|
||||
import { CreateLicenseDto } from './dto/license.dto'
|
||||
import { LicensesService } from './licenses.service'
|
||||
|
||||
@ApiTags('AdminConsumerAccounts')
|
||||
@@ -8,15 +8,20 @@ import { LicensesService } from './licenses.service'
|
||||
export class LicensesController {
|
||||
constructor(private readonly service: LicensesService) {}
|
||||
|
||||
@Get()
|
||||
async findAll(@Param('consumerId') consumerId: string) {
|
||||
return this.service.findAll(consumerId)
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(@Param('consumerId') consumerId: string, @Body() data: CreateLicenseDto) {
|
||||
return this.service.create(consumerId, data)
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
async update(@Param('id') id: string, @Body() data: UpdateLicenseDto) {
|
||||
return this.service.update(id, data)
|
||||
}
|
||||
// @Patch(':id')
|
||||
// async update(@Param('id') id: string, @Body() data: UpdateLicenseDto) {
|
||||
// return this.service.update(id, data)
|
||||
// }
|
||||
|
||||
// @Delete(':id')
|
||||
// async delete(@Param('id') id: string) {
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import { LicenseStatus } from '@/generated/prisma/enums'
|
||||
import { LicenseUpdateInput } from '@/generated/prisma/models'
|
||||
import { PartnerStatus } from '@/generated/prisma/enums'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { BadRequestException, Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import { CreateLicenseDto, UpdateLicenseDto } from './dto/license.dto'
|
||||
import { CreateLicenseDto } from './dto/license.dto'
|
||||
|
||||
@Injectable()
|
||||
export class LicensesService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
private startOfToday = new Date()
|
||||
|
||||
constructor(private readonly prisma: PrismaService) {
|
||||
this.startOfToday.setHours(0, 0, 0, 0)
|
||||
}
|
||||
|
||||
private readonly setExpireDate = (starts_at: Date) => {
|
||||
return new Date(
|
||||
@@ -15,85 +18,143 @@ export class LicensesService {
|
||||
).toISOString()
|
||||
}
|
||||
|
||||
async create(consumerId: string, data: CreateLicenseDto) {
|
||||
const { starts_at, expires_at } = data
|
||||
const license = await this.prisma.license.create({
|
||||
data: {
|
||||
starts_at,
|
||||
expires_at: expires_at ?? this.setExpireDate(starts_at),
|
||||
partner: {
|
||||
connect: {
|
||||
id: data.partner_id,
|
||||
async findAll(consumer_id: string) {
|
||||
const licenses = await this.prisma.activatedLicense.findMany({
|
||||
where: {
|
||||
consumer_id,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
starts_at: true,
|
||||
expires_at: true,
|
||||
created_at: true,
|
||||
license: {
|
||||
select: {
|
||||
id: true,
|
||||
charged_license_transaction: {
|
||||
select: {
|
||||
partner: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
consumer: {
|
||||
connect: {
|
||||
id: consumerId,
|
||||
},
|
||||
},
|
||||
status: LicenseStatus.ACTIVE,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.create(license)
|
||||
|
||||
return ResponseMapper.list(licenses)
|
||||
}
|
||||
|
||||
async update(id: string, data: UpdateLicenseDto) {
|
||||
async create(consumerId: string, data: CreateLicenseDto) {
|
||||
const { starts_at, expires_at, partner_id } = data
|
||||
const currentLicense = await this.prisma.license.findUnique({
|
||||
where: { id },
|
||||
select: {
|
||||
partner_id: true,
|
||||
},
|
||||
})
|
||||
|
||||
if (partner_id && currentLicense?.partner_id !== partner_id) {
|
||||
const partner = await this.prisma.partner.findUnique({
|
||||
const license = await this.prisma.$transaction(async tx => {
|
||||
const partnerLicense = await tx.license.findFirst({
|
||||
where: {
|
||||
id: partner_id,
|
||||
activated_license: null,
|
||||
charged_license_transaction: {
|
||||
activation_expires_at: {
|
||||
gte: this.startOfToday,
|
||||
},
|
||||
partner: {
|
||||
id: partner_id,
|
||||
status: PartnerStatus.ACTIVE,
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
name: true,
|
||||
license_quota: true,
|
||||
_count: {
|
||||
select: {
|
||||
licenses: true,
|
||||
id: true,
|
||||
},
|
||||
})
|
||||
|
||||
if (!partnerLicense) {
|
||||
throw new BadRequestException(
|
||||
`تعداد لایسنسهای فعلی شریک تجاری به پایان رسیده است.`,
|
||||
)
|
||||
}
|
||||
|
||||
return await this.prisma.activatedLicense.create({
|
||||
data: {
|
||||
starts_at,
|
||||
expires_at: expires_at ?? this.setExpireDate(starts_at),
|
||||
consumer: {
|
||||
connect: {
|
||||
id: consumerId,
|
||||
},
|
||||
},
|
||||
license: {
|
||||
connect: {
|
||||
id: partnerLicense.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (!((partner?.license_quota || 0) - (partner?._count.licenses || 0))) {
|
||||
throw new BadRequestException(`تعداد لایسنسهای ${partner?.name} کافی نیست.`)
|
||||
}
|
||||
}
|
||||
|
||||
const dataToUpdate: LicenseUpdateInput = {}
|
||||
|
||||
if (partner_id) {
|
||||
dataToUpdate.partner = {
|
||||
connect: {
|
||||
id: partner_id,
|
||||
},
|
||||
}
|
||||
} else if (currentLicense?.partner_id) {
|
||||
dataToUpdate.partner = {
|
||||
disconnect: {
|
||||
id: currentLicense?.partner_id,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if (starts_at) {
|
||||
dataToUpdate.starts_at = starts_at
|
||||
dataToUpdate.expires_at = this.setExpireDate(starts_at)
|
||||
}
|
||||
|
||||
const license = await this.prisma.license.update({
|
||||
where: { id },
|
||||
data: {
|
||||
...dataToUpdate,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.update(license)
|
||||
|
||||
return ResponseMapper.create(license)
|
||||
}
|
||||
|
||||
// async update(id: string, data: UpdateLicenseDto) {
|
||||
// const { starts_at, expires_at, partner_id } = data
|
||||
// const currentLicense = await this.prisma.license.findUnique({
|
||||
// where: { id },
|
||||
// select: {
|
||||
// partner_id: true,
|
||||
// },
|
||||
// })
|
||||
|
||||
// if (partner_id && currentLicense?.partner_id !== partner_id) {
|
||||
// const partner = await this.prisma.partner.findUnique({
|
||||
// where: {
|
||||
// id: partner_id,
|
||||
// },
|
||||
// select: {
|
||||
// name: true,
|
||||
// license_quota: true,
|
||||
// _count: {
|
||||
// select: {
|
||||
// licenses: true,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
|
||||
// if (!((partner?.license_quota || 0) - (partner?._count.licenses || 0))) {
|
||||
// throw new BadRequestException(`تعداد لایسنسهای ${partner?.name} کافی نیست.`)
|
||||
// }
|
||||
// }
|
||||
|
||||
// const dataToUpdate: LicenseUpdateInput = {}
|
||||
|
||||
// if (partner_id) {
|
||||
// dataToUpdate.partner = {
|
||||
// connect: {
|
||||
// id: partner_id,
|
||||
// },
|
||||
// }
|
||||
// } else if (currentLicense?.partner_id) {
|
||||
// dataToUpdate.partner = {
|
||||
// disconnect: {
|
||||
// id: currentLicense?.partner_id,
|
||||
// },
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (starts_at) {
|
||||
// dataToUpdate.starts_at = starts_at
|
||||
// dataToUpdate.expires_at = this.setExpireDate(starts_at)
|
||||
// }
|
||||
|
||||
// const license = await this.prisma.license.update({
|
||||
// where: { id },
|
||||
// data: {
|
||||
// ...dataToUpdate,
|
||||
// },
|
||||
// })
|
||||
// return ResponseMapper.update(license)
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { PrismaModule } from '@/prisma/prisma.module'
|
||||
import { Module } from '@nestjs/common'
|
||||
import { GoodsController } from './goods.controller'
|
||||
import { GoodsService } from './goods.service'
|
||||
import { GuildGoodImagesModule } from './images/images.module'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule, GuildGoodImagesModule],
|
||||
controllers: [GoodsController],
|
||||
providers: [GoodsService],
|
||||
})
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import { TokenAccount } from '@/common/decorators/tokenInfo.decorator'
|
||||
import { multerImageOptions } from '@/multer.config'
|
||||
import {
|
||||
BadRequestException,
|
||||
Controller,
|
||||
Param,
|
||||
Post,
|
||||
UploadedFile,
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common'
|
||||
import { FileInterceptor } from '@nestjs/platform-express'
|
||||
import { ApiBody, ApiConsumes } from '@nestjs/swagger'
|
||||
import { GuildGoodImagesService } from './images.service'
|
||||
|
||||
@Controller('admin/guilds/:guildId/goods/:goodId/images')
|
||||
export class GuildGoodImagesController {
|
||||
constructor(private readonly service: GuildGoodImagesService) {}
|
||||
|
||||
@Post('')
|
||||
@UseInterceptors(FileInterceptor('file', multerImageOptions))
|
||||
@ApiConsumes('multipart/form-data')
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
file: { type: 'string', format: 'binary' },
|
||||
},
|
||||
},
|
||||
})
|
||||
async uploadImage(
|
||||
@TokenAccount('account_id') accountId: string,
|
||||
@Param('guildId') guildId: string,
|
||||
@Param('goodId') goodId: string,
|
||||
@UploadedFile() file: Express.Multer.File,
|
||||
) {
|
||||
if (!file) {
|
||||
throw new BadRequestException('فایل را وارد کنید')
|
||||
}
|
||||
|
||||
const url = await this.service.uploadFile(accountId, goodId, file)
|
||||
return { url }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { UploaderModule } from '@/modules/uploader/uploader.module'
|
||||
import { PrismaModule } from '@/prisma/prisma.module'
|
||||
import { Module } from '@nestjs/common'
|
||||
import { GuildGoodImagesController } from './images.controller'
|
||||
import { GuildGoodImagesService } from './images.service'
|
||||
|
||||
@Module({
|
||||
controllers: [GuildGoodImagesController],
|
||||
providers: [GuildGoodImagesService],
|
||||
imports: [PrismaModule, UploaderModule],
|
||||
})
|
||||
export class GuildGoodImagesModule {}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { UploadedFileTypes } from '@/common/enums/enums'
|
||||
import { UploaderService } from '@/modules/uploader/uploader.service'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { BadRequestException, Injectable } from '@nestjs/common'
|
||||
|
||||
@Injectable()
|
||||
export class GuildGoodImagesService {
|
||||
constructor(
|
||||
private readonly prisma: PrismaService,
|
||||
private readonly uploadFileService: UploaderService,
|
||||
) {}
|
||||
|
||||
async uploadFile(account_id: string, goodId: string, file: Express.Multer.File) {
|
||||
try {
|
||||
const currentImage = await this.prisma.good.findUniqueOrThrow({
|
||||
where: {
|
||||
id: goodId,
|
||||
},
|
||||
select: {
|
||||
image_url: true,
|
||||
},
|
||||
})
|
||||
const url = await this.uploadFileService.uploadFile(file, UploadedFileTypes.GOOD)
|
||||
if (url) {
|
||||
if (currentImage.image_url) {
|
||||
this.uploadFileService.deleteFile(currentImage.image_url)
|
||||
}
|
||||
return this.prisma.good.update({
|
||||
where: {
|
||||
id: goodId,
|
||||
is_default_guild_good: true,
|
||||
},
|
||||
data: {
|
||||
image_url: url,
|
||||
},
|
||||
})
|
||||
} else {
|
||||
throw new BadRequestException('متاسفانه در بارگذاری فایل مشکلی پیش آمده')
|
||||
}
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Body, Controller, Get, Param, Patch } from '@nestjs/common'
|
||||
import { UpdateLicenseDto } from './dto/license.dto'
|
||||
import { Controller, Get, Param } from '@nestjs/common'
|
||||
import { PartnerLicensesService } from './licenses.service'
|
||||
|
||||
@Controller('admin/licenses')
|
||||
@@ -16,10 +15,10 @@ export class LicensesController {
|
||||
return this.licensesService.findOne(id)
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
async update(@Param('id') id: string, @Body() data: UpdateLicenseDto) {
|
||||
return this.licensesService.update(id, data)
|
||||
}
|
||||
// @Patch(':id')
|
||||
// async update(@Param('id') id: string, @Body() data: UpdateLicenseDto) {
|
||||
// return this.licensesService.update(id, data)
|
||||
// }
|
||||
|
||||
// @Delete(':id')
|
||||
// async delete(@Param('id') id: string) {
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
import { LicenseSelect } from '@/generated/prisma/models'
|
||||
import { ActivatedLicenseSelect } from '@/generated/prisma/models'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import { UpdateLicenseDto } from './dto/license.dto'
|
||||
|
||||
@Injectable()
|
||||
export class PartnerLicensesService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
private readonly licenseDefaultSelect: LicenseSelect = {
|
||||
private readonly licenseDefaultSelect: ActivatedLicenseSelect = {
|
||||
id: true,
|
||||
starts_at: true,
|
||||
expires_at: true,
|
||||
status: true,
|
||||
consumer: {
|
||||
select: {
|
||||
first_name: true,
|
||||
@@ -21,22 +19,31 @@ export class PartnerLicensesService {
|
||||
status: true,
|
||||
},
|
||||
},
|
||||
partner: {
|
||||
license: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
charged_license_transaction: {
|
||||
select: {
|
||||
partner: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
async findAll(page = 1, pageSize = 10) {
|
||||
const [licenses, count] = await this.prisma.$transaction([
|
||||
this.prisma.license.findMany({
|
||||
this.prisma.activatedLicense.findMany({
|
||||
select: this.licenseDefaultSelect,
|
||||
skip: (page - 1) * pageSize,
|
||||
take: pageSize,
|
||||
}),
|
||||
this.prisma.license.count(),
|
||||
this.prisma.activatedLicense.count(),
|
||||
])
|
||||
|
||||
return ResponseMapper.paginate(licenses, {
|
||||
@@ -47,22 +54,13 @@ export class PartnerLicensesService {
|
||||
}
|
||||
|
||||
async findOne(id: string) {
|
||||
const license = await this.prisma.license.findFirst({
|
||||
where: { id },
|
||||
include: this.licenseDefaultSelect,
|
||||
omit: {
|
||||
partner_id: true,
|
||||
const license = await this.prisma.activatedLicense.findFirst({
|
||||
where: {
|
||||
id,
|
||||
},
|
||||
select: this.licenseDefaultSelect,
|
||||
})
|
||||
|
||||
return ResponseMapper.single(license)
|
||||
}
|
||||
|
||||
async update(id: string, data: UpdateLicenseDto) {
|
||||
const license = await this.prisma.license.update({
|
||||
where: { id },
|
||||
data: { ...data },
|
||||
})
|
||||
return ResponseMapper.update(license)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Controller, Get, Param } from '@nestjs/common'
|
||||
import { ApiTags } from '@nestjs/swagger'
|
||||
import { PartnerActivatedLicensesService } from './activatedLicenses.service'
|
||||
|
||||
@ApiTags('AdminPartnerActivatedLicenses')
|
||||
@Controller('admin/partners/:partnerId/activated-licenses')
|
||||
export class PartnerLicensesController {
|
||||
constructor(private readonly service: PartnerActivatedLicensesService) {}
|
||||
|
||||
@Get()
|
||||
async findAll(@Param('partnerId') partnerId: string) {
|
||||
return this.service.findAll(partnerId)
|
||||
}
|
||||
|
||||
// @Get(':id')
|
||||
// async findOne(@Param('partnerId') partnerId: string, @Param('id') id: string) {
|
||||
// return this.service.findOne(partnerId, id)
|
||||
// }
|
||||
|
||||
// @Post()
|
||||
// async create(
|
||||
// @Param('partnerId') partnerId: string,
|
||||
// @Body() data: CreatePartnerLicenseDto,
|
||||
// ) {
|
||||
// return this.licensesService.create(partnerId, data)
|
||||
// }
|
||||
|
||||
// @Patch(':id')
|
||||
// async update(
|
||||
// @Param('partnerId') partnerId: string,
|
||||
// @Param('id') id: string,
|
||||
// @Body() data: UpdateLicenseDto,
|
||||
// ) {
|
||||
// return this.licensesService.update(partnerId, id, data)
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { PrismaModule } from '@/prisma/prisma.module'
|
||||
import { Module } from '@nestjs/common'
|
||||
import { PartnerLicensesController } from './activatedLicenses.controller'
|
||||
import { PartnerActivatedLicensesService } from './activatedLicenses.service'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
controllers: [PartnerLicensesController],
|
||||
providers: [PartnerActivatedLicensesService],
|
||||
exports: [PartnerActivatedLicensesService],
|
||||
})
|
||||
export class AdminPartnerActivatedLicensesModule {}
|
||||
@@ -0,0 +1,62 @@
|
||||
import { ActivatedLicenseWhereInput } from '@/generated/prisma/models'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
|
||||
@Injectable()
|
||||
export class PartnerActivatedLicensesService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
async findAll(partner_id: string, page = 1, pageSize = 10) {
|
||||
const defaultWhere: ActivatedLicenseWhereInput = {
|
||||
license: {
|
||||
charged_license_transaction: {
|
||||
partner_id,
|
||||
},
|
||||
},
|
||||
}
|
||||
const [licenses, count] = await this.prisma.$transaction(async tx => [
|
||||
await tx.activatedLicense.findMany({
|
||||
where: defaultWhere,
|
||||
skip: (page - 1) * pageSize,
|
||||
take: pageSize,
|
||||
select: {
|
||||
id: true,
|
||||
starts_at: true,
|
||||
expires_at: true,
|
||||
license_id: true,
|
||||
created_at: true,
|
||||
consumer: {
|
||||
select: {
|
||||
id: true,
|
||||
first_name: true,
|
||||
last_name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
await tx.activatedLicense.count({
|
||||
where: defaultWhere,
|
||||
}),
|
||||
])
|
||||
|
||||
return ResponseMapper.paginate(licenses, {
|
||||
page,
|
||||
pageSize,
|
||||
count,
|
||||
})
|
||||
}
|
||||
|
||||
// async update(partnerId: string, id: string, data: UpdateLicenseDto) {
|
||||
// const license = await this.prisma.license.update({
|
||||
// where: { id },
|
||||
// data: { ...data, partner_id: partnerId },
|
||||
// })
|
||||
// return ResponseMapper.update(license)
|
||||
// }
|
||||
|
||||
async delete(partnerId: string, id: string) {
|
||||
await this.prisma.license.delete({ where: { id } })
|
||||
return ResponseMapper.delete()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export class CreatePartnerLicenseDto {}
|
||||
|
||||
export class UpdateLicenseDto {}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
import { Body, Controller, Get, Param, Post } from '@nestjs/common'
|
||||
import { ApiTags } from '@nestjs/swagger'
|
||||
import { PartnerChargedLicenseTransactionsService } from './chargedLicenseTransactions.service'
|
||||
import { ChargeLicenseDto } from './dto/chargedLicenseTransactions.dto'
|
||||
|
||||
@ApiTags('AdminPartnerChargedLicenseTransactions')
|
||||
@Controller('admin/partners/:partnerId/charge-license-transactions')
|
||||
export class PartnerChargedLicenseTransactionsController {
|
||||
constructor(private readonly service: PartnerChargedLicenseTransactionsService) {}
|
||||
|
||||
@Get()
|
||||
async findAll(@Param('partnerId') partnerId: string) {
|
||||
return this.service.findAll(partnerId)
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
async findOne(@Param('partnerId') partnerId: string, @Param('id') id: string) {
|
||||
return this.service.findOne(partnerId, id)
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(@Param('partnerId') partnerId: string, @Body() data: ChargeLicenseDto) {
|
||||
return this.service.create(partnerId, data)
|
||||
}
|
||||
|
||||
// @Patch(':id')
|
||||
// async update(
|
||||
// @Param('partnerId') partnerId: string,
|
||||
// @Param('id') id: string,
|
||||
// @Body() data: UpdateLicenseDto,
|
||||
// ) {
|
||||
// return this.licensesService.update(partnerId, id, data)
|
||||
// }
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import { PrismaModule } from '@/prisma/prisma.module'
|
||||
import { Module } from '@nestjs/common'
|
||||
import { PartnerChargedLicenseTransactionsController } from './chargedLicenseTransactions.controller'
|
||||
import { PartnerChargedLicenseTransactionsService } from './chargedLicenseTransactions.service'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
controllers: [PartnerChargedLicenseTransactionsController],
|
||||
providers: [PartnerChargedLicenseTransactionsService],
|
||||
exports: [PartnerChargedLicenseTransactionsService],
|
||||
})
|
||||
export class AdminPartnerChargedLicenseTransactionsModule {}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
import {
|
||||
ChargedLicenseTransactionsWhereInput,
|
||||
LicenseCreateInput,
|
||||
} from '@/generated/prisma/models'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { BadRequestException, Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import { ChargeLicenseDto } from './dto/chargedLicenseTransactions.dto'
|
||||
|
||||
@Injectable()
|
||||
export class PartnerChargedLicenseTransactionsService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
private readonly mappedTransaction = (transaction: any) => {
|
||||
const { licenses, ...rest } = transaction
|
||||
return {
|
||||
...rest,
|
||||
charged_license_count: licenses.length,
|
||||
remained_license_count: licenses.filter(license => !license?.activated_license)
|
||||
.length,
|
||||
}
|
||||
}
|
||||
|
||||
async findAll(partner_id: string, page = 1, pageSize = 10) {
|
||||
const defaultWhere: ChargedLicenseTransactionsWhereInput = {
|
||||
partner_id,
|
||||
}
|
||||
|
||||
const [transactions, count] = await this.prisma.$transaction(async tx => [
|
||||
await tx.chargedLicenseTransactions.findMany({
|
||||
where: defaultWhere,
|
||||
skip: (page - 1) * pageSize,
|
||||
take: pageSize,
|
||||
select: {
|
||||
id: true,
|
||||
created_at: true,
|
||||
activation_expires_at: true,
|
||||
licenses: {
|
||||
select: {
|
||||
activated_license: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
await tx.chargedLicenseTransactions.count({
|
||||
where: defaultWhere,
|
||||
}),
|
||||
])
|
||||
|
||||
const mappedTransactions = transactions.map(this.mappedTransaction)
|
||||
|
||||
return ResponseMapper.paginate(mappedTransactions, {
|
||||
page,
|
||||
pageSize,
|
||||
count,
|
||||
})
|
||||
}
|
||||
|
||||
async findOne(partner_id: string, id: string) {
|
||||
const transaction = this.prisma.chargedLicenseTransactions.findUniqueOrThrow({
|
||||
where: {
|
||||
id,
|
||||
partner_id,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
created_at: true,
|
||||
activation_expires_at: true,
|
||||
licenses: {
|
||||
select: {
|
||||
id: true,
|
||||
activated_license: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
return ResponseMapper.single(this.mappedTransaction(transaction))
|
||||
}
|
||||
|
||||
async create(partner_id: string, data: ChargeLicenseDto) {
|
||||
try {
|
||||
return await this.prisma.$transaction(async tx => {
|
||||
const transaction = await tx.chargedLicenseTransactions.create({
|
||||
data: {
|
||||
activation_expires_at: data.activated_expires_at,
|
||||
partner: { connect: { id: partner_id } },
|
||||
},
|
||||
})
|
||||
|
||||
if (!transaction) {
|
||||
throw new BadRequestException('متاسفانه مشکلی پیش آمده است.')
|
||||
}
|
||||
|
||||
const licenseCreationPromises: any[] = []
|
||||
for (let i = 0; i < data.quantity; i++) {
|
||||
const license: LicenseCreateInput = {
|
||||
charged_license_transaction: {
|
||||
connect: {
|
||||
id: transaction.id,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
licenseCreationPromises.push(tx.license.create({ data: license }))
|
||||
}
|
||||
const createdLicenses = await Promise.all(licenseCreationPromises)
|
||||
|
||||
return { transaction, createdLicenses }
|
||||
})
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import { IsDateString, IsNumber } from 'class-validator'
|
||||
|
||||
export class CreatePartnerLicenseDto {}
|
||||
|
||||
export class UpdateLicenseDto {}
|
||||
|
||||
export class ChargeLicenseDto {
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
minimum: 1,
|
||||
maximum: 10_000,
|
||||
})
|
||||
@IsNumber({
|
||||
maxDecimalPlaces: 0,
|
||||
})
|
||||
quantity: number
|
||||
|
||||
@ApiProperty({
|
||||
required: true,
|
||||
})
|
||||
@IsDateString()
|
||||
activated_expires_at: string
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
import { IsDateString, IsEnum, IsOptional, IsString } from 'class-validator'
|
||||
import { AccountStatus, LicenseStatus, POSType } from 'generated/prisma/enums'
|
||||
|
||||
export class CreatePartnerLicenseDto {
|
||||
@IsString()
|
||||
first_name: string
|
||||
|
||||
@IsString()
|
||||
last_name: string
|
||||
|
||||
@IsString()
|
||||
mobile_number: string
|
||||
|
||||
@IsString()
|
||||
national_code: string
|
||||
|
||||
@IsString()
|
||||
username: string
|
||||
|
||||
@IsString()
|
||||
password: string
|
||||
|
||||
@IsEnum(AccountStatus)
|
||||
account_status: AccountStatus
|
||||
|
||||
@IsString()
|
||||
guild: string
|
||||
|
||||
@IsString()
|
||||
business_activity_name: string
|
||||
|
||||
@IsString()
|
||||
tax_id: string
|
||||
|
||||
@IsString()
|
||||
complex_name: string
|
||||
|
||||
@IsString()
|
||||
pos_serial: string
|
||||
|
||||
@IsString()
|
||||
pos_status: string
|
||||
|
||||
@IsEnum(POSType)
|
||||
pos_type: POSType
|
||||
|
||||
@IsString()
|
||||
pos_device: string
|
||||
|
||||
@IsDateString()
|
||||
@IsOptional()
|
||||
starts_at: string
|
||||
|
||||
@IsDateString()
|
||||
@IsOptional()
|
||||
expires_at: string
|
||||
}
|
||||
|
||||
export class UpdateLicenseDto {
|
||||
@IsString()
|
||||
pos_id?: string
|
||||
|
||||
@IsDateString()
|
||||
starts_at?: string
|
||||
|
||||
@IsDateString()
|
||||
expires_at?: string
|
||||
|
||||
@IsEnum(LicenseStatus)
|
||||
status?: LicenseStatus
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
|
||||
import { CreatePartnerLicenseDto, UpdateLicenseDto } from './dto/license.dto'
|
||||
import { PartnerLicensesService } from './licenses.service'
|
||||
|
||||
@Controller('admin/partners/:partnerId/licenses')
|
||||
export class PartnerLicensesController {
|
||||
constructor(private readonly licensesService: PartnerLicensesService) {}
|
||||
|
||||
@Get()
|
||||
async findAll(@Param('partnerId') partnerId: string) {
|
||||
return this.licensesService.findAll(partnerId)
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
async findOne(@Param('partnerId') partnerId: string, @Param('id') id: string) {
|
||||
return this.licensesService.findOne(partnerId, id)
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(
|
||||
@Param('partnerId') partnerId: string,
|
||||
@Body() data: CreatePartnerLicenseDto,
|
||||
) {
|
||||
return this.licensesService.create(partnerId, data)
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
async update(
|
||||
@Param('partnerId') partnerId: string,
|
||||
@Param('id') id: string,
|
||||
@Body() data: UpdateLicenseDto,
|
||||
) {
|
||||
return this.licensesService.update(partnerId, id, data)
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
import { PrismaModule } from '@/prisma/prisma.module'
|
||||
import { Module } from '@nestjs/common'
|
||||
import { PartnerLicensesController } from './licenses.controller'
|
||||
import { PartnerLicensesService } from './licenses.service'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
controllers: [PartnerLicensesController],
|
||||
providers: [PartnerLicensesService],
|
||||
exports: [PartnerLicensesService],
|
||||
})
|
||||
export class AdminPartnerLicensesModule {}
|
||||
@@ -1,183 +0,0 @@
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import { CreatePartnerLicenseDto, UpdateLicenseDto } from './dto/license.dto'
|
||||
|
||||
@Injectable()
|
||||
export class PartnerLicensesService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
async findAll(partner_id: string, page = 1, pageSize = 10) {
|
||||
const [licenses, count] = await this.prisma.$transaction(async tx => [
|
||||
await tx.license.findMany({
|
||||
where: {
|
||||
partner_id,
|
||||
},
|
||||
skip: (page - 1) * pageSize,
|
||||
take: pageSize,
|
||||
select: {
|
||||
id: true,
|
||||
starts_at: true,
|
||||
expires_at: true,
|
||||
consumer: {
|
||||
select: {
|
||||
id: true,
|
||||
first_name: true,
|
||||
last_name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
await tx.license.count({
|
||||
where: {
|
||||
partner_id,
|
||||
},
|
||||
}),
|
||||
])
|
||||
|
||||
return ResponseMapper.paginate(licenses, {
|
||||
page,
|
||||
pageSize,
|
||||
count,
|
||||
})
|
||||
}
|
||||
|
||||
async findOne(partnerId: string, id: string) {
|
||||
// const license = await this.prisma.license.findFirst({
|
||||
// where: { id, partner_id: partnerId },
|
||||
// include: {
|
||||
// pos: {
|
||||
// include: {
|
||||
// complex: true,
|
||||
// provider: true,
|
||||
|
||||
// accounts: {
|
||||
// include: {
|
||||
// user: true,
|
||||
// },
|
||||
// omit: {
|
||||
// business_id: true,
|
||||
// partner_id: true,
|
||||
// provider_id: true,
|
||||
// pos_id: true,
|
||||
// },
|
||||
// },
|
||||
// device: {
|
||||
// include: {
|
||||
// brand: true,
|
||||
// },
|
||||
// omit: {
|
||||
// brand_id: true,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// omit: {
|
||||
// pos_id: true,
|
||||
// partner_id: true,
|
||||
// },
|
||||
// })
|
||||
// if (license) {
|
||||
// const { pos, ...rest } = license
|
||||
// const { accounts, ...posRest } = pos
|
||||
// return ResponseMapper.single({
|
||||
// account: accounts[0],
|
||||
// pos: posRest,
|
||||
// ...rest,
|
||||
// })
|
||||
// }
|
||||
|
||||
return ResponseMapper.single({})
|
||||
}
|
||||
|
||||
async create(partnerId: string, data: CreatePartnerLicenseDto) {
|
||||
// const license = await this.prisma.$transaction(async tx => {
|
||||
// const user = await tx.user.upsert({
|
||||
// where: {
|
||||
// mobile_number: data.mobile_number,
|
||||
// },
|
||||
// update: {},
|
||||
// create: {
|
||||
// first_name: data.first_name,
|
||||
// last_name: data.last_name,
|
||||
// mobile_number: data.mobile_number,
|
||||
// national_code: data.national_code,
|
||||
// },
|
||||
// })
|
||||
|
||||
// const business = await tx.businessActivity.create({
|
||||
// data: {
|
||||
// name: data.business_activity_name,
|
||||
// guild_id: data.guild,
|
||||
// user: {
|
||||
// connect: {
|
||||
// id: user.id,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
|
||||
// const complex = await tx.complex.create({
|
||||
// data: {
|
||||
// name: data.complex_name,
|
||||
// tax_id: data.tax_id,
|
||||
// business_activity_id: business.id,
|
||||
// },
|
||||
// })
|
||||
|
||||
// const pos = await tx.pos.create({
|
||||
// data: {
|
||||
// pos_type: data.pos_type,
|
||||
// serial: data.pos_serial,
|
||||
// device_id: data.pos_device,
|
||||
// complex_id: complex.id,
|
||||
// },
|
||||
// })
|
||||
|
||||
// const date = new Date()
|
||||
// const expiresAt = new Date(date.setFullYear(date.getFullYear() + 1))
|
||||
|
||||
// const license = await tx.license.create({
|
||||
// data: {
|
||||
// partner_id: partnerId,
|
||||
// pos_id: pos.id,
|
||||
// starts_at: data.starts_at || new Date(),
|
||||
// expires_at: data.expires_at || expiresAt,
|
||||
// status: LicenseStatus.ACTIVE,
|
||||
// },
|
||||
// })
|
||||
|
||||
// const hashedPassword = await PasswordUtil.hash(data.password)
|
||||
|
||||
// const account = await tx.account.create({
|
||||
// data: {
|
||||
// username: data.username,
|
||||
// password: hashedPassword,
|
||||
// type: AccountType.POS,
|
||||
// user_id: user.id,
|
||||
// pos_id: pos.id,
|
||||
// status: data.account_status,
|
||||
// },
|
||||
// })
|
||||
|
||||
// return {
|
||||
// license,
|
||||
// }
|
||||
// })
|
||||
return ResponseMapper.create('license')
|
||||
}
|
||||
|
||||
async update(partnerId: string, id: string, data: UpdateLicenseDto) {
|
||||
const license = await this.prisma.license.update({
|
||||
where: { id },
|
||||
data: { ...data, partner_id: partnerId },
|
||||
})
|
||||
return ResponseMapper.update(license)
|
||||
}
|
||||
|
||||
async delete(partnerId: string, id: string) {
|
||||
await this.prisma.license.delete({ where: { id } })
|
||||
return ResponseMapper.delete()
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post } from '@nestjs/common'
|
||||
import { CreatePartnerDto, LicenseChargeDto, UpdatePartnerDto } from './dto/partner.dto'
|
||||
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
|
||||
import { CreatePartnerDto, UpdatePartnerDto } from './dto/partner.dto'
|
||||
import { PartnersService } from './partners.service'
|
||||
|
||||
@Controller('admin/partners')
|
||||
@@ -26,13 +26,8 @@ export class PartnersController {
|
||||
return this.partnersService.update(id, data)
|
||||
}
|
||||
|
||||
@Post(':id/charge-license')
|
||||
async licenseCharge(@Param('id') id: string, @Body() data: LicenseChargeDto) {
|
||||
return this.partnersService.licenseCharge(id, data)
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
async delete(@Param('id') id: string) {
|
||||
return this.partnersService.delete(id)
|
||||
}
|
||||
// @Delete(':id')
|
||||
// async delete(@Param('id') id: string) {
|
||||
// return this.partnersService.delete(id)
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
import { PrismaModule } from '@/prisma/prisma.module'
|
||||
import { Module } from '@nestjs/common'
|
||||
|
||||
import { AdminPartnerLicensesModule } from './licenses/licenses.module'
|
||||
import { AdminPartnerActivatedLicensesModule } from './activatedLicenses/activatedLicenses.module'
|
||||
import { AdminPartnerChargedLicenseTransactionsModule } from './chargedLicenseTransactions/chargedLicenseTransactions.module'
|
||||
import { AdminPartnerAccountsModule } from './partnerAccounts/accounts.module'
|
||||
import { PartnersController } from './partners.controller'
|
||||
import { PartnersService } from './partners.service'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule, AdminPartnerLicensesModule, AdminPartnerAccountsModule],
|
||||
imports: [
|
||||
PrismaModule,
|
||||
AdminPartnerChargedLicenseTransactionsModule,
|
||||
AdminPartnerActivatedLicensesModule,
|
||||
AdminPartnerAccountsModule,
|
||||
],
|
||||
controllers: [PartnersController],
|
||||
providers: [PartnersService],
|
||||
exports: [PartnersService],
|
||||
|
||||
@@ -1,43 +1,111 @@
|
||||
import { PasswordUtil } from '@/common/utils/password.util'
|
||||
import { ChargedLicenseTransactions } from '@/generated/prisma/client'
|
||||
import {
|
||||
AccountStatus,
|
||||
AccountType,
|
||||
PartnerRole,
|
||||
PartnerStatus,
|
||||
} from '@/generated/prisma/enums'
|
||||
import { PartnerSelect } from '@/generated/prisma/models'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import { CreatePartnerDto, LicenseChargeDto, UpdatePartnerDto } from './dto/partner.dto'
|
||||
import { CreatePartnerDto, UpdatePartnerDto } from './dto/partner.dto'
|
||||
|
||||
@Injectable()
|
||||
export class PartnersService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
private readonly defaultSelect: PartnerSelect = {
|
||||
id: true,
|
||||
name: true,
|
||||
code: true,
|
||||
status: true,
|
||||
created_at: true,
|
||||
chargedLicenseTransactions: {
|
||||
select: {
|
||||
activation_expires_at: true,
|
||||
licenses: {
|
||||
select: {
|
||||
activated_license: {
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
private readonly separateLicenseCount = (
|
||||
transactions: ChargedLicenseTransactions[] | null,
|
||||
) => {
|
||||
function toDateOnlyString(date) {
|
||||
return date.toISOString().slice(0, 10)
|
||||
}
|
||||
|
||||
const startOfTodayDate = toDateOnlyString(new Date())
|
||||
|
||||
const used = transactions?.reduce((sum, cur) => {
|
||||
const license = cur as any
|
||||
return (
|
||||
sum + license.licenses.filter(license => license.activated_license).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.activated_license).length || 0
|
||||
)
|
||||
return sum
|
||||
}, 0)
|
||||
|
||||
return {
|
||||
total,
|
||||
used,
|
||||
expired,
|
||||
}
|
||||
}
|
||||
|
||||
async findAll() {
|
||||
const partners = await this.prisma.partner.findMany()
|
||||
return ResponseMapper.list(partners)
|
||||
const partners = await this.prisma.partner.findMany({
|
||||
select: this.defaultSelect,
|
||||
})
|
||||
|
||||
const mappedPartners = partners.map(partner => {
|
||||
const { chargedLicenseTransactions, ...rest } = partner
|
||||
return {
|
||||
...rest,
|
||||
licenses_status: this.separateLicenseCount(chargedLicenseTransactions),
|
||||
}
|
||||
})
|
||||
|
||||
return ResponseMapper.list(mappedPartners)
|
||||
}
|
||||
|
||||
async findOne(id: string) {
|
||||
const [partner, relatedLicenseCount] = await this.prisma.$transaction([
|
||||
this.prisma.partner.findUnique({
|
||||
where: { id },
|
||||
}),
|
||||
this.prisma.license.count({
|
||||
where: {
|
||||
partner_id: id,
|
||||
},
|
||||
}),
|
||||
])
|
||||
|
||||
return ResponseMapper.single({
|
||||
...partner,
|
||||
remained_license: Math.max(
|
||||
(partner?.license_quota || 0) - (relatedLicenseCount || 0),
|
||||
0,
|
||||
),
|
||||
const partner = await this.prisma.partner.findUniqueOrThrow({
|
||||
where: { id },
|
||||
select: this.defaultSelect,
|
||||
})
|
||||
|
||||
const { chargedLicenseTransactions, ...rest } = partner
|
||||
const mappedPartner = {
|
||||
...rest,
|
||||
licenses_status: this.separateLicenseCount(chargedLicenseTransactions),
|
||||
}
|
||||
|
||||
return ResponseMapper.single(mappedPartner)
|
||||
}
|
||||
|
||||
async create(data: CreatePartnerDto) {
|
||||
@@ -60,23 +128,16 @@ export class PartnersService {
|
||||
},
|
||||
},
|
||||
},
|
||||
select: this.defaultSelect,
|
||||
})
|
||||
return ResponseMapper.create(partner)
|
||||
}
|
||||
|
||||
async update(id: string, data: UpdatePartnerDto) {
|
||||
const partner = await this.prisma.partner.update({ where: { id }, data })
|
||||
return ResponseMapper.update(partner)
|
||||
}
|
||||
|
||||
async licenseCharge(id: string, data: LicenseChargeDto) {
|
||||
const partner = await this.prisma.partner.update({
|
||||
where: { id },
|
||||
data: {
|
||||
license_quota: {
|
||||
increment: data.count,
|
||||
},
|
||||
},
|
||||
data,
|
||||
select: this.defaultSelect,
|
||||
})
|
||||
return ResponseMapper.update(partner)
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ export class ConsumerComplexGoodsService {
|
||||
local_sku: true,
|
||||
pricing_model: true,
|
||||
unit_type: true,
|
||||
image_url: true,
|
||||
category: {
|
||||
select: {
|
||||
id: true,
|
||||
|
||||
@@ -48,7 +48,6 @@ export class ConsumerMiddleware implements NestMiddleware {
|
||||
account_id: consumerAccount.id,
|
||||
id: consumerAccount.consumer_id,
|
||||
}
|
||||
console.log(consumerAccount)
|
||||
|
||||
req.decodedToken = tokenAccount
|
||||
|
||||
|
||||
@@ -17,14 +17,23 @@ export class ConsumerService {
|
||||
last_name: true,
|
||||
mobile_number: true,
|
||||
status: true,
|
||||
license: {
|
||||
activated_licenses: {
|
||||
select: {
|
||||
id: true,
|
||||
starts_at: true,
|
||||
expires_at: true,
|
||||
status: true,
|
||||
partner: {
|
||||
license: {
|
||||
select: {
|
||||
name: true,
|
||||
id: true,
|
||||
charged_license_transaction: {
|
||||
select: {
|
||||
partner: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -32,9 +41,26 @@ export class ConsumerService {
|
||||
},
|
||||
})
|
||||
|
||||
const { activated_licenses, ...rest } = consumer
|
||||
|
||||
const mappedData = {
|
||||
...rest,
|
||||
activated_licenses: activated_licenses.map(activatedLicense => {
|
||||
const { license, ...rest } = activatedLicense
|
||||
return {
|
||||
...rest,
|
||||
license: {
|
||||
id: license.id,
|
||||
partner: license.charged_license_transaction.partner,
|
||||
},
|
||||
}
|
||||
}),
|
||||
}
|
||||
|
||||
return ResponseMapper.single({
|
||||
...consumer,
|
||||
full_name: `${consumer?.first_name} ${consumer?.last_name}`,
|
||||
activated_licenses: mappedData,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,10 @@ export class PartnerCustomersService {
|
||||
first_name: true,
|
||||
last_name: true,
|
||||
status: true,
|
||||
license: {
|
||||
activated_licenses: {
|
||||
select: {
|
||||
id: true,
|
||||
starts_at: true,
|
||||
status: true,
|
||||
expires_at: true,
|
||||
created_at: true,
|
||||
},
|
||||
@@ -25,8 +24,14 @@ export class PartnerCustomersService {
|
||||
}
|
||||
|
||||
private defaultWhere = (partner_id: string): ConsumerWhereInput => ({
|
||||
license: {
|
||||
partner_id,
|
||||
activated_licenses: {
|
||||
some: {
|
||||
license: {
|
||||
charged_license_transaction: {
|
||||
partner_id,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -48,9 +53,7 @@ export class PartnerCustomersService {
|
||||
async findOne(partner_id: string, consumer_id: string) {
|
||||
const partner = await this.prisma.consumer.findUniqueOrThrow({
|
||||
where: {
|
||||
license: {
|
||||
partner_id,
|
||||
},
|
||||
...(this.defaultWhere(partner_id) as any),
|
||||
id: consumer_id,
|
||||
},
|
||||
select: this.defaultSelect,
|
||||
|
||||
@@ -13,7 +13,6 @@ export class PosController {
|
||||
async getInfo(@PosInfo('pos_id') pos_id: string, @Res({ passthrough: true }) res) {
|
||||
const result = await this.service.getInfo(pos_id)
|
||||
|
||||
console.log('firstaaaaa')
|
||||
if (result) {
|
||||
console.log('first')
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { DeleteObjectCommand, PutObjectCommand, S3Client } from '@aws-sdk/client-s3'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ConfigService } from '@nestjs/config'
|
||||
import { randomUUID } from 'crypto'
|
||||
|
||||
@Injectable()
|
||||
@@ -9,7 +8,7 @@ export class StorageService {
|
||||
private readonly bucket: string
|
||||
private readonly endpoint: string
|
||||
|
||||
constructor(private readonly config: ConfigService) {
|
||||
constructor() {
|
||||
;((this.endpoint = process.env.ARVANCLOUD_ENDPOINT!),
|
||||
(this.bucket = process.env.ARVANCLOUD_BUCKET!),
|
||||
(this.s3 = new S3Client({
|
||||
@@ -25,18 +24,25 @@ export class StorageService {
|
||||
|
||||
async uploadFile(file: Express.Multer.File, folder = 'uploads') {
|
||||
const key = `${folder}/${randomUUID()}-${file.originalname}`
|
||||
await this.s3.send(
|
||||
new PutObjectCommand({
|
||||
Bucket: this.bucket,
|
||||
Key: key,
|
||||
Body: file.buffer,
|
||||
ContentType: file.mimetype,
|
||||
}),
|
||||
)
|
||||
return this.s3
|
||||
.send(
|
||||
new PutObjectCommand({
|
||||
Bucket: this.bucket,
|
||||
Key: key,
|
||||
Body: file.buffer,
|
||||
ContentType: file.mimetype,
|
||||
}),
|
||||
)
|
||||
.then(res => {
|
||||
const publicUrl = `${this.endpoint}/${this.bucket}/${key}`
|
||||
return publicUrl
|
||||
})
|
||||
.catch(ex => {
|
||||
console.log(ex)
|
||||
throw ex
|
||||
})
|
||||
|
||||
// ArvanCloud uses public URLs like:
|
||||
const publicUrl = `${this.endpoint}/${this.bucket}/${key}`
|
||||
return { key, url: publicUrl }
|
||||
}
|
||||
|
||||
async deleteFile(key: string) {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { UploadedFileTypes } from '@/common/enums/enums'
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import { IsEnum } from 'class-validator'
|
||||
|
||||
export class UploadImageDto {
|
||||
@ApiProperty({
|
||||
enum: UploadedFileTypes,
|
||||
example: UploadedFileTypes.GOOD,
|
||||
})
|
||||
@IsEnum(UploadedFileTypes)
|
||||
type: UploadedFileTypes
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { UploaderService } from './uploader.service'
|
||||
|
||||
@Injectable()
|
||||
export class ImageUploaderService {
|
||||
constructor(private readonly uploaderService: UploaderService) {}
|
||||
|
||||
async uploadImage(file: Express.Multer.File, type: '') {
|
||||
// return this.uploaderService.uploadFile(file.buffer, file.originalname, type)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { multerImageOptions } from '@/multer.config'
|
||||
import {
|
||||
BadRequestException,
|
||||
Body,
|
||||
Controller,
|
||||
Post,
|
||||
UploadedFile,
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common'
|
||||
import { FileInterceptor } from '@nestjs/platform-express'
|
||||
import { ApiBody, ApiConsumes } from '@nestjs/swagger'
|
||||
import { UploadImageDto } from './dto/image-upload.dto'
|
||||
import { UploaderService } from './uploader.service'
|
||||
|
||||
@Controller('uploader')
|
||||
export class UploaderController {
|
||||
constructor(private readonly service: UploaderService) {}
|
||||
|
||||
@Post('image')
|
||||
@UseInterceptors(FileInterceptor('file', multerImageOptions))
|
||||
@ApiConsumes('multipart/form-data')
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
file: { type: 'string', format: 'binary' },
|
||||
type: {
|
||||
type: 'string',
|
||||
enum: ['avatar', 'banner', 'document', 'product'],
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
async uploadImage(
|
||||
@UploadedFile() file: Express.Multer.File,
|
||||
@Body() dto: UploadImageDto,
|
||||
) {
|
||||
if (!file) {
|
||||
throw new BadRequestException('فایل را وارد کنید')
|
||||
}
|
||||
|
||||
const url = await this.service.uploadFile(file, dto.type)
|
||||
return { url }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Module } from '@nestjs/common'
|
||||
import { ImageUploaderService } from './image-uploader.service'
|
||||
import { StorageService } from '../storage/storage.service'
|
||||
import { UploaderController } from './uploader.controller'
|
||||
import { UploaderService } from './uploader.service'
|
||||
|
||||
@Module({
|
||||
providers: [UploaderService, ImageUploaderService],
|
||||
providers: [UploaderService, StorageService],
|
||||
controllers: [UploaderController],
|
||||
exports: [UploaderService, ImageUploaderService],
|
||||
exports: [UploaderService],
|
||||
})
|
||||
export class UploaderModule {}
|
||||
@@ -0,0 +1,33 @@
|
||||
import { UploadedFileTypes } from '@/common/enums/enums'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { StorageService } from '../storage/storage.service'
|
||||
|
||||
@Injectable()
|
||||
export class UploaderService {
|
||||
constructor(private readonly storageService: StorageService) {}
|
||||
|
||||
async uploadFile(file: Express.Multer.File, type: UploadedFileTypes) {
|
||||
const uploaded = await this.storageService.uploadFile(file, type)
|
||||
return uploaded
|
||||
|
||||
// await fs.mkdir(dirPath, { recursive: true })
|
||||
// await fs.writeFile(filePath, buffer)
|
||||
|
||||
// Return a URL path, e.g. /uploads/{accountId}/{type}/{filename}
|
||||
// return `/uploads/${type}/${filename}`
|
||||
}
|
||||
|
||||
async deleteFile(url: string) {
|
||||
const key = url?.split('/').pop()
|
||||
if (key) {
|
||||
return await this.storageService.deleteFile(key)
|
||||
}
|
||||
return {}
|
||||
|
||||
// await fs.mkdir(dirPath, { recursive: true })
|
||||
// await fs.writeFile(filePath, buffer)
|
||||
|
||||
// Return a URL path, e.g. /uploads/{accountId}/{type}/{filename}
|
||||
// return `/uploads/${type}/${filename}`
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
import { TUploadedFileTypes } from '@/common/models'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { UploaderService } from './uploader.service'
|
||||
|
||||
@Injectable()
|
||||
export class ImageUploaderService {
|
||||
constructor(private readonly uploaderService: UploaderService) {}
|
||||
|
||||
async uploadImage(
|
||||
file: Express.Multer.File,
|
||||
type: TUploadedFileTypes,
|
||||
): Promise<string> {
|
||||
return this.uploaderService.uploadFile(file.buffer, file.originalname, type)
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import type { TUploadedFileTypes } from '@/common/models'
|
||||
import { Body, Controller, Post, UploadedFile, UseInterceptors } from '@nestjs/common'
|
||||
import { FileInterceptor } from '@nestjs/platform-express'
|
||||
import { ImageUploaderService } from './image-uploader.service'
|
||||
|
||||
@Controller('uploader')
|
||||
export class UploaderController {
|
||||
constructor(private readonly imageUploaderService: ImageUploaderService) {}
|
||||
|
||||
@Post('image')
|
||||
@UseInterceptors(FileInterceptor('file'))
|
||||
async uploadImage(
|
||||
@UploadedFile() file: Express.Multer.File,
|
||||
@Body('accountId') accountId: string,
|
||||
@Body('type') type: TUploadedFileTypes,
|
||||
) {
|
||||
const url = await this.imageUploaderService.uploadImage(file, type)
|
||||
return { url }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { TUploadedFileTypes } from '@/common/models'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { promises as fs } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
@Injectable()
|
||||
export class UploaderService {
|
||||
private uploadDir = join(process.cwd(), 'uploads')
|
||||
|
||||
async uploadFile(
|
||||
buffer: Buffer,
|
||||
originalname: string,
|
||||
type: TUploadedFileTypes,
|
||||
): Promise<string> {
|
||||
const ext = originalname.split('.').pop()
|
||||
const filename = `${uuidv4()}.${ext}`
|
||||
const dirPath = join(this.uploadDir, type)
|
||||
const filePath = join(dirPath, filename)
|
||||
await fs.mkdir(dirPath, { recursive: true })
|
||||
await fs.writeFile(filePath, buffer)
|
||||
// Return a URL path, e.g. /uploads/{accountId}/{type}/{filename}
|
||||
return `/uploads/${type}/${filename}`
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { BadRequestException } from '@nestjs/common'
|
||||
|
||||
export const imageFileFilter = (
|
||||
req: any,
|
||||
file: Express.Multer.File,
|
||||
callback: (error: Error | null, acceptFile: boolean) => void,
|
||||
) => {
|
||||
if (!file.mimetype.startsWith('image/')) {
|
||||
return callback(new BadRequestException('Only image files are allowed'), false)
|
||||
}
|
||||
|
||||
const allowed = ['image/jpeg', 'image/png', 'image/webp']
|
||||
|
||||
if (!allowed.includes(file.mimetype)) {
|
||||
return callback(
|
||||
new BadRequestException('Only JPEG, PNG, WEBP images are allowed'),
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
callback(null, true)
|
||||
}
|
||||
|
||||
export const multerImageOptions = {
|
||||
fileFilter: imageFileFilter,
|
||||
limits: { fileSize: 5 * 1024 * 1024 }, // 5MB
|
||||
}
|
||||
Reference in New Issue
Block a user