feat: Refactor accounts service and related DTOs to enhance consumer account management
- Updated AccountsService to filter out OWNER roles in findAll method. - Removed CreateConsumerAccountDto and its role property from account creation logic. - Enhanced BusinessActivitiesService to include complex counts in responses. - Modified ComplexesController and ComplexesService to handle consumer-specific logic. - Introduced CreateConsumerComplexDto and UpdateConsumerComplexDto for complex management. - Updated PosesController and PosesService to manage POS creation and updates with consumer context. - Added utility function to calculate remaining accounts for business activities. - Updated Prisma migration to add account_id to poses and enforce unique constraints.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[account_id]` on the table `poses` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `licenses` MODIFY `accounts_limit` INTEGER NOT NULL DEFAULT 2;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `partners` ADD COLUMN `logo_url` VARCHAR(191) NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `poses` ADD COLUMN `account_id` VARCHAR(191) NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `poses_account_id_key` ON `poses`(`account_id`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `poses` ADD CONSTRAINT `poses_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -11,6 +11,7 @@ model ConsumerAccount {
|
||||
account_id String @unique()
|
||||
account Account @relation(fields: [account_id], references: [id])
|
||||
|
||||
pos Pos?
|
||||
permission PermissionConsumer?
|
||||
sales_invoices SalesInvoice[]
|
||||
|
||||
@@ -101,6 +102,9 @@ model Pos {
|
||||
device_id String?
|
||||
device Device? @relation(fields: [device_id], references: [id])
|
||||
|
||||
account_id String? @unique
|
||||
account ConsumerAccount? @relation(fields: [account_id], references: [id])
|
||||
|
||||
provider_id String?
|
||||
provider Provider? @relation(fields: [provider_id], references: [id])
|
||||
|
||||
|
||||
@@ -25,9 +25,6 @@ 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,
|
||||
|
||||
@@ -9,6 +9,16 @@ export const select: PosSelect = {
|
||||
created_at: true,
|
||||
pos_type: true,
|
||||
|
||||
account: {
|
||||
select: {
|
||||
account: {
|
||||
select: {
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
provider: {
|
||||
select: {
|
||||
id: true,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -3154,6 +3154,7 @@ export const PosScalarFieldEnum = {
|
||||
updated_at: 'updated_at',
|
||||
complex_id: 'complex_id',
|
||||
device_id: 'device_id',
|
||||
account_id: 'account_id',
|
||||
provider_id: 'provider_id'
|
||||
} as const
|
||||
|
||||
@@ -3285,6 +3286,7 @@ export const PartnerScalarFieldEnum = {
|
||||
name: 'name',
|
||||
code: 'code',
|
||||
status: 'status',
|
||||
logo_url: 'logo_url',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at'
|
||||
} as const
|
||||
@@ -3674,6 +3676,7 @@ export const PosOrderByRelevanceFieldEnum = {
|
||||
serial_number: 'serial_number',
|
||||
complex_id: 'complex_id',
|
||||
device_id: 'device_id',
|
||||
account_id: 'account_id',
|
||||
provider_id: 'provider_id'
|
||||
} as const
|
||||
|
||||
@@ -3772,7 +3775,8 @@ export type PartnerAccountOrderByRelevanceFieldEnum = (typeof PartnerAccountOrde
|
||||
export const PartnerOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
code: 'code'
|
||||
code: 'code',
|
||||
logo_url: 'logo_url'
|
||||
} as const
|
||||
|
||||
export type PartnerOrderByRelevanceFieldEnum = (typeof PartnerOrderByRelevanceFieldEnum)[keyof typeof PartnerOrderByRelevanceFieldEnum]
|
||||
|
||||
@@ -207,6 +207,7 @@ export const PosScalarFieldEnum = {
|
||||
updated_at: 'updated_at',
|
||||
complex_id: 'complex_id',
|
||||
device_id: 'device_id',
|
||||
account_id: 'account_id',
|
||||
provider_id: 'provider_id'
|
||||
} as const
|
||||
|
||||
@@ -338,6 +339,7 @@ export const PartnerScalarFieldEnum = {
|
||||
name: 'name',
|
||||
code: 'code',
|
||||
status: 'status',
|
||||
logo_url: 'logo_url',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at'
|
||||
} as const
|
||||
@@ -727,6 +729,7 @@ export const PosOrderByRelevanceFieldEnum = {
|
||||
serial_number: 'serial_number',
|
||||
complex_id: 'complex_id',
|
||||
device_id: 'device_id',
|
||||
account_id: 'account_id',
|
||||
provider_id: 'provider_id'
|
||||
} as const
|
||||
|
||||
@@ -825,7 +828,8 @@ export type PartnerAccountOrderByRelevanceFieldEnum = (typeof PartnerAccountOrde
|
||||
export const PartnerOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
code: 'code'
|
||||
code: 'code',
|
||||
logo_url: 'logo_url'
|
||||
} as const
|
||||
|
||||
export type PartnerOrderByRelevanceFieldEnum = (typeof PartnerOrderByRelevanceFieldEnum)[keyof typeof PartnerOrderByRelevanceFieldEnum]
|
||||
|
||||
@@ -192,6 +192,7 @@ export type ConsumerAccountWhereInput = {
|
||||
account_id?: Prisma.StringFilter<"ConsumerAccount"> | string
|
||||
consumer?: Prisma.XOR<Prisma.ConsumerScalarRelationFilter, Prisma.ConsumerWhereInput>
|
||||
account?: Prisma.XOR<Prisma.AccountScalarRelationFilter, Prisma.AccountWhereInput>
|
||||
pos?: Prisma.XOR<Prisma.PosNullableScalarRelationFilter, Prisma.PosWhereInput> | null
|
||||
permission?: Prisma.XOR<Prisma.PermissionConsumerNullableScalarRelationFilter, Prisma.PermissionConsumerWhereInput> | null
|
||||
sales_invoices?: Prisma.SalesInvoiceListRelationFilter
|
||||
}
|
||||
@@ -205,6 +206,7 @@ export type ConsumerAccountOrderByWithRelationInput = {
|
||||
account_id?: Prisma.SortOrder
|
||||
consumer?: Prisma.ConsumerOrderByWithRelationInput
|
||||
account?: Prisma.AccountOrderByWithRelationInput
|
||||
pos?: Prisma.PosOrderByWithRelationInput
|
||||
permission?: Prisma.PermissionConsumerOrderByWithRelationInput
|
||||
sales_invoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput
|
||||
_relevance?: Prisma.ConsumerAccountOrderByRelevanceInput
|
||||
@@ -222,6 +224,7 @@ export type ConsumerAccountWhereUniqueInput = Prisma.AtLeast<{
|
||||
consumer_id?: Prisma.StringFilter<"ConsumerAccount"> | string
|
||||
consumer?: Prisma.XOR<Prisma.ConsumerScalarRelationFilter, Prisma.ConsumerWhereInput>
|
||||
account?: Prisma.XOR<Prisma.AccountScalarRelationFilter, Prisma.AccountWhereInput>
|
||||
pos?: Prisma.XOR<Prisma.PosNullableScalarRelationFilter, Prisma.PosWhereInput> | null
|
||||
permission?: Prisma.XOR<Prisma.PermissionConsumerNullableScalarRelationFilter, Prisma.PermissionConsumerWhereInput> | null
|
||||
sales_invoices?: Prisma.SalesInvoiceListRelationFilter
|
||||
}, "id" | "account_id">
|
||||
@@ -257,6 +260,7 @@ export type ConsumerAccountCreateInput = {
|
||||
updated_at?: Date | string
|
||||
consumer: Prisma.ConsumerCreateNestedOneWithoutConsumer_accountsInput
|
||||
account: Prisma.AccountCreateNestedOneWithoutConsumer_accountInput
|
||||
pos?: Prisma.PosCreateNestedOneWithoutAccountInput
|
||||
permission?: Prisma.PermissionConsumerCreateNestedOneWithoutConsumer_accountInput
|
||||
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutConsumer_accountInput
|
||||
}
|
||||
@@ -268,6 +272,7 @@ export type ConsumerAccountUncheckedCreateInput = {
|
||||
updated_at?: Date | string
|
||||
consumer_id: string
|
||||
account_id: string
|
||||
pos?: Prisma.PosUncheckedCreateNestedOneWithoutAccountInput
|
||||
permission?: Prisma.PermissionConsumerUncheckedCreateNestedOneWithoutConsumer_accountInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutConsumer_accountInput
|
||||
}
|
||||
@@ -279,6 +284,7 @@ export type ConsumerAccountUpdateInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutConsumer_accountsNestedInput
|
||||
account?: Prisma.AccountUpdateOneRequiredWithoutConsumer_accountNestedInput
|
||||
pos?: Prisma.PosUpdateOneWithoutAccountNestedInput
|
||||
permission?: Prisma.PermissionConsumerUpdateOneWithoutConsumer_accountNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutConsumer_accountNestedInput
|
||||
}
|
||||
@@ -290,6 +296,7 @@ export type ConsumerAccountUncheckedUpdateInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
account_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
pos?: Prisma.PosUncheckedUpdateOneWithoutAccountNestedInput
|
||||
permission?: Prisma.PermissionConsumerUncheckedUpdateOneWithoutConsumer_accountNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutConsumer_accountNestedInput
|
||||
}
|
||||
@@ -450,6 +457,22 @@ export type ConsumerAccountUncheckedUpdateManyWithoutConsumerNestedInput = {
|
||||
deleteMany?: Prisma.ConsumerAccountScalarWhereInput | Prisma.ConsumerAccountScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type ConsumerAccountCreateNestedOneWithoutPosInput = {
|
||||
create?: Prisma.XOR<Prisma.ConsumerAccountCreateWithoutPosInput, Prisma.ConsumerAccountUncheckedCreateWithoutPosInput>
|
||||
connectOrCreate?: Prisma.ConsumerAccountCreateOrConnectWithoutPosInput
|
||||
connect?: Prisma.ConsumerAccountWhereUniqueInput
|
||||
}
|
||||
|
||||
export type ConsumerAccountUpdateOneWithoutPosNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.ConsumerAccountCreateWithoutPosInput, Prisma.ConsumerAccountUncheckedCreateWithoutPosInput>
|
||||
connectOrCreate?: Prisma.ConsumerAccountCreateOrConnectWithoutPosInput
|
||||
upsert?: Prisma.ConsumerAccountUpsertWithoutPosInput
|
||||
disconnect?: Prisma.ConsumerAccountWhereInput | boolean
|
||||
delete?: Prisma.ConsumerAccountWhereInput | boolean
|
||||
connect?: Prisma.ConsumerAccountWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.ConsumerAccountUpdateToOneWithWhereWithoutPosInput, Prisma.ConsumerAccountUpdateWithoutPosInput>, Prisma.ConsumerAccountUncheckedUpdateWithoutPosInput>
|
||||
}
|
||||
|
||||
export type ConsumerAccountCreateNestedOneWithoutPermissionInput = {
|
||||
create?: Prisma.XOR<Prisma.ConsumerAccountCreateWithoutPermissionInput, Prisma.ConsumerAccountUncheckedCreateWithoutPermissionInput>
|
||||
connectOrCreate?: Prisma.ConsumerAccountCreateOrConnectWithoutPermissionInput
|
||||
@@ -484,6 +507,7 @@ export type ConsumerAccountCreateWithoutAccountInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumer: Prisma.ConsumerCreateNestedOneWithoutConsumer_accountsInput
|
||||
pos?: Prisma.PosCreateNestedOneWithoutAccountInput
|
||||
permission?: Prisma.PermissionConsumerCreateNestedOneWithoutConsumer_accountInput
|
||||
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutConsumer_accountInput
|
||||
}
|
||||
@@ -494,6 +518,7 @@ export type ConsumerAccountUncheckedCreateWithoutAccountInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumer_id: string
|
||||
pos?: Prisma.PosUncheckedCreateNestedOneWithoutAccountInput
|
||||
permission?: Prisma.PermissionConsumerUncheckedCreateNestedOneWithoutConsumer_accountInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutConsumer_accountInput
|
||||
}
|
||||
@@ -520,6 +545,7 @@ export type ConsumerAccountUpdateWithoutAccountInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutConsumer_accountsNestedInput
|
||||
pos?: Prisma.PosUpdateOneWithoutAccountNestedInput
|
||||
permission?: Prisma.PermissionConsumerUpdateOneWithoutConsumer_accountNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutConsumer_accountNestedInput
|
||||
}
|
||||
@@ -530,6 +556,7 @@ export type ConsumerAccountUncheckedUpdateWithoutAccountInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
pos?: Prisma.PosUncheckedUpdateOneWithoutAccountNestedInput
|
||||
permission?: Prisma.PermissionConsumerUncheckedUpdateOneWithoutConsumer_accountNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutConsumer_accountNestedInput
|
||||
}
|
||||
@@ -540,6 +567,7 @@ export type ConsumerAccountCreateWithoutConsumerInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
account: Prisma.AccountCreateNestedOneWithoutConsumer_accountInput
|
||||
pos?: Prisma.PosCreateNestedOneWithoutAccountInput
|
||||
permission?: Prisma.PermissionConsumerCreateNestedOneWithoutConsumer_accountInput
|
||||
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutConsumer_accountInput
|
||||
}
|
||||
@@ -550,6 +578,7 @@ export type ConsumerAccountUncheckedCreateWithoutConsumerInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
account_id: string
|
||||
pos?: Prisma.PosUncheckedCreateNestedOneWithoutAccountInput
|
||||
permission?: Prisma.PermissionConsumerUncheckedCreateNestedOneWithoutConsumer_accountInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutConsumer_accountInput
|
||||
}
|
||||
@@ -592,6 +621,66 @@ export type ConsumerAccountScalarWhereInput = {
|
||||
account_id?: Prisma.StringFilter<"ConsumerAccount"> | string
|
||||
}
|
||||
|
||||
export type ConsumerAccountCreateWithoutPosInput = {
|
||||
id?: string
|
||||
role: $Enums.ConsumerRole
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumer: Prisma.ConsumerCreateNestedOneWithoutConsumer_accountsInput
|
||||
account: Prisma.AccountCreateNestedOneWithoutConsumer_accountInput
|
||||
permission?: Prisma.PermissionConsumerCreateNestedOneWithoutConsumer_accountInput
|
||||
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutConsumer_accountInput
|
||||
}
|
||||
|
||||
export type ConsumerAccountUncheckedCreateWithoutPosInput = {
|
||||
id?: string
|
||||
role: $Enums.ConsumerRole
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumer_id: string
|
||||
account_id: string
|
||||
permission?: Prisma.PermissionConsumerUncheckedCreateNestedOneWithoutConsumer_accountInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutConsumer_accountInput
|
||||
}
|
||||
|
||||
export type ConsumerAccountCreateOrConnectWithoutPosInput = {
|
||||
where: Prisma.ConsumerAccountWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.ConsumerAccountCreateWithoutPosInput, Prisma.ConsumerAccountUncheckedCreateWithoutPosInput>
|
||||
}
|
||||
|
||||
export type ConsumerAccountUpsertWithoutPosInput = {
|
||||
update: Prisma.XOR<Prisma.ConsumerAccountUpdateWithoutPosInput, Prisma.ConsumerAccountUncheckedUpdateWithoutPosInput>
|
||||
create: Prisma.XOR<Prisma.ConsumerAccountCreateWithoutPosInput, Prisma.ConsumerAccountUncheckedCreateWithoutPosInput>
|
||||
where?: Prisma.ConsumerAccountWhereInput
|
||||
}
|
||||
|
||||
export type ConsumerAccountUpdateToOneWithWhereWithoutPosInput = {
|
||||
where?: Prisma.ConsumerAccountWhereInput
|
||||
data: Prisma.XOR<Prisma.ConsumerAccountUpdateWithoutPosInput, Prisma.ConsumerAccountUncheckedUpdateWithoutPosInput>
|
||||
}
|
||||
|
||||
export type ConsumerAccountUpdateWithoutPosInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
role?: Prisma.EnumConsumerRoleFieldUpdateOperationsInput | $Enums.ConsumerRole
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutConsumer_accountsNestedInput
|
||||
account?: Prisma.AccountUpdateOneRequiredWithoutConsumer_accountNestedInput
|
||||
permission?: Prisma.PermissionConsumerUpdateOneWithoutConsumer_accountNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutConsumer_accountNestedInput
|
||||
}
|
||||
|
||||
export type ConsumerAccountUncheckedUpdateWithoutPosInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
role?: Prisma.EnumConsumerRoleFieldUpdateOperationsInput | $Enums.ConsumerRole
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
account_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
permission?: Prisma.PermissionConsumerUncheckedUpdateOneWithoutConsumer_accountNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutConsumer_accountNestedInput
|
||||
}
|
||||
|
||||
export type ConsumerAccountCreateWithoutPermissionInput = {
|
||||
id?: string
|
||||
role: $Enums.ConsumerRole
|
||||
@@ -599,6 +688,7 @@ export type ConsumerAccountCreateWithoutPermissionInput = {
|
||||
updated_at?: Date | string
|
||||
consumer: Prisma.ConsumerCreateNestedOneWithoutConsumer_accountsInput
|
||||
account: Prisma.AccountCreateNestedOneWithoutConsumer_accountInput
|
||||
pos?: Prisma.PosCreateNestedOneWithoutAccountInput
|
||||
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutConsumer_accountInput
|
||||
}
|
||||
|
||||
@@ -609,6 +699,7 @@ export type ConsumerAccountUncheckedCreateWithoutPermissionInput = {
|
||||
updated_at?: Date | string
|
||||
consumer_id: string
|
||||
account_id: string
|
||||
pos?: Prisma.PosUncheckedCreateNestedOneWithoutAccountInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutConsumer_accountInput
|
||||
}
|
||||
|
||||
@@ -635,6 +726,7 @@ export type ConsumerAccountUpdateWithoutPermissionInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutConsumer_accountsNestedInput
|
||||
account?: Prisma.AccountUpdateOneRequiredWithoutConsumer_accountNestedInput
|
||||
pos?: Prisma.PosUpdateOneWithoutAccountNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutConsumer_accountNestedInput
|
||||
}
|
||||
|
||||
@@ -645,6 +737,7 @@ export type ConsumerAccountUncheckedUpdateWithoutPermissionInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
account_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
pos?: Prisma.PosUncheckedUpdateOneWithoutAccountNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutConsumer_accountNestedInput
|
||||
}
|
||||
|
||||
@@ -655,6 +748,7 @@ export type ConsumerAccountCreateWithoutSales_invoicesInput = {
|
||||
updated_at?: Date | string
|
||||
consumer: Prisma.ConsumerCreateNestedOneWithoutConsumer_accountsInput
|
||||
account: Prisma.AccountCreateNestedOneWithoutConsumer_accountInput
|
||||
pos?: Prisma.PosCreateNestedOneWithoutAccountInput
|
||||
permission?: Prisma.PermissionConsumerCreateNestedOneWithoutConsumer_accountInput
|
||||
}
|
||||
|
||||
@@ -665,6 +759,7 @@ export type ConsumerAccountUncheckedCreateWithoutSales_invoicesInput = {
|
||||
updated_at?: Date | string
|
||||
consumer_id: string
|
||||
account_id: string
|
||||
pos?: Prisma.PosUncheckedCreateNestedOneWithoutAccountInput
|
||||
permission?: Prisma.PermissionConsumerUncheckedCreateNestedOneWithoutConsumer_accountInput
|
||||
}
|
||||
|
||||
@@ -691,6 +786,7 @@ export type ConsumerAccountUpdateWithoutSales_invoicesInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutConsumer_accountsNestedInput
|
||||
account?: Prisma.AccountUpdateOneRequiredWithoutConsumer_accountNestedInput
|
||||
pos?: Prisma.PosUpdateOneWithoutAccountNestedInput
|
||||
permission?: Prisma.PermissionConsumerUpdateOneWithoutConsumer_accountNestedInput
|
||||
}
|
||||
|
||||
@@ -701,6 +797,7 @@ export type ConsumerAccountUncheckedUpdateWithoutSales_invoicesInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
account_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
pos?: Prisma.PosUncheckedUpdateOneWithoutAccountNestedInput
|
||||
permission?: Prisma.PermissionConsumerUncheckedUpdateOneWithoutConsumer_accountNestedInput
|
||||
}
|
||||
|
||||
@@ -718,6 +815,7 @@ export type ConsumerAccountUpdateWithoutConsumerInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
account?: Prisma.AccountUpdateOneRequiredWithoutConsumer_accountNestedInput
|
||||
pos?: Prisma.PosUpdateOneWithoutAccountNestedInput
|
||||
permission?: Prisma.PermissionConsumerUpdateOneWithoutConsumer_accountNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutConsumer_accountNestedInput
|
||||
}
|
||||
@@ -728,6 +826,7 @@ export type ConsumerAccountUncheckedUpdateWithoutConsumerInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
account_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
pos?: Prisma.PosUncheckedUpdateOneWithoutAccountNestedInput
|
||||
permission?: Prisma.PermissionConsumerUncheckedUpdateOneWithoutConsumer_accountNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutConsumer_accountNestedInput
|
||||
}
|
||||
@@ -780,6 +879,7 @@ export type ConsumerAccountSelect<ExtArgs extends runtime.Types.Extensions.Inter
|
||||
account_id?: boolean
|
||||
consumer?: boolean | Prisma.ConsumerDefaultArgs<ExtArgs>
|
||||
account?: boolean | Prisma.AccountDefaultArgs<ExtArgs>
|
||||
pos?: boolean | Prisma.ConsumerAccount$posArgs<ExtArgs>
|
||||
permission?: boolean | Prisma.ConsumerAccount$permissionArgs<ExtArgs>
|
||||
sales_invoices?: boolean | Prisma.ConsumerAccount$sales_invoicesArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.ConsumerAccountCountOutputTypeDefaultArgs<ExtArgs>
|
||||
@@ -800,6 +900,7 @@ export type ConsumerAccountOmit<ExtArgs extends runtime.Types.Extensions.Interna
|
||||
export type ConsumerAccountInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
consumer?: boolean | Prisma.ConsumerDefaultArgs<ExtArgs>
|
||||
account?: boolean | Prisma.AccountDefaultArgs<ExtArgs>
|
||||
pos?: boolean | Prisma.ConsumerAccount$posArgs<ExtArgs>
|
||||
permission?: boolean | Prisma.ConsumerAccount$permissionArgs<ExtArgs>
|
||||
sales_invoices?: boolean | Prisma.ConsumerAccount$sales_invoicesArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.ConsumerAccountCountOutputTypeDefaultArgs<ExtArgs>
|
||||
@@ -810,6 +911,7 @@ export type $ConsumerAccountPayload<ExtArgs extends runtime.Types.Extensions.Int
|
||||
objects: {
|
||||
consumer: Prisma.$ConsumerPayload<ExtArgs>
|
||||
account: Prisma.$AccountPayload<ExtArgs>
|
||||
pos: Prisma.$PosPayload<ExtArgs> | null
|
||||
permission: Prisma.$PermissionConsumerPayload<ExtArgs> | null
|
||||
sales_invoices: Prisma.$SalesInvoicePayload<ExtArgs>[]
|
||||
}
|
||||
@@ -1162,6 +1264,7 @@ export interface Prisma__ConsumerAccountClient<T, Null = never, ExtArgs extends
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
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>
|
||||
account<T extends Prisma.AccountDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.AccountDefaultArgs<ExtArgs>>): Prisma.Prisma__AccountClient<runtime.Types.Result.GetResult<Prisma.$AccountPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
|
||||
pos<T extends Prisma.ConsumerAccount$posArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ConsumerAccount$posArgs<ExtArgs>>): Prisma.Prisma__PosClient<runtime.Types.Result.GetResult<Prisma.$PosPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
permission<T extends Prisma.ConsumerAccount$permissionArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ConsumerAccount$permissionArgs<ExtArgs>>): Prisma.Prisma__PermissionConsumerClient<runtime.Types.Result.GetResult<Prisma.$PermissionConsumerPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
sales_invoices<T extends Prisma.ConsumerAccount$sales_invoicesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ConsumerAccount$sales_invoicesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SalesInvoicePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
/**
|
||||
@@ -1546,6 +1649,25 @@ export type ConsumerAccountDeleteManyArgs<ExtArgs extends runtime.Types.Extensio
|
||||
limit?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* ConsumerAccount.pos
|
||||
*/
|
||||
export type ConsumerAccount$posArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the Pos
|
||||
*/
|
||||
select?: Prisma.PosSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the Pos
|
||||
*/
|
||||
omit?: Prisma.PosOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.PosInclude<ExtArgs> | null
|
||||
where?: Prisma.PosWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* ConsumerAccount.permission
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,7 @@ export type PartnerMinAggregateOutputType = {
|
||||
name: string | null
|
||||
code: string | null
|
||||
status: $Enums.PartnerStatus | null
|
||||
logo_url: string | null
|
||||
created_at: Date | null
|
||||
updated_at: Date | null
|
||||
}
|
||||
@@ -38,6 +39,7 @@ export type PartnerMaxAggregateOutputType = {
|
||||
name: string | null
|
||||
code: string | null
|
||||
status: $Enums.PartnerStatus | null
|
||||
logo_url: string | null
|
||||
created_at: Date | null
|
||||
updated_at: Date | null
|
||||
}
|
||||
@@ -47,6 +49,7 @@ export type PartnerCountAggregateOutputType = {
|
||||
name: number
|
||||
code: number
|
||||
status: number
|
||||
logo_url: number
|
||||
created_at: number
|
||||
updated_at: number
|
||||
_all: number
|
||||
@@ -58,6 +61,7 @@ export type PartnerMinAggregateInputType = {
|
||||
name?: true
|
||||
code?: true
|
||||
status?: true
|
||||
logo_url?: true
|
||||
created_at?: true
|
||||
updated_at?: true
|
||||
}
|
||||
@@ -67,6 +71,7 @@ export type PartnerMaxAggregateInputType = {
|
||||
name?: true
|
||||
code?: true
|
||||
status?: true
|
||||
logo_url?: true
|
||||
created_at?: true
|
||||
updated_at?: true
|
||||
}
|
||||
@@ -76,6 +81,7 @@ export type PartnerCountAggregateInputType = {
|
||||
name?: true
|
||||
code?: true
|
||||
status?: true
|
||||
logo_url?: true
|
||||
created_at?: true
|
||||
updated_at?: true
|
||||
_all?: true
|
||||
@@ -158,6 +164,7 @@ export type PartnerGroupByOutputType = {
|
||||
name: string
|
||||
code: string
|
||||
status: $Enums.PartnerStatus
|
||||
logo_url: string | null
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
_count: PartnerCountAggregateOutputType | null
|
||||
@@ -188,6 +195,7 @@ export type PartnerWhereInput = {
|
||||
name?: Prisma.StringFilter<"Partner"> | string
|
||||
code?: Prisma.StringFilter<"Partner"> | string
|
||||
status?: Prisma.EnumPartnerStatusFilter<"Partner"> | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.StringNullableFilter<"Partner"> | string | null
|
||||
created_at?: Prisma.DateTimeFilter<"Partner"> | Date | string
|
||||
updated_at?: Prisma.DateTimeFilter<"Partner"> | Date | string
|
||||
consumers?: Prisma.ConsumerListRelationFilter
|
||||
@@ -202,6 +210,7 @@ export type PartnerOrderByWithRelationInput = {
|
||||
name?: Prisma.SortOrder
|
||||
code?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
logo_url?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
consumers?: Prisma.ConsumerOrderByRelationAggregateInput
|
||||
@@ -220,6 +229,7 @@ export type PartnerWhereUniqueInput = Prisma.AtLeast<{
|
||||
NOT?: Prisma.PartnerWhereInput | Prisma.PartnerWhereInput[]
|
||||
name?: Prisma.StringFilter<"Partner"> | string
|
||||
status?: Prisma.EnumPartnerStatusFilter<"Partner"> | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.StringNullableFilter<"Partner"> | string | null
|
||||
created_at?: Prisma.DateTimeFilter<"Partner"> | Date | string
|
||||
updated_at?: Prisma.DateTimeFilter<"Partner"> | Date | string
|
||||
consumers?: Prisma.ConsumerListRelationFilter
|
||||
@@ -234,6 +244,7 @@ export type PartnerOrderByWithAggregationInput = {
|
||||
name?: Prisma.SortOrder
|
||||
code?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
logo_url?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
_count?: Prisma.PartnerCountOrderByAggregateInput
|
||||
@@ -249,6 +260,7 @@ export type PartnerScalarWhereWithAggregatesInput = {
|
||||
name?: Prisma.StringWithAggregatesFilter<"Partner"> | string
|
||||
code?: Prisma.StringWithAggregatesFilter<"Partner"> | string
|
||||
status?: Prisma.EnumPartnerStatusWithAggregatesFilter<"Partner"> | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.StringNullableWithAggregatesFilter<"Partner"> | string | null
|
||||
created_at?: Prisma.DateTimeWithAggregatesFilter<"Partner"> | Date | string
|
||||
updated_at?: Prisma.DateTimeWithAggregatesFilter<"Partner"> | Date | string
|
||||
}
|
||||
@@ -258,6 +270,7 @@ export type PartnerCreateInput = {
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumers?: Prisma.ConsumerCreateNestedManyWithoutPartnerInput
|
||||
@@ -272,6 +285,7 @@ export type PartnerUncheckedCreateInput = {
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumers?: Prisma.ConsumerUncheckedCreateNestedManyWithoutPartnerInput
|
||||
@@ -286,6 +300,7 @@ export type PartnerUpdateInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumers?: Prisma.ConsumerUpdateManyWithoutPartnerNestedInput
|
||||
@@ -300,6 +315,7 @@ export type PartnerUncheckedUpdateInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumers?: Prisma.ConsumerUncheckedUpdateManyWithoutPartnerNestedInput
|
||||
@@ -314,6 +330,7 @@ export type PartnerCreateManyInput = {
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
}
|
||||
@@ -323,6 +340,7 @@ export type PartnerUpdateManyMutationInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
@@ -332,6 +350,7 @@ export type PartnerUncheckedUpdateManyInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
@@ -352,6 +371,7 @@ export type PartnerCountOrderByAggregateInput = {
|
||||
name?: Prisma.SortOrder
|
||||
code?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
logo_url?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
}
|
||||
@@ -361,6 +381,7 @@ export type PartnerMaxOrderByAggregateInput = {
|
||||
name?: Prisma.SortOrder
|
||||
code?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
logo_url?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
}
|
||||
@@ -370,6 +391,7 @@ export type PartnerMinOrderByAggregateInput = {
|
||||
name?: Prisma.SortOrder
|
||||
code?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
logo_url?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
updated_at?: Prisma.SortOrder
|
||||
}
|
||||
@@ -453,6 +475,7 @@ export type PartnerCreateWithoutConsumersInput = {
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
partner_accounts?: Prisma.PartnerAccountCreateNestedManyWithoutPartnerInput
|
||||
@@ -466,6 +489,7 @@ export type PartnerUncheckedCreateWithoutConsumersInput = {
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
partner_accounts?: Prisma.PartnerAccountUncheckedCreateNestedManyWithoutPartnerInput
|
||||
@@ -495,6 +519,7 @@ export type PartnerUpdateWithoutConsumersInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
partner_accounts?: Prisma.PartnerAccountUpdateManyWithoutPartnerNestedInput
|
||||
@@ -508,6 +533,7 @@ export type PartnerUncheckedUpdateWithoutConsumersInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
partner_accounts?: Prisma.PartnerAccountUncheckedUpdateManyWithoutPartnerNestedInput
|
||||
@@ -521,6 +547,7 @@ export type PartnerCreateWithoutLicense_charge_transactionsInput = {
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumers?: Prisma.ConsumerCreateNestedManyWithoutPartnerInput
|
||||
@@ -534,6 +561,7 @@ export type PartnerUncheckedCreateWithoutLicense_charge_transactionsInput = {
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumers?: Prisma.ConsumerUncheckedCreateNestedManyWithoutPartnerInput
|
||||
@@ -563,6 +591,7 @@ export type PartnerUpdateWithoutLicense_charge_transactionsInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumers?: Prisma.ConsumerUpdateManyWithoutPartnerNestedInput
|
||||
@@ -576,6 +605,7 @@ export type PartnerUncheckedUpdateWithoutLicense_charge_transactionsInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumers?: Prisma.ConsumerUncheckedUpdateManyWithoutPartnerNestedInput
|
||||
@@ -589,6 +619,7 @@ export type PartnerCreateWithoutLicense_renew_charge_transactionsInput = {
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumers?: Prisma.ConsumerCreateNestedManyWithoutPartnerInput
|
||||
@@ -602,6 +633,7 @@ export type PartnerUncheckedCreateWithoutLicense_renew_charge_transactionsInput
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumers?: Prisma.ConsumerUncheckedCreateNestedManyWithoutPartnerInput
|
||||
@@ -631,6 +663,7 @@ export type PartnerUpdateWithoutLicense_renew_charge_transactionsInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumers?: Prisma.ConsumerUpdateManyWithoutPartnerNestedInput
|
||||
@@ -644,6 +677,7 @@ export type PartnerUncheckedUpdateWithoutLicense_renew_charge_transactionsInput
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumers?: Prisma.ConsumerUncheckedUpdateManyWithoutPartnerNestedInput
|
||||
@@ -657,6 +691,7 @@ export type PartnerCreateWithoutAccount_quota_charge_transactionsInput = {
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumers?: Prisma.ConsumerCreateNestedManyWithoutPartnerInput
|
||||
@@ -670,6 +705,7 @@ export type PartnerUncheckedCreateWithoutAccount_quota_charge_transactionsInput
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumers?: Prisma.ConsumerUncheckedCreateNestedManyWithoutPartnerInput
|
||||
@@ -699,6 +735,7 @@ export type PartnerUpdateWithoutAccount_quota_charge_transactionsInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumers?: Prisma.ConsumerUpdateManyWithoutPartnerNestedInput
|
||||
@@ -712,6 +749,7 @@ export type PartnerUncheckedUpdateWithoutAccount_quota_charge_transactionsInput
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumers?: Prisma.ConsumerUncheckedUpdateManyWithoutPartnerNestedInput
|
||||
@@ -725,6 +763,7 @@ export type PartnerCreateWithoutPartner_accountsInput = {
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumers?: Prisma.ConsumerCreateNestedManyWithoutPartnerInput
|
||||
@@ -738,6 +777,7 @@ export type PartnerUncheckedCreateWithoutPartner_accountsInput = {
|
||||
name: string
|
||||
code: string
|
||||
status?: $Enums.PartnerStatus
|
||||
logo_url?: string | null
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
consumers?: Prisma.ConsumerUncheckedCreateNestedManyWithoutPartnerInput
|
||||
@@ -767,6 +807,7 @@ export type PartnerUpdateWithoutPartner_accountsInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumers?: Prisma.ConsumerUpdateManyWithoutPartnerNestedInput
|
||||
@@ -780,6 +821,7 @@ export type PartnerUncheckedUpdateWithoutPartner_accountsInput = {
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumPartnerStatusFieldUpdateOperationsInput | $Enums.PartnerStatus
|
||||
logo_url?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
consumers?: Prisma.ConsumerUncheckedUpdateManyWithoutPartnerNestedInput
|
||||
@@ -860,6 +902,7 @@ export type PartnerSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
||||
name?: boolean
|
||||
code?: boolean
|
||||
status?: boolean
|
||||
logo_url?: boolean
|
||||
created_at?: boolean
|
||||
updated_at?: boolean
|
||||
consumers?: boolean | Prisma.Partner$consumersArgs<ExtArgs>
|
||||
@@ -877,11 +920,12 @@ export type PartnerSelectScalar = {
|
||||
name?: boolean
|
||||
code?: boolean
|
||||
status?: boolean
|
||||
logo_url?: 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" | "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" | "logo_url" | "created_at" | "updated_at", ExtArgs["result"]["partner"]>
|
||||
export type PartnerInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
consumers?: boolean | Prisma.Partner$consumersArgs<ExtArgs>
|
||||
partner_accounts?: boolean | Prisma.Partner$partner_accountsArgs<ExtArgs>
|
||||
@@ -905,6 +949,7 @@ export type $PartnerPayload<ExtArgs extends runtime.Types.Extensions.InternalArg
|
||||
name: string
|
||||
code: string
|
||||
status: $Enums.PartnerStatus
|
||||
logo_url: string | null
|
||||
created_at: Date
|
||||
updated_at: Date
|
||||
}, ExtArgs["result"]["partner"]>
|
||||
@@ -1285,6 +1330,7 @@ export interface PartnerFieldRefs {
|
||||
readonly name: Prisma.FieldRef<"Partner", 'String'>
|
||||
readonly code: Prisma.FieldRef<"Partner", 'String'>
|
||||
readonly status: Prisma.FieldRef<"Partner", 'PartnerStatus'>
|
||||
readonly logo_url: Prisma.FieldRef<"Partner", 'String'>
|
||||
readonly created_at: Prisma.FieldRef<"Partner", 'DateTime'>
|
||||
readonly updated_at: Prisma.FieldRef<"Partner", 'DateTime'>
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ export type PosMinAggregateOutputType = {
|
||||
updated_at: Date | null
|
||||
complex_id: string | null
|
||||
device_id: string | null
|
||||
account_id: string | null
|
||||
provider_id: string | null
|
||||
}
|
||||
|
||||
@@ -49,6 +50,7 @@ export type PosMaxAggregateOutputType = {
|
||||
updated_at: Date | null
|
||||
complex_id: string | null
|
||||
device_id: string | null
|
||||
account_id: string | null
|
||||
provider_id: string | null
|
||||
}
|
||||
|
||||
@@ -63,6 +65,7 @@ export type PosCountAggregateOutputType = {
|
||||
updated_at: number
|
||||
complex_id: number
|
||||
device_id: number
|
||||
account_id: number
|
||||
provider_id: number
|
||||
_all: number
|
||||
}
|
||||
@@ -79,6 +82,7 @@ export type PosMinAggregateInputType = {
|
||||
updated_at?: true
|
||||
complex_id?: true
|
||||
device_id?: true
|
||||
account_id?: true
|
||||
provider_id?: true
|
||||
}
|
||||
|
||||
@@ -93,6 +97,7 @@ export type PosMaxAggregateInputType = {
|
||||
updated_at?: true
|
||||
complex_id?: true
|
||||
device_id?: true
|
||||
account_id?: true
|
||||
provider_id?: true
|
||||
}
|
||||
|
||||
@@ -107,6 +112,7 @@ export type PosCountAggregateInputType = {
|
||||
updated_at?: true
|
||||
complex_id?: true
|
||||
device_id?: true
|
||||
account_id?: true
|
||||
provider_id?: true
|
||||
_all?: true
|
||||
}
|
||||
@@ -194,6 +200,7 @@ export type PosGroupByOutputType = {
|
||||
updated_at: Date
|
||||
complex_id: string
|
||||
device_id: string | null
|
||||
account_id: string | null
|
||||
provider_id: string | null
|
||||
_count: PosCountAggregateOutputType | null
|
||||
_min: PosMinAggregateOutputType | null
|
||||
@@ -229,9 +236,11 @@ export type PosWhereInput = {
|
||||
updated_at?: Prisma.DateTimeFilter<"Pos"> | Date | string
|
||||
complex_id?: Prisma.StringFilter<"Pos"> | string
|
||||
device_id?: Prisma.StringNullableFilter<"Pos"> | string | null
|
||||
account_id?: Prisma.StringNullableFilter<"Pos"> | string | null
|
||||
provider_id?: Prisma.StringNullableFilter<"Pos"> | string | null
|
||||
complex?: Prisma.XOR<Prisma.ComplexScalarRelationFilter, Prisma.ComplexWhereInput>
|
||||
device?: Prisma.XOR<Prisma.DeviceNullableScalarRelationFilter, Prisma.DeviceWhereInput> | null
|
||||
account?: Prisma.XOR<Prisma.ConsumerAccountNullableScalarRelationFilter, Prisma.ConsumerAccountWhereInput> | null
|
||||
provider?: Prisma.XOR<Prisma.ProviderNullableScalarRelationFilter, Prisma.ProviderWhereInput> | null
|
||||
permission_pos?: Prisma.PermissionPosListRelationFilter
|
||||
sales_invoices?: Prisma.SalesInvoiceListRelationFilter
|
||||
@@ -248,9 +257,11 @@ export type PosOrderByWithRelationInput = {
|
||||
updated_at?: Prisma.SortOrder
|
||||
complex_id?: Prisma.SortOrder
|
||||
device_id?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
account_id?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
provider_id?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
complex?: Prisma.ComplexOrderByWithRelationInput
|
||||
device?: Prisma.DeviceOrderByWithRelationInput
|
||||
account?: Prisma.ConsumerAccountOrderByWithRelationInput
|
||||
provider?: Prisma.ProviderOrderByWithRelationInput
|
||||
permission_pos?: Prisma.PermissionPosOrderByRelationAggregateInput
|
||||
sales_invoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput
|
||||
@@ -260,6 +271,7 @@ export type PosOrderByWithRelationInput = {
|
||||
export type PosWhereUniqueInput = Prisma.AtLeast<{
|
||||
id?: string
|
||||
serial_number?: string
|
||||
account_id?: string
|
||||
AND?: Prisma.PosWhereInput | Prisma.PosWhereInput[]
|
||||
OR?: Prisma.PosWhereInput[]
|
||||
NOT?: Prisma.PosWhereInput | Prisma.PosWhereInput[]
|
||||
@@ -274,10 +286,11 @@ export type PosWhereUniqueInput = Prisma.AtLeast<{
|
||||
provider_id?: Prisma.StringNullableFilter<"Pos"> | string | null
|
||||
complex?: Prisma.XOR<Prisma.ComplexScalarRelationFilter, Prisma.ComplexWhereInput>
|
||||
device?: Prisma.XOR<Prisma.DeviceNullableScalarRelationFilter, Prisma.DeviceWhereInput> | null
|
||||
account?: Prisma.XOR<Prisma.ConsumerAccountNullableScalarRelationFilter, Prisma.ConsumerAccountWhereInput> | null
|
||||
provider?: Prisma.XOR<Prisma.ProviderNullableScalarRelationFilter, Prisma.ProviderWhereInput> | null
|
||||
permission_pos?: Prisma.PermissionPosListRelationFilter
|
||||
sales_invoices?: Prisma.SalesInvoiceListRelationFilter
|
||||
}, "id" | "serial_number">
|
||||
}, "id" | "serial_number" | "account_id">
|
||||
|
||||
export type PosOrderByWithAggregationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
@@ -290,6 +303,7 @@ export type PosOrderByWithAggregationInput = {
|
||||
updated_at?: Prisma.SortOrder
|
||||
complex_id?: Prisma.SortOrder
|
||||
device_id?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
account_id?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
provider_id?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
_count?: Prisma.PosCountOrderByAggregateInput
|
||||
_max?: Prisma.PosMaxOrderByAggregateInput
|
||||
@@ -310,6 +324,7 @@ export type PosScalarWhereWithAggregatesInput = {
|
||||
updated_at?: Prisma.DateTimeWithAggregatesFilter<"Pos"> | Date | string
|
||||
complex_id?: Prisma.StringWithAggregatesFilter<"Pos"> | string
|
||||
device_id?: Prisma.StringNullableWithAggregatesFilter<"Pos"> | string | null
|
||||
account_id?: Prisma.StringNullableWithAggregatesFilter<"Pos"> | string | null
|
||||
provider_id?: Prisma.StringNullableWithAggregatesFilter<"Pos"> | string | null
|
||||
}
|
||||
|
||||
@@ -324,6 +339,7 @@ export type PosCreateInput = {
|
||||
updated_at?: Date | string
|
||||
complex: Prisma.ComplexCreateNestedOneWithoutPos_listInput
|
||||
device?: Prisma.DeviceCreateNestedOneWithoutPosesInput
|
||||
account?: Prisma.ConsumerAccountCreateNestedOneWithoutPosInput
|
||||
provider?: Prisma.ProviderCreateNestedOneWithoutPos_listInput
|
||||
permission_pos?: Prisma.PermissionPosCreateNestedManyWithoutPosInput
|
||||
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosInput
|
||||
@@ -340,6 +356,7 @@ export type PosUncheckedCreateInput = {
|
||||
updated_at?: Date | string
|
||||
complex_id: string
|
||||
device_id?: string | null
|
||||
account_id?: string | null
|
||||
provider_id?: string | null
|
||||
permission_pos?: Prisma.PermissionPosUncheckedCreateNestedManyWithoutPosInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosInput
|
||||
@@ -356,6 +373,7 @@ export type PosUpdateInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex?: Prisma.ComplexUpdateOneRequiredWithoutPos_listNestedInput
|
||||
device?: Prisma.DeviceUpdateOneWithoutPosesNestedInput
|
||||
account?: Prisma.ConsumerAccountUpdateOneWithoutPosNestedInput
|
||||
provider?: Prisma.ProviderUpdateOneWithoutPos_listNestedInput
|
||||
permission_pos?: Prisma.PermissionPosUpdateManyWithoutPosNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutPosNestedInput
|
||||
@@ -372,6 +390,7 @@ export type PosUncheckedUpdateInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
device_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
account_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
provider_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
permission_pos?: Prisma.PermissionPosUncheckedUpdateManyWithoutPosNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosNestedInput
|
||||
@@ -388,6 +407,7 @@ export type PosCreateManyInput = {
|
||||
updated_at?: Date | string
|
||||
complex_id: string
|
||||
device_id?: string | null
|
||||
account_id?: string | null
|
||||
provider_id?: string | null
|
||||
}
|
||||
|
||||
@@ -413,9 +433,15 @@ export type PosUncheckedUpdateManyInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
device_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
account_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
provider_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
|
||||
export type PosNullableScalarRelationFilter = {
|
||||
is?: Prisma.PosWhereInput | null
|
||||
isNot?: Prisma.PosWhereInput | null
|
||||
}
|
||||
|
||||
export type PosListRelationFilter = {
|
||||
every?: Prisma.PosWhereInput
|
||||
some?: Prisma.PosWhereInput
|
||||
@@ -443,6 +469,7 @@ export type PosCountOrderByAggregateInput = {
|
||||
updated_at?: Prisma.SortOrder
|
||||
complex_id?: Prisma.SortOrder
|
||||
device_id?: Prisma.SortOrder
|
||||
account_id?: Prisma.SortOrder
|
||||
provider_id?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
@@ -457,6 +484,7 @@ export type PosMaxOrderByAggregateInput = {
|
||||
updated_at?: Prisma.SortOrder
|
||||
complex_id?: Prisma.SortOrder
|
||||
device_id?: Prisma.SortOrder
|
||||
account_id?: Prisma.SortOrder
|
||||
provider_id?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
@@ -471,6 +499,7 @@ export type PosMinOrderByAggregateInput = {
|
||||
updated_at?: Prisma.SortOrder
|
||||
complex_id?: Prisma.SortOrder
|
||||
device_id?: Prisma.SortOrder
|
||||
account_id?: Prisma.SortOrder
|
||||
provider_id?: Prisma.SortOrder
|
||||
}
|
||||
|
||||
@@ -479,6 +508,38 @@ export type PosScalarRelationFilter = {
|
||||
isNot?: Prisma.PosWhereInput
|
||||
}
|
||||
|
||||
export type PosCreateNestedOneWithoutAccountInput = {
|
||||
create?: Prisma.XOR<Prisma.PosCreateWithoutAccountInput, Prisma.PosUncheckedCreateWithoutAccountInput>
|
||||
connectOrCreate?: Prisma.PosCreateOrConnectWithoutAccountInput
|
||||
connect?: Prisma.PosWhereUniqueInput
|
||||
}
|
||||
|
||||
export type PosUncheckedCreateNestedOneWithoutAccountInput = {
|
||||
create?: Prisma.XOR<Prisma.PosCreateWithoutAccountInput, Prisma.PosUncheckedCreateWithoutAccountInput>
|
||||
connectOrCreate?: Prisma.PosCreateOrConnectWithoutAccountInput
|
||||
connect?: Prisma.PosWhereUniqueInput
|
||||
}
|
||||
|
||||
export type PosUpdateOneWithoutAccountNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.PosCreateWithoutAccountInput, Prisma.PosUncheckedCreateWithoutAccountInput>
|
||||
connectOrCreate?: Prisma.PosCreateOrConnectWithoutAccountInput
|
||||
upsert?: Prisma.PosUpsertWithoutAccountInput
|
||||
disconnect?: Prisma.PosWhereInput | boolean
|
||||
delete?: Prisma.PosWhereInput | boolean
|
||||
connect?: Prisma.PosWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.PosUpdateToOneWithWhereWithoutAccountInput, Prisma.PosUpdateWithoutAccountInput>, Prisma.PosUncheckedUpdateWithoutAccountInput>
|
||||
}
|
||||
|
||||
export type PosUncheckedUpdateOneWithoutAccountNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.PosCreateWithoutAccountInput, Prisma.PosUncheckedCreateWithoutAccountInput>
|
||||
connectOrCreate?: Prisma.PosCreateOrConnectWithoutAccountInput
|
||||
upsert?: Prisma.PosUpsertWithoutAccountInput
|
||||
disconnect?: Prisma.PosWhereInput | boolean
|
||||
delete?: Prisma.PosWhereInput | boolean
|
||||
connect?: Prisma.PosWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.PosUpdateToOneWithWhereWithoutAccountInput, Prisma.PosUpdateWithoutAccountInput>, Prisma.PosUncheckedUpdateWithoutAccountInput>
|
||||
}
|
||||
|
||||
export type PosCreateNestedManyWithoutComplexInput = {
|
||||
create?: Prisma.XOR<Prisma.PosCreateWithoutComplexInput, Prisma.PosUncheckedCreateWithoutComplexInput> | Prisma.PosCreateWithoutComplexInput[] | Prisma.PosUncheckedCreateWithoutComplexInput[]
|
||||
connectOrCreate?: Prisma.PosCreateOrConnectWithoutComplexInput | Prisma.PosCreateOrConnectWithoutComplexInput[]
|
||||
@@ -641,6 +702,86 @@ export type PosUpdateOneRequiredWithoutSales_invoicesNestedInput = {
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.PosUpdateToOneWithWhereWithoutSales_invoicesInput, Prisma.PosUpdateWithoutSales_invoicesInput>, Prisma.PosUncheckedUpdateWithoutSales_invoicesInput>
|
||||
}
|
||||
|
||||
export type PosCreateWithoutAccountInput = {
|
||||
id?: string
|
||||
name: string
|
||||
model?: string | null
|
||||
serial_number?: string | null
|
||||
status?: $Enums.POSStatus
|
||||
pos_type: $Enums.POSType
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
complex: Prisma.ComplexCreateNestedOneWithoutPos_listInput
|
||||
device?: Prisma.DeviceCreateNestedOneWithoutPosesInput
|
||||
provider?: Prisma.ProviderCreateNestedOneWithoutPos_listInput
|
||||
permission_pos?: Prisma.PermissionPosCreateNestedManyWithoutPosInput
|
||||
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosInput
|
||||
}
|
||||
|
||||
export type PosUncheckedCreateWithoutAccountInput = {
|
||||
id?: string
|
||||
name: string
|
||||
model?: string | null
|
||||
serial_number?: string | null
|
||||
status?: $Enums.POSStatus
|
||||
pos_type: $Enums.POSType
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
complex_id: string
|
||||
device_id?: string | null
|
||||
provider_id?: string | null
|
||||
permission_pos?: Prisma.PermissionPosUncheckedCreateNestedManyWithoutPosInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosInput
|
||||
}
|
||||
|
||||
export type PosCreateOrConnectWithoutAccountInput = {
|
||||
where: Prisma.PosWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.PosCreateWithoutAccountInput, Prisma.PosUncheckedCreateWithoutAccountInput>
|
||||
}
|
||||
|
||||
export type PosUpsertWithoutAccountInput = {
|
||||
update: Prisma.XOR<Prisma.PosUpdateWithoutAccountInput, Prisma.PosUncheckedUpdateWithoutAccountInput>
|
||||
create: Prisma.XOR<Prisma.PosCreateWithoutAccountInput, Prisma.PosUncheckedCreateWithoutAccountInput>
|
||||
where?: Prisma.PosWhereInput
|
||||
}
|
||||
|
||||
export type PosUpdateToOneWithWhereWithoutAccountInput = {
|
||||
where?: Prisma.PosWhereInput
|
||||
data: Prisma.XOR<Prisma.PosUpdateWithoutAccountInput, Prisma.PosUncheckedUpdateWithoutAccountInput>
|
||||
}
|
||||
|
||||
export type PosUpdateWithoutAccountInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
model?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
serial_number?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
status?: Prisma.EnumPOSStatusFieldUpdateOperationsInput | $Enums.POSStatus
|
||||
pos_type?: Prisma.EnumPOSTypeFieldUpdateOperationsInput | $Enums.POSType
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex?: Prisma.ComplexUpdateOneRequiredWithoutPos_listNestedInput
|
||||
device?: Prisma.DeviceUpdateOneWithoutPosesNestedInput
|
||||
provider?: Prisma.ProviderUpdateOneWithoutPos_listNestedInput
|
||||
permission_pos?: Prisma.PermissionPosUpdateManyWithoutPosNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutPosNestedInput
|
||||
}
|
||||
|
||||
export type PosUncheckedUpdateWithoutAccountInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
model?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
serial_number?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
status?: Prisma.EnumPOSStatusFieldUpdateOperationsInput | $Enums.POSStatus
|
||||
pos_type?: Prisma.EnumPOSTypeFieldUpdateOperationsInput | $Enums.POSType
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
device_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
provider_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
permission_pos?: Prisma.PermissionPosUncheckedUpdateManyWithoutPosNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosNestedInput
|
||||
}
|
||||
|
||||
export type PosCreateWithoutComplexInput = {
|
||||
id?: string
|
||||
name: string
|
||||
@@ -651,6 +792,7 @@ export type PosCreateWithoutComplexInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
device?: Prisma.DeviceCreateNestedOneWithoutPosesInput
|
||||
account?: Prisma.ConsumerAccountCreateNestedOneWithoutPosInput
|
||||
provider?: Prisma.ProviderCreateNestedOneWithoutPos_listInput
|
||||
permission_pos?: Prisma.PermissionPosCreateNestedManyWithoutPosInput
|
||||
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosInput
|
||||
@@ -666,6 +808,7 @@ export type PosUncheckedCreateWithoutComplexInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
device_id?: string | null
|
||||
account_id?: string | null
|
||||
provider_id?: string | null
|
||||
permission_pos?: Prisma.PermissionPosUncheckedCreateNestedManyWithoutPosInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosInput
|
||||
@@ -711,6 +854,7 @@ export type PosScalarWhereInput = {
|
||||
updated_at?: Prisma.DateTimeFilter<"Pos"> | Date | string
|
||||
complex_id?: Prisma.StringFilter<"Pos"> | string
|
||||
device_id?: Prisma.StringNullableFilter<"Pos"> | string | null
|
||||
account_id?: Prisma.StringNullableFilter<"Pos"> | string | null
|
||||
provider_id?: Prisma.StringNullableFilter<"Pos"> | string | null
|
||||
}
|
||||
|
||||
@@ -724,6 +868,7 @@ export type PosCreateWithoutDeviceInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
complex: Prisma.ComplexCreateNestedOneWithoutPos_listInput
|
||||
account?: Prisma.ConsumerAccountCreateNestedOneWithoutPosInput
|
||||
provider?: Prisma.ProviderCreateNestedOneWithoutPos_listInput
|
||||
permission_pos?: Prisma.PermissionPosCreateNestedManyWithoutPosInput
|
||||
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosInput
|
||||
@@ -739,6 +884,7 @@ export type PosUncheckedCreateWithoutDeviceInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
complex_id: string
|
||||
account_id?: string | null
|
||||
provider_id?: string | null
|
||||
permission_pos?: Prisma.PermissionPosUncheckedCreateNestedManyWithoutPosInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosInput
|
||||
@@ -781,6 +927,7 @@ export type PosCreateWithoutPermission_posInput = {
|
||||
updated_at?: Date | string
|
||||
complex: Prisma.ComplexCreateNestedOneWithoutPos_listInput
|
||||
device?: Prisma.DeviceCreateNestedOneWithoutPosesInput
|
||||
account?: Prisma.ConsumerAccountCreateNestedOneWithoutPosInput
|
||||
provider?: Prisma.ProviderCreateNestedOneWithoutPos_listInput
|
||||
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosInput
|
||||
}
|
||||
@@ -796,6 +943,7 @@ export type PosUncheckedCreateWithoutPermission_posInput = {
|
||||
updated_at?: Date | string
|
||||
complex_id: string
|
||||
device_id?: string | null
|
||||
account_id?: string | null
|
||||
provider_id?: string | null
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosInput
|
||||
}
|
||||
@@ -827,6 +975,7 @@ export type PosUpdateWithoutPermission_posInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex?: Prisma.ComplexUpdateOneRequiredWithoutPos_listNestedInput
|
||||
device?: Prisma.DeviceUpdateOneWithoutPosesNestedInput
|
||||
account?: Prisma.ConsumerAccountUpdateOneWithoutPosNestedInput
|
||||
provider?: Prisma.ProviderUpdateOneWithoutPos_listNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutPosNestedInput
|
||||
}
|
||||
@@ -842,6 +991,7 @@ export type PosUncheckedUpdateWithoutPermission_posInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
device_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
account_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
provider_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosNestedInput
|
||||
}
|
||||
@@ -857,6 +1007,7 @@ export type PosCreateWithoutProviderInput = {
|
||||
updated_at?: Date | string
|
||||
complex: Prisma.ComplexCreateNestedOneWithoutPos_listInput
|
||||
device?: Prisma.DeviceCreateNestedOneWithoutPosesInput
|
||||
account?: Prisma.ConsumerAccountCreateNestedOneWithoutPosInput
|
||||
permission_pos?: Prisma.PermissionPosCreateNestedManyWithoutPosInput
|
||||
sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutPosInput
|
||||
}
|
||||
@@ -872,6 +1023,7 @@ export type PosUncheckedCreateWithoutProviderInput = {
|
||||
updated_at?: Date | string
|
||||
complex_id: string
|
||||
device_id?: string | null
|
||||
account_id?: string | null
|
||||
permission_pos?: Prisma.PermissionPosUncheckedCreateNestedManyWithoutPosInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutPosInput
|
||||
}
|
||||
@@ -913,6 +1065,7 @@ export type PosCreateWithoutSales_invoicesInput = {
|
||||
updated_at?: Date | string
|
||||
complex: Prisma.ComplexCreateNestedOneWithoutPos_listInput
|
||||
device?: Prisma.DeviceCreateNestedOneWithoutPosesInput
|
||||
account?: Prisma.ConsumerAccountCreateNestedOneWithoutPosInput
|
||||
provider?: Prisma.ProviderCreateNestedOneWithoutPos_listInput
|
||||
permission_pos?: Prisma.PermissionPosCreateNestedManyWithoutPosInput
|
||||
}
|
||||
@@ -928,6 +1081,7 @@ export type PosUncheckedCreateWithoutSales_invoicesInput = {
|
||||
updated_at?: Date | string
|
||||
complex_id: string
|
||||
device_id?: string | null
|
||||
account_id?: string | null
|
||||
provider_id?: string | null
|
||||
permission_pos?: Prisma.PermissionPosUncheckedCreateNestedManyWithoutPosInput
|
||||
}
|
||||
@@ -959,6 +1113,7 @@ export type PosUpdateWithoutSales_invoicesInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex?: Prisma.ComplexUpdateOneRequiredWithoutPos_listNestedInput
|
||||
device?: Prisma.DeviceUpdateOneWithoutPosesNestedInput
|
||||
account?: Prisma.ConsumerAccountUpdateOneWithoutPosNestedInput
|
||||
provider?: Prisma.ProviderUpdateOneWithoutPos_listNestedInput
|
||||
permission_pos?: Prisma.PermissionPosUpdateManyWithoutPosNestedInput
|
||||
}
|
||||
@@ -974,6 +1129,7 @@ export type PosUncheckedUpdateWithoutSales_invoicesInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
device_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
account_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
provider_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
permission_pos?: Prisma.PermissionPosUncheckedUpdateManyWithoutPosNestedInput
|
||||
}
|
||||
@@ -988,6 +1144,7 @@ export type PosCreateManyComplexInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
device_id?: string | null
|
||||
account_id?: string | null
|
||||
provider_id?: string | null
|
||||
}
|
||||
|
||||
@@ -1001,6 +1158,7 @@ export type PosUpdateWithoutComplexInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
device?: Prisma.DeviceUpdateOneWithoutPosesNestedInput
|
||||
account?: Prisma.ConsumerAccountUpdateOneWithoutPosNestedInput
|
||||
provider?: Prisma.ProviderUpdateOneWithoutPos_listNestedInput
|
||||
permission_pos?: Prisma.PermissionPosUpdateManyWithoutPosNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutPosNestedInput
|
||||
@@ -1016,6 +1174,7 @@ export type PosUncheckedUpdateWithoutComplexInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
device_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
account_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
provider_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
permission_pos?: Prisma.PermissionPosUncheckedUpdateManyWithoutPosNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosNestedInput
|
||||
@@ -1031,6 +1190,7 @@ export type PosUncheckedUpdateManyWithoutComplexInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
device_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
account_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
provider_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
|
||||
@@ -1044,6 +1204,7 @@ export type PosCreateManyDeviceInput = {
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
complex_id: string
|
||||
account_id?: string | null
|
||||
provider_id?: string | null
|
||||
}
|
||||
|
||||
@@ -1057,6 +1218,7 @@ export type PosUpdateWithoutDeviceInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex?: Prisma.ComplexUpdateOneRequiredWithoutPos_listNestedInput
|
||||
account?: Prisma.ConsumerAccountUpdateOneWithoutPosNestedInput
|
||||
provider?: Prisma.ProviderUpdateOneWithoutPos_listNestedInput
|
||||
permission_pos?: Prisma.PermissionPosUpdateManyWithoutPosNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutPosNestedInput
|
||||
@@ -1072,6 +1234,7 @@ export type PosUncheckedUpdateWithoutDeviceInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
account_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
provider_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
permission_pos?: Prisma.PermissionPosUncheckedUpdateManyWithoutPosNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosNestedInput
|
||||
@@ -1087,6 +1250,7 @@ export type PosUncheckedUpdateManyWithoutDeviceInput = {
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
account_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
provider_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
|
||||
@@ -1101,6 +1265,7 @@ export type PosCreateManyProviderInput = {
|
||||
updated_at?: Date | string
|
||||
complex_id: string
|
||||
device_id?: string | null
|
||||
account_id?: string | null
|
||||
}
|
||||
|
||||
export type PosUpdateWithoutProviderInput = {
|
||||
@@ -1114,6 +1279,7 @@ export type PosUpdateWithoutProviderInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex?: Prisma.ComplexUpdateOneRequiredWithoutPos_listNestedInput
|
||||
device?: Prisma.DeviceUpdateOneWithoutPosesNestedInput
|
||||
account?: Prisma.ConsumerAccountUpdateOneWithoutPosNestedInput
|
||||
permission_pos?: Prisma.PermissionPosUpdateManyWithoutPosNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutPosNestedInput
|
||||
}
|
||||
@@ -1129,6 +1295,7 @@ export type PosUncheckedUpdateWithoutProviderInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
device_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
account_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
permission_pos?: Prisma.PermissionPosUncheckedUpdateManyWithoutPosNestedInput
|
||||
sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutPosNestedInput
|
||||
}
|
||||
@@ -1144,6 +1311,7 @@ export type PosUncheckedUpdateManyWithoutProviderInput = {
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
complex_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
device_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
account_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
}
|
||||
|
||||
|
||||
@@ -1197,9 +1365,11 @@ export type PosSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = ru
|
||||
updated_at?: boolean
|
||||
complex_id?: boolean
|
||||
device_id?: boolean
|
||||
account_id?: boolean
|
||||
provider_id?: boolean
|
||||
complex?: boolean | Prisma.ComplexDefaultArgs<ExtArgs>
|
||||
device?: boolean | Prisma.Pos$deviceArgs<ExtArgs>
|
||||
account?: boolean | Prisma.Pos$accountArgs<ExtArgs>
|
||||
provider?: boolean | Prisma.Pos$providerArgs<ExtArgs>
|
||||
permission_pos?: boolean | Prisma.Pos$permission_posArgs<ExtArgs>
|
||||
sales_invoices?: boolean | Prisma.Pos$sales_invoicesArgs<ExtArgs>
|
||||
@@ -1219,13 +1389,15 @@ export type PosSelectScalar = {
|
||||
updated_at?: boolean
|
||||
complex_id?: boolean
|
||||
device_id?: boolean
|
||||
account_id?: boolean
|
||||
provider_id?: boolean
|
||||
}
|
||||
|
||||
export type PosOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "model" | "serial_number" | "status" | "pos_type" | "created_at" | "updated_at" | "complex_id" | "device_id" | "provider_id", ExtArgs["result"]["pos"]>
|
||||
export type PosOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "name" | "model" | "serial_number" | "status" | "pos_type" | "created_at" | "updated_at" | "complex_id" | "device_id" | "account_id" | "provider_id", ExtArgs["result"]["pos"]>
|
||||
export type PosInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
complex?: boolean | Prisma.ComplexDefaultArgs<ExtArgs>
|
||||
device?: boolean | Prisma.Pos$deviceArgs<ExtArgs>
|
||||
account?: boolean | Prisma.Pos$accountArgs<ExtArgs>
|
||||
provider?: boolean | Prisma.Pos$providerArgs<ExtArgs>
|
||||
permission_pos?: boolean | Prisma.Pos$permission_posArgs<ExtArgs>
|
||||
sales_invoices?: boolean | Prisma.Pos$sales_invoicesArgs<ExtArgs>
|
||||
@@ -1237,6 +1409,7 @@ export type $PosPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
objects: {
|
||||
complex: Prisma.$ComplexPayload<ExtArgs>
|
||||
device: Prisma.$DevicePayload<ExtArgs> | null
|
||||
account: Prisma.$ConsumerAccountPayload<ExtArgs> | null
|
||||
provider: Prisma.$ProviderPayload<ExtArgs> | null
|
||||
permission_pos: Prisma.$PermissionPosPayload<ExtArgs>[]
|
||||
sales_invoices: Prisma.$SalesInvoicePayload<ExtArgs>[]
|
||||
@@ -1252,6 +1425,7 @@ export type $PosPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
updated_at: Date
|
||||
complex_id: string
|
||||
device_id: string | null
|
||||
account_id: string | null
|
||||
provider_id: string | null
|
||||
}, ExtArgs["result"]["pos"]>
|
||||
composites: {}
|
||||
@@ -1595,6 +1769,7 @@ export interface Prisma__PosClient<T, Null = never, ExtArgs extends runtime.Type
|
||||
readonly [Symbol.toStringTag]: "PrismaPromise"
|
||||
complex<T extends Prisma.ComplexDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.ComplexDefaultArgs<ExtArgs>>): Prisma.Prisma__ComplexClient<runtime.Types.Result.GetResult<Prisma.$ComplexPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
|
||||
device<T extends Prisma.Pos$deviceArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Pos$deviceArgs<ExtArgs>>): Prisma.Prisma__DeviceClient<runtime.Types.Result.GetResult<Prisma.$DevicePayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
account<T extends Prisma.Pos$accountArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Pos$accountArgs<ExtArgs>>): Prisma.Prisma__ConsumerAccountClient<runtime.Types.Result.GetResult<Prisma.$ConsumerAccountPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
provider<T extends Prisma.Pos$providerArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Pos$providerArgs<ExtArgs>>): Prisma.Prisma__ProviderClient<runtime.Types.Result.GetResult<Prisma.$ProviderPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
permission_pos<T extends Prisma.Pos$permission_posArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Pos$permission_posArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$PermissionPosPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
sales_invoices<T extends Prisma.Pos$sales_invoicesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Pos$sales_invoicesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SalesInvoicePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
@@ -1637,6 +1812,7 @@ export interface PosFieldRefs {
|
||||
readonly updated_at: Prisma.FieldRef<"Pos", 'DateTime'>
|
||||
readonly complex_id: Prisma.FieldRef<"Pos", 'String'>
|
||||
readonly device_id: Prisma.FieldRef<"Pos", 'String'>
|
||||
readonly account_id: Prisma.FieldRef<"Pos", 'String'>
|
||||
readonly provider_id: Prisma.FieldRef<"Pos", 'String'>
|
||||
}
|
||||
|
||||
@@ -2004,6 +2180,25 @@ export type Pos$deviceArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
||||
where?: Prisma.DeviceWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* Pos.account
|
||||
*/
|
||||
export type Pos$accountArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the ConsumerAccount
|
||||
*/
|
||||
select?: Prisma.ConsumerAccountSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the ConsumerAccount
|
||||
*/
|
||||
omit?: Prisma.ConsumerAccountOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.ConsumerAccountInclude<ExtArgs> | null
|
||||
where?: Prisma.ConsumerAccountWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* Pos.provider
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { PasswordUtil } from '@/common/utils/password.util'
|
||||
import { AccountStatus, AccountType } from '@/generated/prisma/enums'
|
||||
import { ConsumerRole } from '@/generated/prisma/enums'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import { CreateConsumerAccountDto, UpdateAccountDto } from './dto/account.dto'
|
||||
import { UpdateAccountDto } from './dto/account.dto'
|
||||
|
||||
@Injectable()
|
||||
export class AccountsService {
|
||||
@@ -11,11 +10,33 @@ export class AccountsService {
|
||||
|
||||
async findAll(consumer_id: string) {
|
||||
const accounts = await this.prisma.consumerAccount.findMany({
|
||||
where: { consumer_id },
|
||||
where: {
|
||||
consumer_id,
|
||||
role: {
|
||||
not: ConsumerRole.OWNER,
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
role: true,
|
||||
created_at: true,
|
||||
pos: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
complex: {
|
||||
select: {
|
||||
name: true,
|
||||
branch_code: true,
|
||||
business_activity: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
account: {
|
||||
select: {
|
||||
username: true,
|
||||
@@ -45,30 +66,30 @@ export class AccountsService {
|
||||
return ResponseMapper.single(account)
|
||||
}
|
||||
|
||||
async create(consumerId: string, data: CreateConsumerAccountDto) {
|
||||
const account = await this.prisma.consumerAccount.create({
|
||||
data: {
|
||||
role: data.role,
|
||||
account: {
|
||||
create: {
|
||||
password: await PasswordUtil.hash(data.password),
|
||||
status: AccountStatus.ACTIVE,
|
||||
type: AccountType.CONSUMER,
|
||||
username: data.username,
|
||||
},
|
||||
},
|
||||
consumer: {
|
||||
connect: {
|
||||
id: consumerId,
|
||||
},
|
||||
},
|
||||
permission: {
|
||||
create: {},
|
||||
},
|
||||
},
|
||||
})
|
||||
return ResponseMapper.create(account)
|
||||
}
|
||||
// async create(consumerId: string, data: CreateConsumerAccountDto) {
|
||||
// const account = await this.prisma.consumerAccount.create({
|
||||
// data: {
|
||||
// role: data.role,
|
||||
// account: {
|
||||
// create: {
|
||||
// password: await PasswordUtil.hash(data.password),
|
||||
// status: AccountStatus.ACTIVE,
|
||||
// type: AccountType.CONSUMER,
|
||||
// username: data.username,
|
||||
// },
|
||||
// },
|
||||
// consumer: {
|
||||
// connect: {
|
||||
// id: consumerId,
|
||||
// },
|
||||
// },
|
||||
// permission: {
|
||||
// create: {},
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
// return ResponseMapper.create(account)
|
||||
// }
|
||||
|
||||
async update(id: string, data: UpdateAccountDto) {
|
||||
const account = await this.prisma.account.update({ where: { id }, data })
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ApiProperty, PartialType } from '@nestjs/swagger'
|
||||
import { IsEnum, IsOptional, IsString } from 'class-validator'
|
||||
import { AccountStatus, ConsumerRole } from 'generated/prisma/enums'
|
||||
import { AccountStatus } from 'generated/prisma/enums'
|
||||
|
||||
export class CreateConsumerAccountDto {
|
||||
@IsString()
|
||||
@@ -11,9 +11,9 @@ export class CreateConsumerAccountDto {
|
||||
@ApiProperty({ required: true })
|
||||
password: string
|
||||
|
||||
@IsEnum(ConsumerRole)
|
||||
@ApiProperty({ required: true, enum: ConsumerRole })
|
||||
role: ConsumerRole
|
||||
// @IsEnum(ConsumerRole)
|
||||
// @ApiProperty({ required: true, enum: ConsumerRole })
|
||||
// role: ConsumerRole
|
||||
}
|
||||
|
||||
export class UpdateAccountDto extends PartialType(CreateConsumerAccountDto) {
|
||||
|
||||
@@ -8,6 +8,10 @@ export class BusinessActivitiesService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
defaultSelect: BusinessActivitySelect = {
|
||||
id: true,
|
||||
name: true,
|
||||
economic_code: true,
|
||||
created_at: true,
|
||||
guild: {
|
||||
select: {
|
||||
id: true,
|
||||
@@ -15,9 +19,15 @@ export class BusinessActivitiesService {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
id: true,
|
||||
name: true,
|
||||
created_at: true,
|
||||
complexes: {
|
||||
select: {
|
||||
_count: {
|
||||
select: {
|
||||
pos_list: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
license_activation: {
|
||||
select: {
|
||||
id: true,
|
||||
@@ -38,7 +48,7 @@ export class BusinessActivitiesService {
|
||||
}
|
||||
|
||||
private readonly prepareBusinessActivityResponse = (businessActivity: any) => {
|
||||
const { license_activation, ...rest } = businessActivity
|
||||
const { license_activation, complexes, ...rest } = businessActivity
|
||||
const { license, ...license_activation_rest } = license_activation
|
||||
const { accounts_limit, _count } = license
|
||||
|
||||
@@ -47,6 +57,10 @@ export class BusinessActivitiesService {
|
||||
license_info: {
|
||||
...license_activation_rest,
|
||||
accounts_limit: accounts_limit + _count.account_allocations,
|
||||
allocated_account_count: complexes.reduce(
|
||||
(acc: number, complex: any) => acc + complex._count.pos_list,
|
||||
0,
|
||||
),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { TokenAccount } from '@/common/decorators/tokenInfo.decorator'
|
||||
import { Body, Controller, Get, Param, Patch } from '@nestjs/common'
|
||||
import { ConsumerInfo } from '@/common/decorators/consumerInfo.decorator'
|
||||
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
|
||||
import { ApiTags } from '@nestjs/swagger'
|
||||
import { BusinessActivityComplexesService } from './complexes.service'
|
||||
import { UpdateComplexDto } from './dto/complex.dto'
|
||||
import { CreateConsumerComplexDto, UpdateConsumerComplexDto } from './dto/complex.dto'
|
||||
|
||||
@ApiTags('AdminBusinessActivityComplexes')
|
||||
@Controller('consumer/business_activities/:businessActivityId/complexes')
|
||||
@@ -11,28 +11,37 @@ export class BusinessActivityComplexesController {
|
||||
|
||||
@Get()
|
||||
async findAll(
|
||||
@TokenAccount('userId') userId: string,
|
||||
@ConsumerInfo('id') consumerId: string,
|
||||
@Param('businessActivityId') businessActivityId: string,
|
||||
) {
|
||||
return this.service.findAll(userId, businessActivityId)
|
||||
return this.service.findAll(consumerId, businessActivityId)
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
async findOne(
|
||||
@TokenAccount('userId') userId: string,
|
||||
@ConsumerInfo('id') consumerId: string,
|
||||
@Param('businessActivityId') businessActivityId: string,
|
||||
@Param('id') id: string,
|
||||
) {
|
||||
return this.service.findOne(userId, businessActivityId, id)
|
||||
return this.service.findOne(consumerId, businessActivityId, id)
|
||||
}
|
||||
|
||||
@Post('')
|
||||
async create(
|
||||
@ConsumerInfo('id') consumerId: string,
|
||||
@Param('businessActivityId') businessActivityId: string,
|
||||
@Body() data: CreateConsumerComplexDto,
|
||||
) {
|
||||
return this.service.create(consumerId, businessActivityId, data)
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
async update(
|
||||
@TokenAccount('userId') userId: string,
|
||||
@ConsumerInfo('id') consumerId: string,
|
||||
@Param('businessActivityId') businessActivityId: string,
|
||||
@Param('id') id: string,
|
||||
@Body() data: UpdateComplexDto,
|
||||
@Body() data: UpdateConsumerComplexDto,
|
||||
) {
|
||||
return this.service.update(userId, businessActivityId, id, data)
|
||||
return this.service.update(consumerId, businessActivityId, id, data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { ComplexSelect } from '@/generated/prisma/models'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { BadRequestException, Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import { UpdateComplexDto } from './dto/complex.dto'
|
||||
import { getBusinessActivityRemainingAccounts } from '../../utils/getBusinessActivityRemainingAccounts.util'
|
||||
import { CreateConsumerComplexDto, UpdateConsumerComplexDto } from './dto/complex.dto'
|
||||
|
||||
@Injectable()
|
||||
export class BusinessActivityComplexesService {
|
||||
@@ -47,11 +48,42 @@ export class BusinessActivityComplexesService {
|
||||
return ResponseMapper.single(account)
|
||||
}
|
||||
|
||||
async create(
|
||||
consumer_id: string,
|
||||
business_activity_id: string,
|
||||
data: CreateConsumerComplexDto,
|
||||
) {
|
||||
const complex = await this.prisma.$transaction(async tx => {
|
||||
const quota = await getBusinessActivityRemainingAccounts(tx, {
|
||||
consumer_id,
|
||||
business_activity_id,
|
||||
})
|
||||
|
||||
if (quota.remaining_accounts <= 0) {
|
||||
throw new BadRequestException(
|
||||
`متاسفانه به دلیل به پایان رسیدن محدودیت تعریف کاربران برای این فعالیت اقتصادی،امکان ایجاد شعبهی جدید وجود ندارد.`,
|
||||
)
|
||||
}
|
||||
|
||||
return await tx.complex.create({
|
||||
data: {
|
||||
...data,
|
||||
business_activity: {
|
||||
connect: {
|
||||
id: business_activity_id,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
return ResponseMapper.create(complex)
|
||||
}
|
||||
|
||||
async update(
|
||||
consumer_id: string,
|
||||
business_activity_id: string,
|
||||
id: string,
|
||||
data: UpdateComplexDto,
|
||||
data: UpdateConsumerComplexDto,
|
||||
) {
|
||||
const account = await this.prisma.complex.update({
|
||||
where: {
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
import { ApiProperty, PartialType } from '@nestjs/swagger'
|
||||
import { IsString } from 'class-validator'
|
||||
import { IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreateComplexDto {
|
||||
export class CreateConsumerComplexDto {
|
||||
@IsString()
|
||||
@ApiProperty({})
|
||||
@ApiProperty({ required: true })
|
||||
name: string
|
||||
|
||||
@IsString()
|
||||
@ApiProperty({})
|
||||
tax_id: string
|
||||
@ApiProperty({ required: true })
|
||||
branch_code: string
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@ApiProperty({})
|
||||
address: string
|
||||
}
|
||||
|
||||
export class UpdateComplexDto extends PartialType(CreateComplexDto) {}
|
||||
export class UpdateConsumerComplexDto extends PartialType(CreateConsumerComplexDto) {}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { POSStatus, POSType } from '@/generated/prisma/enums'
|
||||
import { ApiProperty, PartialType } from '@nestjs/swagger'
|
||||
import { CreateConsumerAccountDto } from '@/modules/consumer/accounts/dto/account.dto'
|
||||
import { ApiProperty, OmitType, PartialType } from '@nestjs/swagger'
|
||||
import { IsEnum, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreatePosDto {
|
||||
export class CreatePosDto extends CreateConsumerAccountDto {
|
||||
@IsString()
|
||||
@ApiProperty({})
|
||||
name: string
|
||||
@@ -31,7 +32,11 @@ export class CreatePosDto {
|
||||
provider_id: string
|
||||
}
|
||||
|
||||
export class UpdatePosDto extends PartialType(CreatePosDto) {
|
||||
export class UpdatePosDto extends OmitType(PartialType(CreatePosDto), [
|
||||
'username',
|
||||
'password',
|
||||
'pos_type',
|
||||
]) {
|
||||
@IsEnum(POSStatus)
|
||||
@IsOptional()
|
||||
@ApiProperty({ enum: POSStatus })
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TokenAccount } from '@/common/decorators/tokenInfo.decorator'
|
||||
import { ConsumerInfo } from '@/common/decorators/consumerInfo.decorator'
|
||||
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
|
||||
import { ApiTags } from '@nestjs/swagger'
|
||||
import { CreatePosDto, UpdatePosDto } from './dto/pos.dto'
|
||||
@@ -11,35 +11,42 @@ export class ComplexPosesController {
|
||||
|
||||
@Get()
|
||||
async findAll(
|
||||
@TokenAccount('userId') userId: string,
|
||||
@ConsumerInfo('id') consumerId: string,
|
||||
@Param('businessActivityId') businessActivityId: string,
|
||||
@Param('complexId') complexId: string,
|
||||
) {
|
||||
return this.service.findAll(userId, businessActivityId, complexId)
|
||||
return this.service.findAll(consumerId, businessActivityId, complexId)
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
async findOne(
|
||||
@ConsumerInfo('id') consumerId: string,
|
||||
@Param('businessActivityId') businessActivityId: string,
|
||||
@Param('complexId') complexId: string,
|
||||
@Param('id') id: string,
|
||||
) {
|
||||
return this.service.findOne(businessActivityId, complexId, id)
|
||||
return this.service.findOne(consumerId, businessActivityId, complexId, id)
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(@Param('complexId') complexId: string, @Body() data: CreatePosDto) {
|
||||
return this.service.create(complexId, data)
|
||||
async create(
|
||||
@ConsumerInfo('id') consumerId: string,
|
||||
@Param('businessActivityId') businessActivityId: string,
|
||||
@Param('complexId') complexId: string,
|
||||
@Body() data: CreatePosDto,
|
||||
) {
|
||||
return this.service.create(consumerId, businessActivityId, complexId, data)
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
async update(
|
||||
@ConsumerInfo('id') consumerId: string,
|
||||
@Param('businessActivityId') businessActivityId: string,
|
||||
@Param('complexId') complexId: string,
|
||||
@Param('id') id: string,
|
||||
@Body() data: UpdatePosDto,
|
||||
) {
|
||||
return this.service.update(businessActivityId, complexId, id, data)
|
||||
return this.service.update(consumerId, businessActivityId, complexId, id, data)
|
||||
}
|
||||
|
||||
// @Delete(':id')
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import { POSStatus } from '@/generated/prisma/enums'
|
||||
import { PosCreateInput, PosSelect } from '@/generated/prisma/models'
|
||||
import { PasswordUtil } from '@/common/utils/password.util'
|
||||
import {
|
||||
AccountStatus,
|
||||
AccountType,
|
||||
ConsumerRole,
|
||||
POSStatus,
|
||||
} from '@/generated/prisma/enums'
|
||||
import { PosCreateInput, PosSelect, PosWhereInput } from '@/generated/prisma/models'
|
||||
import { getBusinessActivityRemainingAccounts } from '@/modules/consumer/utils/getBusinessActivityRemainingAccounts.util'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { BadRequestException, Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import { CreatePosDto, UpdatePosDto } from './dto/pos.dto'
|
||||
|
||||
@@ -9,7 +16,7 @@ import { CreatePosDto, UpdatePosDto } from './dto/pos.dto'
|
||||
export class ComplexPosesService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
defaultSelect = {
|
||||
defaultSelect: PosSelect = {
|
||||
id: true,
|
||||
name: true,
|
||||
model: true,
|
||||
@@ -48,10 +55,28 @@ export class ComplexPosesService {
|
||||
},
|
||||
},
|
||||
},
|
||||
} as PosSelect
|
||||
}
|
||||
|
||||
defaultInsert = (data: CreatePosDto, complex_id: string) => {
|
||||
const { device_id, provider_id, ...rest } = data
|
||||
defaultWhere = (
|
||||
consumer_id: string,
|
||||
business_activity_id: string,
|
||||
complex_id: string,
|
||||
): PosWhereInput => ({
|
||||
complex: {
|
||||
id: complex_id,
|
||||
business_activity: {
|
||||
id: business_activity_id,
|
||||
consumer_id,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
defaultInsert = async (
|
||||
consumer_id: string,
|
||||
complex_id: string,
|
||||
data: CreatePosDto,
|
||||
): Promise<PosCreateInput> => {
|
||||
const { device_id, provider_id, username, password, ...rest } = data
|
||||
|
||||
return {
|
||||
...rest,
|
||||
@@ -60,6 +85,24 @@ export class ComplexPosesService {
|
||||
id: complex_id,
|
||||
},
|
||||
},
|
||||
account: {
|
||||
create: {
|
||||
role: ConsumerRole.OPERATOR,
|
||||
account: {
|
||||
create: {
|
||||
username,
|
||||
password: await PasswordUtil.hash(password),
|
||||
type: AccountType.CONSUMER,
|
||||
status: AccountStatus.ACTIVE,
|
||||
},
|
||||
},
|
||||
consumer: {
|
||||
connect: {
|
||||
id: consumer_id,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
provider: provider_id
|
||||
? {
|
||||
connect: {
|
||||
@@ -74,67 +117,73 @@ export class ComplexPosesService {
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
} as PosCreateInput
|
||||
}
|
||||
}
|
||||
|
||||
async findAll(consumer_id: string, business_activity_id: string, complex_id: string) {
|
||||
const poses = await this.prisma.pos.findMany({
|
||||
where: {
|
||||
complex: {
|
||||
id: complex_id,
|
||||
business_activity: {
|
||||
id: business_activity_id,
|
||||
consumer_id,
|
||||
},
|
||||
},
|
||||
},
|
||||
where: this.defaultWhere(consumer_id, business_activity_id, complex_id),
|
||||
select: this.defaultSelect,
|
||||
})
|
||||
|
||||
return ResponseMapper.list(poses)
|
||||
}
|
||||
|
||||
async findOne(business_activity_id: string, complex_id: string, id: string) {
|
||||
const account = await this.prisma.pos.findUnique({
|
||||
async findOne(
|
||||
consumer_id: string,
|
||||
business_activity_id: string,
|
||||
complex_id: string,
|
||||
id: string,
|
||||
) {
|
||||
const pos = await this.prisma.pos.findUnique({
|
||||
where: {
|
||||
complex: {
|
||||
id: complex_id,
|
||||
business_activity: {
|
||||
id: business_activity_id,
|
||||
},
|
||||
},
|
||||
...(this.defaultWhere(consumer_id, business_activity_id, complex_id) as any),
|
||||
id,
|
||||
},
|
||||
select: this.defaultSelect,
|
||||
})
|
||||
return ResponseMapper.single(account)
|
||||
return ResponseMapper.single(pos)
|
||||
}
|
||||
|
||||
async create(complex_id: string, data: CreatePosDto) {
|
||||
const account = await this.prisma.pos.create({
|
||||
async create(
|
||||
consumer_id: string,
|
||||
business_activity_id: string,
|
||||
complex_id: string,
|
||||
data: CreatePosDto,
|
||||
) {
|
||||
const pos = await this.prisma.$transaction(async tx => {
|
||||
const quota = await getBusinessActivityRemainingAccounts(tx, {
|
||||
consumer_id,
|
||||
business_activity_id,
|
||||
})
|
||||
|
||||
if (quota.remaining_accounts <= 0) {
|
||||
throw new BadRequestException(
|
||||
`تعداد کاربرهای تخصیص داده شده برای این فعالیت تجاری به پایان رسیده است.`,
|
||||
)
|
||||
}
|
||||
|
||||
return await tx.pos.create({
|
||||
data: {
|
||||
...this.defaultInsert(data, complex_id),
|
||||
...(await this.defaultInsert(consumer_id, complex_id, data)),
|
||||
status: POSStatus.ACTIVE,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.create(account)
|
||||
})
|
||||
return ResponseMapper.create(pos)
|
||||
}
|
||||
|
||||
async update(
|
||||
consumer_id: string,
|
||||
business_activity_id: string,
|
||||
complex_id: string,
|
||||
id: string,
|
||||
data: UpdatePosDto,
|
||||
) {
|
||||
const { device_id, provider_id, ...rest } = data
|
||||
const account = await this.prisma.pos.update({
|
||||
const pos = await this.prisma.pos.update({
|
||||
where: {
|
||||
complex: {
|
||||
id: complex_id,
|
||||
business_activity: {
|
||||
id: business_activity_id,
|
||||
},
|
||||
},
|
||||
...(this.defaultWhere(consumer_id, business_activity_id, complex_id) as any),
|
||||
id,
|
||||
},
|
||||
data: {
|
||||
@@ -160,11 +209,6 @@ export class ComplexPosesService {
|
||||
...rest,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.update(account)
|
||||
return ResponseMapper.update(pos)
|
||||
}
|
||||
|
||||
// async delete(id: string) {
|
||||
// await this.prisma.complex.delete({ where: { id } })
|
||||
// return ResponseMapper.delete()
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -21,7 +21,12 @@ export class PosesService {
|
||||
where: this.defaultWhere(consumer_id),
|
||||
select: this.defaultSelect,
|
||||
})
|
||||
return ResponseMapper.list(poses)
|
||||
return ResponseMapper.list(
|
||||
poses.map((pos: any) => ({
|
||||
...pos,
|
||||
account: { username: pos.account.account.username },
|
||||
})),
|
||||
)
|
||||
}
|
||||
|
||||
async findOne(consumer_id: string, id: string) {
|
||||
@@ -29,7 +34,13 @@ export class PosesService {
|
||||
where: { ...this.defaultWhere(consumer_id), id },
|
||||
select: this.defaultSelect,
|
||||
})
|
||||
return ResponseMapper.single(pos)
|
||||
|
||||
// @ts-ignore
|
||||
const { username } = pos.account?.account
|
||||
return ResponseMapper.single({
|
||||
...pos,
|
||||
account: { username },
|
||||
})
|
||||
}
|
||||
|
||||
async update(consumer_id: string, id: string, data: any) {
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
import { BadRequestException } from '@nestjs/common'
|
||||
|
||||
type BusinessActivityAccountQuotaClient = {
|
||||
licenseActivation: {
|
||||
findFirst: (args: any) => Promise<any>
|
||||
}
|
||||
pos: {
|
||||
count: (args: any) => Promise<number>
|
||||
}
|
||||
}
|
||||
|
||||
type GetBusinessActivityRemainingAccountsParams = {
|
||||
consumer_id: string
|
||||
business_activity_id: string
|
||||
referenceDate?: Date
|
||||
}
|
||||
|
||||
export type BusinessActivityRemainingAccounts = {
|
||||
total_allocated_accounts: number
|
||||
used_accounts: number
|
||||
remaining_accounts: number
|
||||
}
|
||||
|
||||
export const getBusinessActivityRemainingAccounts = async (
|
||||
prisma: BusinessActivityAccountQuotaClient,
|
||||
params: GetBusinessActivityRemainingAccountsParams,
|
||||
): Promise<BusinessActivityRemainingAccounts> => {
|
||||
const { consumer_id, business_activity_id, referenceDate = new Date() } = params
|
||||
|
||||
const startOfDay = new Date(referenceDate)
|
||||
startOfDay.setHours(0, 0, 0, 0)
|
||||
|
||||
const relatedLicense = await prisma.licenseActivation.findFirst({
|
||||
where: {
|
||||
business_activity_id,
|
||||
business_activity: {
|
||||
consumer_id,
|
||||
},
|
||||
OR: [
|
||||
{
|
||||
expires_at: {
|
||||
gte: startOfDay,
|
||||
},
|
||||
},
|
||||
{
|
||||
license_renews: {
|
||||
some: {
|
||||
expires_at: {
|
||||
gte: startOfDay,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
select: {
|
||||
license: {
|
||||
select: {
|
||||
accounts_limit: true,
|
||||
_count: {
|
||||
select: {
|
||||
account_allocations: {
|
||||
where: {
|
||||
license_id: {
|
||||
not: null,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (!relatedLicense) {
|
||||
throw new BadRequestException('برای این فعالیت تجاری لایسنس فعالی وجود ندارد.')
|
||||
}
|
||||
|
||||
const { accounts_limit, _count } = relatedLicense.license
|
||||
const totalAllocatedAccounts = accounts_limit + _count.account_allocations
|
||||
|
||||
const usedAccounts = await prisma.pos.count({
|
||||
where: {
|
||||
account_id: {
|
||||
not: null,
|
||||
},
|
||||
complex: {
|
||||
business_activity_id,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
return {
|
||||
total_allocated_accounts: totalAllocatedAccounts,
|
||||
used_accounts: usedAccounts,
|
||||
remaining_accounts: totalAllocatedAccounts - usedAccounts,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user