diff --git a/prisma/migrations/20260221122745_init/migration.sql b/prisma/migrations/20260221122745_init/migration.sql new file mode 100644 index 0000000..c68b885 --- /dev/null +++ b/prisma/migrations/20260221122745_init/migration.sql @@ -0,0 +1,55 @@ +/* + Warnings: + + - You are about to drop the column `account_id` on the `customers` table. All the data in the column will be lost. + - You are about to drop the column `address` on the `customers` table. All the data in the column will be lost. + - You are about to drop the column `email` on the `customers` table. All the data in the column will be lost. + - You are about to drop the column `first_name` on the `customers` table. All the data in the column will be lost. + - You are about to drop the column `is_active` on the `customers` table. All the data in the column will be lost. + - You are about to drop the column `last_name` on the `customers` table. All the data in the column will be lost. + - You are about to drop the column `mobile_number` on the `customers` table. All the data in the column will be lost. + - Added the required column `type` to the `customers` table without a default value. This is not possible if the table is not empty. + +*/ +-- DropIndex +DROP INDEX `customers_mobile_number_key` ON `customers`; + +-- AlterTable +ALTER TABLE `customers` DROP COLUMN `account_id`, + DROP COLUMN `address`, + DROP COLUMN `email`, + DROP COLUMN `first_name`, + DROP COLUMN `is_active`, + DROP COLUMN `last_name`, + DROP COLUMN `mobile_number`, + ADD COLUMN `is_favorite` BOOLEAN NULL DEFAULT false, + ADD COLUMN `type` ENUM('INDIVIDUAL', 'LEGAL') NOT NULL; + +-- CreateTable +CREATE TABLE `customer_individuals` ( + `customer_id` VARCHAR(191) NOT NULL, + `first_name` VARCHAR(255) NOT NULL, + `last_name` VARCHAR(255) NOT NULL, + `national_id` CHAR(10) NOT NULL, + `postal_code` CHAR(10) NOT NULL, + `economic_code` CHAR(10) NULL, + + PRIMARY KEY (`customer_id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- CreateTable +CREATE TABLE `customer_legal` ( + `customer_id` VARCHAR(191) NOT NULL, + `company_name` VARCHAR(255) NOT NULL, + `economic_code` CHAR(10) NOT NULL, + `registration_number` CHAR(20) NOT NULL, + `postal_code` CHAR(10) NOT NULL, + + PRIMARY KEY (`customer_id`) +) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- AddForeignKey +ALTER TABLE `customer_individuals` ADD CONSTRAINT `customer_individuals_customer_id_fkey` FOREIGN KEY (`customer_id`) REFERENCES `customers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE `customer_legal` ADD CONSTRAINT `customer_legal_customer_id_fkey` FOREIGN KEY (`customer_id`) REFERENCES `customers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20260221124338_init/migration.sql b/prisma/migrations/20260221124338_init/migration.sql new file mode 100644 index 0000000..323fe48 --- /dev/null +++ b/prisma/migrations/20260221124338_init/migration.sql @@ -0,0 +1,3 @@ +-- AlterTable +ALTER TABLE `sales_invoice_items` ADD COLUMN `discount` DECIMAL(15, 2) NOT NULL DEFAULT 0.00, + ADD COLUMN `pricingModel` ENUM('STANDARD', 'GOLD') NOT NULL DEFAULT 'STANDARD'; diff --git a/prisma/migrations/20260224080728_init/migration.sql b/prisma/migrations/20260224080728_init/migration.sql new file mode 100644 index 0000000..f5387bf --- /dev/null +++ b/prisma/migrations/20260224080728_init/migration.sql @@ -0,0 +1,20 @@ +/* + Warnings: + + - You are about to drop the column `description` on the `sales_invoices` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE `customers` MODIFY `type` ENUM('INDIVIDUAL', 'LEGAL', 'UNKNOWN') NOT NULL; + +-- AlterTable +ALTER TABLE `sales_invoice_items` ADD COLUMN `notes` TEXT NULL; + +-- AlterTable +ALTER TABLE `sales_invoice_payments` MODIFY `payment_method` ENUM('TERMINAL', 'CASH', 'SET_OFF', 'CARD', 'BANK', 'CHECK', 'OTHER') NOT NULL; + +-- AlterTable +ALTER TABLE `sales_invoices` DROP COLUMN `description`, + ADD COLUMN `invoice_date` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0), + ADD COLUMN `notes` TEXT NULL, + ADD COLUMN `unknown_customer` JSON NULL; diff --git a/prisma/schema/customers.prisma b/prisma/schema/customers.prisma index 7f7a7dc..fddec2a 100644 --- a/prisma/schema/customers.prisma +++ b/prisma/schema/customers.prisma @@ -1,19 +1,44 @@ model Customer { - id String @id @default(uuid()) - first_name String @db.VarChar(255) - last_name String @db.VarChar(255) - email String? @db.VarChar(255) - mobile_number String @unique @db.Char(11) - address String? @db.Text - is_active Boolean @default(true) - account_id String - complex_id String + id String @id @default(uuid()) + created_at DateTime @default(now()) @db.Timestamp(0) + updated_at DateTime @updatedAt @db.Timestamp(0) + deleted_at DateTime? @db.Timestamp(0) + type CustomerType + complex_id String + is_favorite Boolean? @default(false) - created_at DateTime @default(now()) @db.Timestamp(0) - updated_at DateTime @updatedAt @db.Timestamp(0) - deleted_at DateTime? @db.Timestamp(0) - - sales_invoices SalesInvoice[] + sales_invoices SalesInvoice[] + customerIndividuals CustomerIndividual? + customerLegals CustomerLegal? @@map("customers") } + +model CustomerIndividual { + customer_id String @id + first_name String @db.VarChar(255) + last_name String @db.VarChar(255) + national_id String @db.Char(10) + postal_code String @db.Char(10) + economic_code String? @db.Char(10) + complex_id String + + customer Customer @relation(fields: [customer_id], references: [id]) + + @@unique([complex_id, national_id]) + @@map("customer_individuals") +} + +model CustomerLegal { + customer_id String @id + company_name String @db.VarChar(255) + economic_code String @db.Char(10) + registration_number String @db.Char(20) + postal_code String @db.Char(10) + complex_id String + + customer Customer @relation(fields: [customer_id], references: [id]) + + @@unique([complex_id, registration_number]) + @@map("customer_legal") +} diff --git a/prisma/schema/enum.prisma b/prisma/schema/enum.prisma index 96d2a83..fcb95dd 100644 --- a/prisma/schema/enum.prisma +++ b/prisma/schema/enum.prisma @@ -1,5 +1,7 @@ enum PaymentMethodType { + TERMINAL CASH + SET_OFF CARD BANK CHECK @@ -25,3 +27,14 @@ enum UnitType { METER HOUR } + +enum CustomerType { + INDIVIDUAL + LEGAL + UNKNOWN +} + +enum SalesInvoiceItemPricingModel { + STANDARD + GOLD +} diff --git a/prisma/schema/sales.prisma b/prisma/schema/sales.prisma index 5b5361f..66799f7 100644 --- a/prisma/schema/sales.prisma +++ b/prisma/schema/sales.prisma @@ -1,31 +1,38 @@ model SalesInvoice { - id String @id @default(uuid()) - code String @unique @db.VarChar(100) - total_amount Decimal @db.Decimal(15, 2) - description String? @db.Text - created_at DateTime @default(now()) @db.Timestamp(0) - updated_at DateTime @updatedAt @db.Timestamp(0) - customer_id String? - account_id String - complex_id String + id String @id @default(uuid()) + code String @unique @db.VarChar(100) + total_amount Decimal @db.Decimal(15, 2) + notes String? @db.Text + unknown_customer Json? @db.Json + invoice_date DateTime? @default(now()) @db.Timestamp(0) + created_at DateTime @default(now()) @db.Timestamp(0) + updated_at DateTime @updatedAt @db.Timestamp(0) - customer Customer? @relation(fields: [customer_id], references: [id]) - items SalesInvoiceItem[] - sales_invoice_payments SalesInvoicePayment[] + customer_id String? + account_id String + complex_id String + + customer Customer? @relation(fields: [customer_id], references: [id]) + items SalesInvoiceItem[] + payments SalesInvoicePayment[] @@map("sales_invoices") } model SalesInvoiceItem { - id String @id @default(uuid()) - quantity Decimal @db.Decimal(10, 0) + id String @id @default(uuid()) + quantity Decimal @db.Decimal(10, 0) unit_type UnitType - unit_price Decimal @default(0.00) @db.Decimal(15, 2) - total_amount Decimal @default(0.00) @db.Decimal(15, 2) - created_at DateTime @default(now()) @db.Timestamp(0) - invoice_id String - good_id String? - service_id String? + unit_price Decimal @default(0.00) @db.Decimal(15, 2) + total_amount Decimal @default(0.00) @db.Decimal(15, 2) + created_at DateTime @default(now()) @db.Timestamp(0) + discount Decimal @default(0.00) @db.Decimal(15, 2) + notes String? @db.Text + pricingModel SalesInvoiceItemPricingModel @default(STANDARD) + + invoice_id String + good_id String? + service_id String? payload Json? diff --git a/src/common/interfaces/sale-invoice-payload.ts b/src/common/interfaces/sale-invoice-payload.ts index 2070081..d9993c6 100644 --- a/src/common/interfaces/sale-invoice-payload.ts +++ b/src/common/interfaces/sale-invoice-payload.ts @@ -1,7 +1,8 @@ import { GoldKarat } from '../enums/enums' -export interface SaleInvoicePayload { - karat?: keyof typeof GoldKarat - wages?: number - profit?: number +export interface SaleInvoiceGoldTypePayload { + karat: keyof typeof GoldKarat + wages: number + profit: number } +export interface SaleInvoiceStandardPayload {} diff --git a/src/generated/prisma/browser.ts b/src/generated/prisma/browser.ts index fcc41e4..c538525 100644 --- a/src/generated/prisma/browser.ts +++ b/src/generated/prisma/browser.ts @@ -22,6 +22,16 @@ export * from './enums.js'; * */ export type Customer = Prisma.CustomerModel +/** + * Model CustomerIndividual + * + */ +export type CustomerIndividual = Prisma.CustomerIndividualModel +/** + * Model CustomerLegal + * + */ +export type CustomerLegal = Prisma.CustomerLegalModel /** * Model Device * diff --git a/src/generated/prisma/client.ts b/src/generated/prisma/client.ts index 4624c03..1fcc61a 100644 --- a/src/generated/prisma/client.ts +++ b/src/generated/prisma/client.ts @@ -42,6 +42,16 @@ export { Prisma } * */ export type Customer = Prisma.CustomerModel +/** + * Model CustomerIndividual + * + */ +export type CustomerIndividual = Prisma.CustomerIndividualModel +/** + * Model CustomerLegal + * + */ +export type CustomerLegal = Prisma.CustomerLegalModel /** * Model Device * diff --git a/src/generated/prisma/commonInputTypes.ts b/src/generated/prisma/commonInputTypes.ts index 9728e25..ca45ae3 100644 --- a/src/generated/prisma/commonInputTypes.ts +++ b/src/generated/prisma/commonInputTypes.ts @@ -29,26 +29,6 @@ export type StringFilter<$PrismaModel = never> = { not?: Prisma.NestedStringFilter<$PrismaModel> | string } -export type StringNullableFilter<$PrismaModel = never> = { - equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null - in?: string[] | null - notIn?: string[] | null - lt?: string | Prisma.StringFieldRefInput<$PrismaModel> - lte?: string | Prisma.StringFieldRefInput<$PrismaModel> - gt?: string | Prisma.StringFieldRefInput<$PrismaModel> - gte?: string | Prisma.StringFieldRefInput<$PrismaModel> - contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - search?: string - not?: Prisma.NestedStringNullableFilter<$PrismaModel> | string | null -} - -export type BoolFilter<$PrismaModel = never> = { - equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> - not?: Prisma.NestedBoolFilter<$PrismaModel> | boolean -} - export type DateTimeFilter<$PrismaModel = never> = { equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> in?: Date[] | string[] @@ -71,6 +51,18 @@ export type DateTimeNullableFilter<$PrismaModel = never> = { not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null } +export type EnumCustomerTypeFilter<$PrismaModel = never> = { + equals?: $Enums.CustomerType | Prisma.EnumCustomerTypeFieldRefInput<$PrismaModel> + in?: $Enums.CustomerType[] + notIn?: $Enums.CustomerType[] + not?: Prisma.NestedEnumCustomerTypeFilter<$PrismaModel> | $Enums.CustomerType +} + +export type BoolNullableFilter<$PrismaModel = never> = { + equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> | null + not?: Prisma.NestedBoolNullableFilter<$PrismaModel> | boolean | null +} + export type SortOrderInput = { sort: Prisma.SortOrder nulls?: Prisma.NullsOrder @@ -94,32 +86,6 @@ export type StringWithAggregatesFilter<$PrismaModel = never> = { _max?: Prisma.NestedStringFilter<$PrismaModel> } -export type StringNullableWithAggregatesFilter<$PrismaModel = never> = { - equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null - in?: string[] | null - notIn?: string[] | null - lt?: string | Prisma.StringFieldRefInput<$PrismaModel> - lte?: string | Prisma.StringFieldRefInput<$PrismaModel> - gt?: string | Prisma.StringFieldRefInput<$PrismaModel> - gte?: string | Prisma.StringFieldRefInput<$PrismaModel> - contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - search?: string - not?: Prisma.NestedStringNullableWithAggregatesFilter<$PrismaModel> | string | null - _count?: Prisma.NestedIntNullableFilter<$PrismaModel> - _min?: Prisma.NestedStringNullableFilter<$PrismaModel> - _max?: Prisma.NestedStringNullableFilter<$PrismaModel> -} - -export type BoolWithAggregatesFilter<$PrismaModel = never> = { - equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> - not?: Prisma.NestedBoolWithAggregatesFilter<$PrismaModel> | boolean - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedBoolFilter<$PrismaModel> - _max?: Prisma.NestedBoolFilter<$PrismaModel> -} - export type DateTimeWithAggregatesFilter<$PrismaModel = never> = { equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> in?: Date[] | string[] @@ -148,6 +114,57 @@ export type DateTimeNullableWithAggregatesFilter<$PrismaModel = never> = { _max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> } +export type EnumCustomerTypeWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.CustomerType | Prisma.EnumCustomerTypeFieldRefInput<$PrismaModel> + in?: $Enums.CustomerType[] + notIn?: $Enums.CustomerType[] + not?: Prisma.NestedEnumCustomerTypeWithAggregatesFilter<$PrismaModel> | $Enums.CustomerType + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumCustomerTypeFilter<$PrismaModel> + _max?: Prisma.NestedEnumCustomerTypeFilter<$PrismaModel> +} + +export type BoolNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> | null + not?: Prisma.NestedBoolNullableWithAggregatesFilter<$PrismaModel> | boolean | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedBoolNullableFilter<$PrismaModel> + _max?: Prisma.NestedBoolNullableFilter<$PrismaModel> +} + +export type StringNullableFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null + in?: string[] | null + notIn?: string[] | null + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + search?: string + not?: Prisma.NestedStringNullableFilter<$PrismaModel> | string | null +} + +export type StringNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null + in?: string[] | null + notIn?: string[] | null + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + search?: string + not?: Prisma.NestedStringNullableWithAggregatesFilter<$PrismaModel> | string | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedStringNullableFilter<$PrismaModel> + _max?: Prisma.NestedStringNullableFilter<$PrismaModel> +} + export type DecimalFilter<$PrismaModel = never> = { equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] @@ -202,13 +219,6 @@ export type IntWithAggregatesFilter<$PrismaModel = never> = { _max?: Prisma.NestedIntFilter<$PrismaModel> } -export type EnumUnitTypeFilter<$PrismaModel = never> = { - equals?: $Enums.UnitType | Prisma.EnumUnitTypeFieldRefInput<$PrismaModel> - in?: $Enums.UnitType[] - notIn?: $Enums.UnitType[] - not?: Prisma.NestedEnumUnitTypeFilter<$PrismaModel> | $Enums.UnitType -} - export type JsonNullableFilter<$PrismaModel = never> = | Prisma.PatchUndefined< Prisma.Either>, Exclude>, 'path'>>, @@ -233,16 +243,6 @@ export type JsonNullableFilterBase<$PrismaModel = never> = { not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter } -export type EnumUnitTypeWithAggregatesFilter<$PrismaModel = never> = { - equals?: $Enums.UnitType | Prisma.EnumUnitTypeFieldRefInput<$PrismaModel> - in?: $Enums.UnitType[] - notIn?: $Enums.UnitType[] - not?: Prisma.NestedEnumUnitTypeWithAggregatesFilter<$PrismaModel> | $Enums.UnitType - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedEnumUnitTypeFilter<$PrismaModel> - _max?: Prisma.NestedEnumUnitTypeFilter<$PrismaModel> -} - export type JsonNullableWithAggregatesFilter<$PrismaModel = never> = | Prisma.PatchUndefined< Prisma.Either>, Exclude>, 'path'>>, @@ -270,6 +270,40 @@ export type JsonNullableWithAggregatesFilterBase<$PrismaModel = never> = { _max?: Prisma.NestedJsonNullableFilter<$PrismaModel> } +export type EnumUnitTypeFilter<$PrismaModel = never> = { + equals?: $Enums.UnitType | Prisma.EnumUnitTypeFieldRefInput<$PrismaModel> + in?: $Enums.UnitType[] + notIn?: $Enums.UnitType[] + not?: Prisma.NestedEnumUnitTypeFilter<$PrismaModel> | $Enums.UnitType +} + +export type EnumSalesInvoiceItemPricingModelFilter<$PrismaModel = never> = { + equals?: $Enums.SalesInvoiceItemPricingModel | Prisma.EnumSalesInvoiceItemPricingModelFieldRefInput<$PrismaModel> + in?: $Enums.SalesInvoiceItemPricingModel[] + notIn?: $Enums.SalesInvoiceItemPricingModel[] + not?: Prisma.NestedEnumSalesInvoiceItemPricingModelFilter<$PrismaModel> | $Enums.SalesInvoiceItemPricingModel +} + +export type EnumUnitTypeWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.UnitType | Prisma.EnumUnitTypeFieldRefInput<$PrismaModel> + in?: $Enums.UnitType[] + notIn?: $Enums.UnitType[] + not?: Prisma.NestedEnumUnitTypeWithAggregatesFilter<$PrismaModel> | $Enums.UnitType + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumUnitTypeFilter<$PrismaModel> + _max?: Prisma.NestedEnumUnitTypeFilter<$PrismaModel> +} + +export type EnumSalesInvoiceItemPricingModelWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.SalesInvoiceItemPricingModel | Prisma.EnumSalesInvoiceItemPricingModelFieldRefInput<$PrismaModel> + in?: $Enums.SalesInvoiceItemPricingModel[] + notIn?: $Enums.SalesInvoiceItemPricingModel[] + not?: Prisma.NestedEnumSalesInvoiceItemPricingModelWithAggregatesFilter<$PrismaModel> | $Enums.SalesInvoiceItemPricingModel + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumSalesInvoiceItemPricingModelFilter<$PrismaModel> + _max?: Prisma.NestedEnumSalesInvoiceItemPricingModelFilter<$PrismaModel> +} + export type EnumPaymentMethodTypeFilter<$PrismaModel = never> = { equals?: $Enums.PaymentMethodType | Prisma.EnumPaymentMethodTypeFieldRefInput<$PrismaModel> in?: $Enums.PaymentMethodType[] @@ -302,26 +336,6 @@ export type NestedStringFilter<$PrismaModel = never> = { not?: Prisma.NestedStringFilter<$PrismaModel> | string } -export type NestedStringNullableFilter<$PrismaModel = never> = { - equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null - in?: string[] | null - notIn?: string[] | null - lt?: string | Prisma.StringFieldRefInput<$PrismaModel> - lte?: string | Prisma.StringFieldRefInput<$PrismaModel> - gt?: string | Prisma.StringFieldRefInput<$PrismaModel> - gte?: string | Prisma.StringFieldRefInput<$PrismaModel> - contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - search?: string - not?: Prisma.NestedStringNullableFilter<$PrismaModel> | string | null -} - -export type NestedBoolFilter<$PrismaModel = never> = { - equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> - not?: Prisma.NestedBoolFilter<$PrismaModel> | boolean -} - export type NestedDateTimeFilter<$PrismaModel = never> = { equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> in?: Date[] | string[] @@ -344,6 +358,18 @@ export type NestedDateTimeNullableFilter<$PrismaModel = never> = { not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null } +export type NestedEnumCustomerTypeFilter<$PrismaModel = never> = { + equals?: $Enums.CustomerType | Prisma.EnumCustomerTypeFieldRefInput<$PrismaModel> + in?: $Enums.CustomerType[] + notIn?: $Enums.CustomerType[] + not?: Prisma.NestedEnumCustomerTypeFilter<$PrismaModel> | $Enums.CustomerType +} + +export type NestedBoolNullableFilter<$PrismaModel = never> = { + equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> | null + not?: Prisma.NestedBoolNullableFilter<$PrismaModel> | boolean | null +} + export type NestedStringWithAggregatesFilter<$PrismaModel = never> = { equals?: string | Prisma.StringFieldRefInput<$PrismaModel> in?: string[] @@ -373,43 +399,6 @@ export type NestedIntFilter<$PrismaModel = never> = { not?: Prisma.NestedIntFilter<$PrismaModel> | number } -export type NestedStringNullableWithAggregatesFilter<$PrismaModel = never> = { - equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null - in?: string[] | null - notIn?: string[] | null - lt?: string | Prisma.StringFieldRefInput<$PrismaModel> - lte?: string | Prisma.StringFieldRefInput<$PrismaModel> - gt?: string | Prisma.StringFieldRefInput<$PrismaModel> - gte?: string | Prisma.StringFieldRefInput<$PrismaModel> - contains?: string | Prisma.StringFieldRefInput<$PrismaModel> - startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> - search?: string - not?: Prisma.NestedStringNullableWithAggregatesFilter<$PrismaModel> | string | null - _count?: Prisma.NestedIntNullableFilter<$PrismaModel> - _min?: Prisma.NestedStringNullableFilter<$PrismaModel> - _max?: Prisma.NestedStringNullableFilter<$PrismaModel> -} - -export type NestedIntNullableFilter<$PrismaModel = never> = { - equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null - in?: number[] | null - notIn?: number[] | null - lt?: number | Prisma.IntFieldRefInput<$PrismaModel> - lte?: number | Prisma.IntFieldRefInput<$PrismaModel> - gt?: number | Prisma.IntFieldRefInput<$PrismaModel> - gte?: number | Prisma.IntFieldRefInput<$PrismaModel> - not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null -} - -export type NestedBoolWithAggregatesFilter<$PrismaModel = never> = { - equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> - not?: Prisma.NestedBoolWithAggregatesFilter<$PrismaModel> | boolean - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedBoolFilter<$PrismaModel> - _max?: Prisma.NestedBoolFilter<$PrismaModel> -} - export type NestedDateTimeWithAggregatesFilter<$PrismaModel = never> = { equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> in?: Date[] | string[] @@ -438,6 +427,68 @@ export type NestedDateTimeNullableWithAggregatesFilter<$PrismaModel = never> = { _max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> } +export type NestedIntNullableFilter<$PrismaModel = never> = { + equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | null + in?: number[] | null + notIn?: number[] | null + lt?: number | Prisma.IntFieldRefInput<$PrismaModel> + lte?: number | Prisma.IntFieldRefInput<$PrismaModel> + gt?: number | Prisma.IntFieldRefInput<$PrismaModel> + gte?: number | Prisma.IntFieldRefInput<$PrismaModel> + not?: Prisma.NestedIntNullableFilter<$PrismaModel> | number | null +} + +export type NestedEnumCustomerTypeWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.CustomerType | Prisma.EnumCustomerTypeFieldRefInput<$PrismaModel> + in?: $Enums.CustomerType[] + notIn?: $Enums.CustomerType[] + not?: Prisma.NestedEnumCustomerTypeWithAggregatesFilter<$PrismaModel> | $Enums.CustomerType + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumCustomerTypeFilter<$PrismaModel> + _max?: Prisma.NestedEnumCustomerTypeFilter<$PrismaModel> +} + +export type NestedBoolNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> | null + not?: Prisma.NestedBoolNullableWithAggregatesFilter<$PrismaModel> | boolean | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedBoolNullableFilter<$PrismaModel> + _max?: Prisma.NestedBoolNullableFilter<$PrismaModel> +} + +export type NestedStringNullableFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null + in?: string[] | null + notIn?: string[] | null + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + search?: string + not?: Prisma.NestedStringNullableFilter<$PrismaModel> | string | null +} + +export type NestedStringNullableWithAggregatesFilter<$PrismaModel = never> = { + equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | null + in?: string[] | null + notIn?: string[] | null + lt?: string | Prisma.StringFieldRefInput<$PrismaModel> + lte?: string | Prisma.StringFieldRefInput<$PrismaModel> + gt?: string | Prisma.StringFieldRefInput<$PrismaModel> + gte?: string | Prisma.StringFieldRefInput<$PrismaModel> + contains?: string | Prisma.StringFieldRefInput<$PrismaModel> + startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> + search?: string + not?: Prisma.NestedStringNullableWithAggregatesFilter<$PrismaModel> | string | null + _count?: Prisma.NestedIntNullableFilter<$PrismaModel> + _min?: Prisma.NestedStringNullableFilter<$PrismaModel> + _max?: Prisma.NestedStringNullableFilter<$PrismaModel> +} + export type NestedDecimalFilter<$PrismaModel = never> = { equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] @@ -492,23 +543,6 @@ export type NestedFloatFilter<$PrismaModel = never> = { not?: Prisma.NestedFloatFilter<$PrismaModel> | number } -export type NestedEnumUnitTypeFilter<$PrismaModel = never> = { - equals?: $Enums.UnitType | Prisma.EnumUnitTypeFieldRefInput<$PrismaModel> - in?: $Enums.UnitType[] - notIn?: $Enums.UnitType[] - not?: Prisma.NestedEnumUnitTypeFilter<$PrismaModel> | $Enums.UnitType -} - -export type NestedEnumUnitTypeWithAggregatesFilter<$PrismaModel = never> = { - equals?: $Enums.UnitType | Prisma.EnumUnitTypeFieldRefInput<$PrismaModel> - in?: $Enums.UnitType[] - notIn?: $Enums.UnitType[] - not?: Prisma.NestedEnumUnitTypeWithAggregatesFilter<$PrismaModel> | $Enums.UnitType - _count?: Prisma.NestedIntFilter<$PrismaModel> - _min?: Prisma.NestedEnumUnitTypeFilter<$PrismaModel> - _max?: Prisma.NestedEnumUnitTypeFilter<$PrismaModel> -} - export type NestedJsonNullableFilter<$PrismaModel = never> = | Prisma.PatchUndefined< Prisma.Either>, Exclude>, 'path'>>, @@ -533,6 +567,40 @@ export type NestedJsonNullableFilterBase<$PrismaModel = never> = { not?: runtime.InputJsonValue | Prisma.JsonFieldRefInput<$PrismaModel> | Prisma.JsonNullValueFilter } +export type NestedEnumUnitTypeFilter<$PrismaModel = never> = { + equals?: $Enums.UnitType | Prisma.EnumUnitTypeFieldRefInput<$PrismaModel> + in?: $Enums.UnitType[] + notIn?: $Enums.UnitType[] + not?: Prisma.NestedEnumUnitTypeFilter<$PrismaModel> | $Enums.UnitType +} + +export type NestedEnumSalesInvoiceItemPricingModelFilter<$PrismaModel = never> = { + equals?: $Enums.SalesInvoiceItemPricingModel | Prisma.EnumSalesInvoiceItemPricingModelFieldRefInput<$PrismaModel> + in?: $Enums.SalesInvoiceItemPricingModel[] + notIn?: $Enums.SalesInvoiceItemPricingModel[] + not?: Prisma.NestedEnumSalesInvoiceItemPricingModelFilter<$PrismaModel> | $Enums.SalesInvoiceItemPricingModel +} + +export type NestedEnumUnitTypeWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.UnitType | Prisma.EnumUnitTypeFieldRefInput<$PrismaModel> + in?: $Enums.UnitType[] + notIn?: $Enums.UnitType[] + not?: Prisma.NestedEnumUnitTypeWithAggregatesFilter<$PrismaModel> | $Enums.UnitType + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumUnitTypeFilter<$PrismaModel> + _max?: Prisma.NestedEnumUnitTypeFilter<$PrismaModel> +} + +export type NestedEnumSalesInvoiceItemPricingModelWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.SalesInvoiceItemPricingModel | Prisma.EnumSalesInvoiceItemPricingModelFieldRefInput<$PrismaModel> + in?: $Enums.SalesInvoiceItemPricingModel[] + notIn?: $Enums.SalesInvoiceItemPricingModel[] + not?: Prisma.NestedEnumSalesInvoiceItemPricingModelWithAggregatesFilter<$PrismaModel> | $Enums.SalesInvoiceItemPricingModel + _count?: Prisma.NestedIntFilter<$PrismaModel> + _min?: Prisma.NestedEnumSalesInvoiceItemPricingModelFilter<$PrismaModel> + _max?: Prisma.NestedEnumSalesInvoiceItemPricingModelFilter<$PrismaModel> +} + export type NestedEnumPaymentMethodTypeFilter<$PrismaModel = never> = { equals?: $Enums.PaymentMethodType | Prisma.EnumPaymentMethodTypeFieldRefInput<$PrismaModel> in?: $Enums.PaymentMethodType[] diff --git a/src/generated/prisma/enums.ts b/src/generated/prisma/enums.ts index 2678b73..7dc317f 100644 --- a/src/generated/prisma/enums.ts +++ b/src/generated/prisma/enums.ts @@ -10,7 +10,9 @@ */ export const PaymentMethodType = { + TERMINAL: 'TERMINAL', CASH: 'CASH', + SET_OFF: 'SET_OFF', CARD: 'CARD', BANK: 'BANK', CHECK: 'CHECK', @@ -47,3 +49,20 @@ export const UnitType = { } as const export type UnitType = (typeof UnitType)[keyof typeof UnitType] + + +export const CustomerType = { + INDIVIDUAL: 'INDIVIDUAL', + LEGAL: 'LEGAL', + UNKNOWN: 'UNKNOWN' +} as const + +export type CustomerType = (typeof CustomerType)[keyof typeof CustomerType] + + +export const SalesInvoiceItemPricingModel = { + STANDARD: 'STANDARD', + GOLD: 'GOLD' +} as const + +export type SalesInvoiceItemPricingModel = (typeof SalesInvoiceItemPricingModel)[keyof typeof SalesInvoiceItemPricingModel] diff --git a/src/generated/prisma/internal/class.ts b/src/generated/prisma/internal/class.ts index f211dd4..b48c3b8 100644 --- a/src/generated/prisma/internal/class.ts +++ b/src/generated/prisma/internal/class.ts @@ -22,7 +22,7 @@ const config: runtime.GetPrismaClientConfig = { "clientVersion": "7.2.0", "engineVersion": "0c8ef2ce45c83248ab3df073180d5eda9e8be7a3", "activeProvider": "mysql", - "inlineSchema": "model Customer {\n id String @id @default(uuid())\n first_name String @db.VarChar(255)\n last_name String @db.VarChar(255)\n email String? @db.VarChar(255)\n mobile_number String @unique @db.Char(11)\n address String? @db.Text\n is_active Boolean @default(true)\n account_id String\n complex_id String\n\n created_at DateTime @default(now()) @db.Timestamp(0)\n updated_at DateTime @updatedAt @db.Timestamp(0)\n deleted_at DateTime? @db.Timestamp(0)\n\n sales_invoices SalesInvoice[]\n\n @@map(\"customers\")\n}\n\nmodel Device {\n account_id String? @db.VarChar(255)\n app_version String @db.VarChar(20)\n build_number String @db.VarChar(20)\n\n uuid String @id @unique() @db.VarChar(255)\n platform String @db.VarChar(100)\n brand String @db.VarChar(100)\n model String @db.VarChar(100)\n device String @db.VarChar(100)\n os_version String @db.VarChar(20)\n sdk_version String @db.VarChar(20)\n release_number String @db.VarChar(20)\n browser_name String? @db.VarChar(100)\n fcm_token String? @db.VarChar(100)\n\n @@map(\"devices\")\n}\n\nenum PaymentMethodType {\n CASH\n CARD\n BANK\n CHECK\n OTHER\n}\n\nenum PurchaseReceiptStatus {\n UNPAID\n PARTIALLY_PAID\n PAID\n}\n\nenum SalesInvoiceType {\n GOOD\n SERVICE\n}\n\nenum UnitType {\n COUNT\n GRAM\n KILOGRAM\n LITER\n METER\n HOUR\n}\n\nmodel Good {\n id String @id @default(uuid())\n name String @db.VarChar(255)\n description String? @db.Text\n sku String @db.VarChar(100)\n local_sku String? @unique() @db.VarChar(100)\n barcode String? @unique() @db.VarChar(100)\n created_at DateTime @default(now()) @db.Timestamp(0)\n updated_at DateTime @updatedAt @db.Timestamp(0)\n deleted_at DateTime? @db.Timestamp(0)\n category_id String?\n base_sale_price Decimal @default(0.00) @db.Decimal(15, 0)\n account_id String\n complex_id String\n\n category GoodCategory? @relation(fields: [category_id], references: [id])\n sales_invoice_items SalesInvoiceItem[]\n\n @@index([category_id])\n @@map(\"goods\")\n}\n\nmodel GoodCategory {\n id String @id @default(uuid())\n name String @db.VarChar(100)\n description String? @db.Text\n image_url String? @db.VarChar(255)\n account_id String\n complex_id String\n created_at DateTime @default(now()) @db.Timestamp(0)\n updated_at DateTime @updatedAt @db.Timestamp(0)\n deleted_at DateTime? @db.Timestamp(0)\n\n goods Good[]\n\n @@map(\"good_categories\")\n}\n\nmodel TriggerLog {\n id Int @id @default(autoincrement())\n message String @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n name String @db.Text\n\n @@map(\"trigger_logs\")\n}\n\nmodel SalesInvoice {\n id String @id @default(uuid())\n code String @unique @db.VarChar(100)\n total_amount Decimal @db.Decimal(15, 2)\n description String? @db.Text\n created_at DateTime @default(now()) @db.Timestamp(0)\n updated_at DateTime @updatedAt @db.Timestamp(0)\n customer_id String?\n account_id String\n complex_id String\n\n customer Customer? @relation(fields: [customer_id], references: [id])\n items SalesInvoiceItem[]\n sales_invoice_payments SalesInvoicePayment[]\n\n @@index([customer_id])\n @@map(\"sales_invoices\")\n}\n\nmodel SalesInvoiceItem {\n id String @id @default(uuid())\n quantity Decimal @db.Decimal(10, 0)\n unit_type UnitType\n unit_price Decimal @default(0.00) @db.Decimal(15, 2)\n total_amount Decimal @default(0.00) @db.Decimal(15, 2)\n created_at DateTime @default(now()) @db.Timestamp(0)\n invoice_id String\n good_id String?\n service_id String?\n\n payload Json?\n\n invoice SalesInvoice @relation(fields: [invoice_id], references: [id])\n good Good? @relation(fields: [good_id], references: [id])\n service Service? @relation(fields: [service_id], references: [id])\n\n @@index([invoice_id, good_id])\n @@map(\"sales_invoice_items\")\n}\n\nmodel SalesInvoicePayment {\n id String @id @default(uuid())\n invoice_id String\n amount Decimal @db.Decimal(15, 2)\n payment_method PaymentMethodType\n paid_at DateTime\n created_at DateTime @default(now())\n\n invoice SalesInvoice @relation(fields: [invoice_id], references: [id])\n\n @@index([invoice_id])\n @@map(\"sales_invoice_payments\")\n}\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../../src/generated/prisma\"\n moduleFormat = \"cjs\"\n previewFeatures = [\"views\"]\n}\n\ndatasource db {\n provider = \"mysql\"\n}\n\nmodel Service {\n id String @id @default(uuid())\n name String @db.VarChar(255)\n description String? @db.Text\n sku String @unique() @db.VarChar(100)\n local_sku String? @unique() @db.VarChar(100)\n barcode String? @unique() @db.VarChar(100)\n created_at DateTime @default(now()) @db.Timestamp(0)\n updated_at DateTime @updatedAt @db.Timestamp(0)\n deleted_at DateTime? @db.Timestamp(0)\n category_id String?\n base_sale_price Decimal @default(0.00) @db.Decimal(15, 0)\n account_id String\n complex_id String\n\n category ServiceCategory? @relation(fields: [category_id], references: [id])\n sales_invoice_items SalesInvoiceItem[]\n\n @@index([category_id])\n @@map(\"services\")\n}\n\nmodel ServiceCategory {\n id String @id @default(uuid())\n name String @db.VarChar(100)\n description String? @db.Text\n image_url String? @db.VarChar(255)\n account_id String\n complex_id String\n created_at DateTime @default(now()) @db.Timestamp(0)\n updated_at DateTime @updatedAt @db.Timestamp(0)\n deleted_at DateTime? @db.Timestamp(0)\n\n services Service[]\n\n @@map(\"service_categories\")\n}\n", + "inlineSchema": "model Customer {\n id String @id @default(uuid())\n created_at DateTime @default(now()) @db.Timestamp(0)\n updated_at DateTime @updatedAt @db.Timestamp(0)\n deleted_at DateTime? @db.Timestamp(0)\n type CustomerType\n complex_id String\n is_favorite Boolean? @default(false)\n\n sales_invoices SalesInvoice[]\n customerIndividuals CustomerIndividual?\n customerLegals CustomerLegal?\n\n @@map(\"customers\")\n}\n\nmodel CustomerIndividual {\n customer_id String @id\n first_name String @db.VarChar(255)\n last_name String @db.VarChar(255)\n national_id String @db.Char(10)\n postal_code String @db.Char(10)\n economic_code String? @db.Char(10)\n complex_id String\n\n customer Customer @relation(fields: [customer_id], references: [id])\n\n @@unique([complex_id, national_id])\n @@map(\"customer_individuals\")\n}\n\nmodel CustomerLegal {\n customer_id String @id\n company_name String @db.VarChar(255)\n economic_code String @db.Char(10)\n registration_number String @unique() @db.Char(20)\n postal_code String @db.Char(10)\n complex_id String\n\n customer Customer @relation(fields: [customer_id], references: [id])\n\n @@unique([complex_id, registration_number])\n @@map(\"customer_legal\")\n}\n\nmodel Device {\n account_id String? @db.VarChar(255)\n app_version String @db.VarChar(20)\n build_number String @db.VarChar(20)\n\n uuid String @id @unique() @db.VarChar(255)\n platform String @db.VarChar(100)\n brand String @db.VarChar(100)\n model String @db.VarChar(100)\n device String @db.VarChar(100)\n os_version String @db.VarChar(20)\n sdk_version String @db.VarChar(20)\n release_number String @db.VarChar(20)\n browser_name String? @db.VarChar(100)\n fcm_token String? @db.VarChar(100)\n\n @@map(\"devices\")\n}\n\nenum PaymentMethodType {\n TERMINAL\n CASH\n SET_OFF\n CARD\n BANK\n CHECK\n OTHER\n}\n\nenum PurchaseReceiptStatus {\n UNPAID\n PARTIALLY_PAID\n PAID\n}\n\nenum SalesInvoiceType {\n GOOD\n SERVICE\n}\n\nenum UnitType {\n COUNT\n GRAM\n KILOGRAM\n LITER\n METER\n HOUR\n}\n\nenum CustomerType {\n INDIVIDUAL\n LEGAL\n UNKNOWN\n}\n\nenum SalesInvoiceItemPricingModel {\n STANDARD\n GOLD\n}\n\nmodel Good {\n id String @id @default(uuid())\n name String @db.VarChar(255)\n description String? @db.Text\n sku String @db.VarChar(100)\n local_sku String? @unique() @db.VarChar(100)\n barcode String? @unique() @db.VarChar(100)\n created_at DateTime @default(now()) @db.Timestamp(0)\n updated_at DateTime @updatedAt @db.Timestamp(0)\n deleted_at DateTime? @db.Timestamp(0)\n category_id String?\n base_sale_price Decimal @default(0.00) @db.Decimal(15, 0)\n account_id String\n complex_id String\n\n category GoodCategory? @relation(fields: [category_id], references: [id])\n sales_invoice_items SalesInvoiceItem[]\n\n @@index([category_id])\n @@map(\"goods\")\n}\n\nmodel GoodCategory {\n id String @id @default(uuid())\n name String @db.VarChar(100)\n description String? @db.Text\n image_url String? @db.VarChar(255)\n account_id String\n complex_id String\n created_at DateTime @default(now()) @db.Timestamp(0)\n updated_at DateTime @updatedAt @db.Timestamp(0)\n deleted_at DateTime? @db.Timestamp(0)\n\n goods Good[]\n\n @@map(\"good_categories\")\n}\n\nmodel TriggerLog {\n id Int @id @default(autoincrement())\n message String @db.Text\n createdAt DateTime @default(now()) @db.Timestamp(0)\n name String @db.Text\n\n @@map(\"trigger_logs\")\n}\n\nmodel SalesInvoice {\n id String @id @default(uuid())\n code String @unique @db.VarChar(100)\n total_amount Decimal @db.Decimal(15, 2)\n notes String? @db.Text\n unknown_customer Json? @db.Json\n invoice_date DateTime? @default(now()) @db.Timestamp(0)\n created_at DateTime @default(now()) @db.Timestamp(0)\n updated_at DateTime @updatedAt @db.Timestamp(0)\n\n customer_id String?\n account_id String\n complex_id String\n\n customer Customer? @relation(fields: [customer_id], references: [id])\n items SalesInvoiceItem[]\n payments SalesInvoicePayment[]\n\n @@map(\"sales_invoices\")\n}\n\nmodel SalesInvoiceItem {\n id String @id @default(uuid())\n quantity Decimal @db.Decimal(10, 0)\n unit_type UnitType\n unit_price Decimal @default(0.00) @db.Decimal(15, 2)\n total_amount Decimal @default(0.00) @db.Decimal(15, 2)\n created_at DateTime @default(now()) @db.Timestamp(0)\n discount Decimal @default(0.00) @db.Decimal(15, 2)\n notes String? @db.Text\n pricingModel SalesInvoiceItemPricingModel @default(STANDARD)\n\n invoice_id String\n good_id String?\n service_id String?\n\n payload Json?\n\n invoice SalesInvoice @relation(fields: [invoice_id], references: [id])\n good Good? @relation(fields: [good_id], references: [id])\n service Service? @relation(fields: [service_id], references: [id])\n\n @@index([invoice_id, good_id])\n @@map(\"sales_invoice_items\")\n}\n\nmodel SalesInvoicePayment {\n id String @id @default(uuid())\n invoice_id String\n amount Decimal @db.Decimal(15, 2)\n payment_method PaymentMethodType\n paid_at DateTime\n created_at DateTime @default(now())\n\n invoice SalesInvoice @relation(fields: [invoice_id], references: [id])\n\n @@index([invoice_id])\n @@map(\"sales_invoice_payments\")\n}\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"../../src/generated/prisma\"\n moduleFormat = \"cjs\"\n previewFeatures = [\"views\"]\n}\n\ndatasource db {\n provider = \"mysql\"\n}\n\nmodel Service {\n id String @id @default(uuid())\n name String @db.VarChar(255)\n description String? @db.Text\n sku String @unique() @db.VarChar(100)\n local_sku String? @unique() @db.VarChar(100)\n barcode String? @unique() @db.VarChar(100)\n created_at DateTime @default(now()) @db.Timestamp(0)\n updated_at DateTime @updatedAt @db.Timestamp(0)\n deleted_at DateTime? @db.Timestamp(0)\n category_id String?\n base_sale_price Decimal @default(0.00) @db.Decimal(15, 0)\n account_id String\n complex_id String\n\n category ServiceCategory? @relation(fields: [category_id], references: [id])\n sales_invoice_items SalesInvoiceItem[]\n\n @@index([category_id])\n @@map(\"services\")\n}\n\nmodel ServiceCategory {\n id String @id @default(uuid())\n name String @db.VarChar(100)\n description String? @db.Text\n image_url String? @db.VarChar(255)\n account_id String\n complex_id String\n created_at DateTime @default(now()) @db.Timestamp(0)\n updated_at DateTime @updatedAt @db.Timestamp(0)\n deleted_at DateTime? @db.Timestamp(0)\n\n services Service[]\n\n @@map(\"service_categories\")\n}\n", "runtimeDataModel": { "models": {}, "enums": {}, @@ -30,7 +30,7 @@ const config: runtime.GetPrismaClientConfig = { } } -config.runtimeDataModel = JSON.parse("{\"models\":{\"Customer\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"first_name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"last_name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"mobile_number\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"address\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"is_active\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updated_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deleted_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"sales_invoices\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"CustomerToSalesInvoice\"}],\"dbName\":\"customers\"},\"Device\":{\"fields\":[{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"app_version\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"build_number\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"uuid\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"platform\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"brand\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"model\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"device\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"os_version\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sdk_version\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"release_number\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"browser_name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"fcm_token\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":\"devices\"},\"Good\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"local_sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"barcode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updated_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deleted_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"category_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"base_sale_price\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"category\",\"kind\":\"object\",\"type\":\"GoodCategory\",\"relationName\":\"GoodToGoodCategory\"},{\"name\":\"sales_invoice_items\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"GoodToSalesInvoiceItem\"}],\"dbName\":\"goods\"},\"GoodCategory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"image_url\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updated_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deleted_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"goods\",\"kind\":\"object\",\"type\":\"Good\",\"relationName\":\"GoodToGoodCategory\"}],\"dbName\":\"good_categories\"},\"TriggerLog\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"message\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":\"trigger_logs\"},\"SalesInvoice\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"total_amount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updated_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"customer_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"CustomerToSalesInvoice\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"SalesInvoiceToSalesInvoiceItem\"},{\"name\":\"sales_invoice_payments\",\"kind\":\"object\",\"type\":\"SalesInvoicePayment\",\"relationName\":\"SalesInvoiceToSalesInvoicePayment\"}],\"dbName\":\"sales_invoices\"},\"SalesInvoiceItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"unit_type\",\"kind\":\"enum\",\"type\":\"UnitType\"},{\"name\":\"unit_price\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"total_amount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"invoice_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"good_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"service_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"payload\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"invoice\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"SalesInvoiceToSalesInvoiceItem\"},{\"name\":\"good\",\"kind\":\"object\",\"type\":\"Good\",\"relationName\":\"GoodToSalesInvoiceItem\"},{\"name\":\"service\",\"kind\":\"object\",\"type\":\"Service\",\"relationName\":\"SalesInvoiceItemToService\"}],\"dbName\":\"sales_invoice_items\"},\"SalesInvoicePayment\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"invoice_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"amount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"payment_method\",\"kind\":\"enum\",\"type\":\"PaymentMethodType\"},{\"name\":\"paid_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"invoice\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"SalesInvoiceToSalesInvoicePayment\"}],\"dbName\":\"sales_invoice_payments\"},\"Service\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"local_sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"barcode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updated_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deleted_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"category_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"base_sale_price\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"category\",\"kind\":\"object\",\"type\":\"ServiceCategory\",\"relationName\":\"ServiceToServiceCategory\"},{\"name\":\"sales_invoice_items\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"SalesInvoiceItemToService\"}],\"dbName\":\"services\"},\"ServiceCategory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"image_url\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updated_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deleted_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"services\",\"kind\":\"object\",\"type\":\"Service\",\"relationName\":\"ServiceToServiceCategory\"}],\"dbName\":\"service_categories\"}},\"enums\":{},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"Customer\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updated_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deleted_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"CustomerType\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"is_favorite\",\"kind\":\"scalar\",\"type\":\"Boolean\"},{\"name\":\"sales_invoices\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"CustomerToSalesInvoice\"},{\"name\":\"customerIndividuals\",\"kind\":\"object\",\"type\":\"CustomerIndividual\",\"relationName\":\"CustomerToCustomerIndividual\"},{\"name\":\"customerLegals\",\"kind\":\"object\",\"type\":\"CustomerLegal\",\"relationName\":\"CustomerToCustomerLegal\"}],\"dbName\":\"customers\"},\"CustomerIndividual\":{\"fields\":[{\"name\":\"customer_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"first_name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"last_name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"national_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"postal_code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"economic_code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"CustomerToCustomerIndividual\"}],\"dbName\":\"customer_individuals\"},\"CustomerLegal\":{\"fields\":[{\"name\":\"customer_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"company_name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"economic_code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"registration_number\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"postal_code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"CustomerToCustomerLegal\"}],\"dbName\":\"customer_legal\"},\"Device\":{\"fields\":[{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"app_version\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"build_number\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"uuid\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"platform\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"brand\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"model\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"device\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"os_version\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sdk_version\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"release_number\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"browser_name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"fcm_token\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":\"devices\"},\"Good\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"local_sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"barcode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updated_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deleted_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"category_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"base_sale_price\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"category\",\"kind\":\"object\",\"type\":\"GoodCategory\",\"relationName\":\"GoodToGoodCategory\"},{\"name\":\"sales_invoice_items\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"GoodToSalesInvoiceItem\"}],\"dbName\":\"goods\"},\"GoodCategory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"image_url\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updated_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deleted_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"goods\",\"kind\":\"object\",\"type\":\"Good\",\"relationName\":\"GoodToGoodCategory\"}],\"dbName\":\"good_categories\"},\"TriggerLog\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"message\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":\"trigger_logs\"},\"SalesInvoice\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"code\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"total_amount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"notes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"unknown_customer\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"invoice_date\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updated_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"customer_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"customer\",\"kind\":\"object\",\"type\":\"Customer\",\"relationName\":\"CustomerToSalesInvoice\"},{\"name\":\"items\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"SalesInvoiceToSalesInvoiceItem\"},{\"name\":\"payments\",\"kind\":\"object\",\"type\":\"SalesInvoicePayment\",\"relationName\":\"SalesInvoiceToSalesInvoicePayment\"}],\"dbName\":\"sales_invoices\"},\"SalesInvoiceItem\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"quantity\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"unit_type\",\"kind\":\"enum\",\"type\":\"UnitType\"},{\"name\":\"unit_price\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"total_amount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"discount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"notes\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"pricingModel\",\"kind\":\"enum\",\"type\":\"SalesInvoiceItemPricingModel\"},{\"name\":\"invoice_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"good_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"service_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"payload\",\"kind\":\"scalar\",\"type\":\"Json\"},{\"name\":\"invoice\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"SalesInvoiceToSalesInvoiceItem\"},{\"name\":\"good\",\"kind\":\"object\",\"type\":\"Good\",\"relationName\":\"GoodToSalesInvoiceItem\"},{\"name\":\"service\",\"kind\":\"object\",\"type\":\"Service\",\"relationName\":\"SalesInvoiceItemToService\"}],\"dbName\":\"sales_invoice_items\"},\"SalesInvoicePayment\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"invoice_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"amount\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"payment_method\",\"kind\":\"enum\",\"type\":\"PaymentMethodType\"},{\"name\":\"paid_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"invoice\",\"kind\":\"object\",\"type\":\"SalesInvoice\",\"relationName\":\"SalesInvoiceToSalesInvoicePayment\"}],\"dbName\":\"sales_invoice_payments\"},\"Service\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"local_sku\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"barcode\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updated_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deleted_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"category_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"base_sale_price\",\"kind\":\"scalar\",\"type\":\"Decimal\"},{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"category\",\"kind\":\"object\",\"type\":\"ServiceCategory\",\"relationName\":\"ServiceToServiceCategory\"},{\"name\":\"sales_invoice_items\",\"kind\":\"object\",\"type\":\"SalesInvoiceItem\",\"relationName\":\"SalesInvoiceItemToService\"}],\"dbName\":\"services\"},\"ServiceCategory\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"image_url\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"account_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"complex_id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"created_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updated_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"deleted_at\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"services\",\"kind\":\"object\",\"type\":\"Service\",\"relationName\":\"ServiceToServiceCategory\"}],\"dbName\":\"service_categories\"}},\"enums\":{},\"types\":{}}") async function decodeBase64AsWasm(wasmBase64: string): Promise { const { Buffer } = await import('node:buffer') @@ -186,6 +186,26 @@ export interface PrismaClient< */ get customer(): Prisma.CustomerDelegate; + /** + * `prisma.customerIndividual`: Exposes CRUD operations for the **CustomerIndividual** model. + * Example usage: + * ```ts + * // Fetch zero or more CustomerIndividuals + * const customerIndividuals = await prisma.customerIndividual.findMany() + * ``` + */ + get customerIndividual(): Prisma.CustomerIndividualDelegate; + + /** + * `prisma.customerLegal`: Exposes CRUD operations for the **CustomerLegal** model. + * Example usage: + * ```ts + * // Fetch zero or more CustomerLegals + * const customerLegals = await prisma.customerLegal.findMany() + * ``` + */ + get customerLegal(): Prisma.CustomerLegalDelegate; + /** * `prisma.device`: Exposes CRUD operations for the **Device** model. * Example usage: diff --git a/src/generated/prisma/internal/prismaNamespace.ts b/src/generated/prisma/internal/prismaNamespace.ts index 54c9e1b..d59dcba 100644 --- a/src/generated/prisma/internal/prismaNamespace.ts +++ b/src/generated/prisma/internal/prismaNamespace.ts @@ -385,6 +385,8 @@ type FieldRefInputType = Model extends never ? never : FieldRe export const ModelName = { Customer: 'Customer', + CustomerIndividual: 'CustomerIndividual', + CustomerLegal: 'CustomerLegal', Device: 'Device', Good: 'Good', GoodCategory: 'GoodCategory', @@ -409,7 +411,7 @@ export type TypeMap + fields: Prisma.CustomerIndividualFieldRefs + operations: { + findUnique: { + args: Prisma.CustomerIndividualFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.CustomerIndividualFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.CustomerIndividualFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.CustomerIndividualFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.CustomerIndividualFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.CustomerIndividualCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.CustomerIndividualCreateManyArgs + result: BatchPayload + } + delete: { + args: Prisma.CustomerIndividualDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.CustomerIndividualUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.CustomerIndividualDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.CustomerIndividualUpdateManyArgs + result: BatchPayload + } + upsert: { + args: Prisma.CustomerIndividualUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.CustomerIndividualAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.CustomerIndividualGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.CustomerIndividualCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } + CustomerLegal: { + payload: Prisma.$CustomerLegalPayload + fields: Prisma.CustomerLegalFieldRefs + operations: { + findUnique: { + args: Prisma.CustomerLegalFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.CustomerLegalFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.CustomerLegalFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.CustomerLegalFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.CustomerLegalFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.CustomerLegalCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.CustomerLegalCreateManyArgs + result: BatchPayload + } + delete: { + args: Prisma.CustomerLegalDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.CustomerLegalUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.CustomerLegalDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.CustomerLegalUpdateManyArgs + result: BatchPayload + } + upsert: { + args: Prisma.CustomerLegalUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.CustomerLegalAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.CustomerLegalGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.CustomerLegalCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } Device: { payload: Prisma.$DevicePayload fields: Prisma.DeviceFieldRefs @@ -1114,22 +1248,42 @@ export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof export const CustomerScalarFieldEnum = { id: 'id', - first_name: 'first_name', - last_name: 'last_name', - email: 'email', - mobile_number: 'mobile_number', - address: 'address', - is_active: 'is_active', - account_id: 'account_id', - complex_id: 'complex_id', created_at: 'created_at', updated_at: 'updated_at', - deleted_at: 'deleted_at' + deleted_at: 'deleted_at', + type: 'type', + complex_id: 'complex_id', + is_favorite: 'is_favorite' } as const export type CustomerScalarFieldEnum = (typeof CustomerScalarFieldEnum)[keyof typeof CustomerScalarFieldEnum] +export const CustomerIndividualScalarFieldEnum = { + customer_id: 'customer_id', + first_name: 'first_name', + last_name: 'last_name', + national_id: 'national_id', + postal_code: 'postal_code', + economic_code: 'economic_code', + complex_id: 'complex_id' +} as const + +export type CustomerIndividualScalarFieldEnum = (typeof CustomerIndividualScalarFieldEnum)[keyof typeof CustomerIndividualScalarFieldEnum] + + +export const CustomerLegalScalarFieldEnum = { + customer_id: 'customer_id', + company_name: 'company_name', + economic_code: 'economic_code', + registration_number: 'registration_number', + postal_code: 'postal_code', + complex_id: 'complex_id' +} as const + +export type CustomerLegalScalarFieldEnum = (typeof CustomerLegalScalarFieldEnum)[keyof typeof CustomerLegalScalarFieldEnum] + + export const DeviceScalarFieldEnum = { account_id: 'account_id', app_version: 'app_version', @@ -1197,7 +1351,9 @@ export const SalesInvoiceScalarFieldEnum = { id: 'id', code: 'code', total_amount: 'total_amount', - description: 'description', + notes: 'notes', + unknown_customer: 'unknown_customer', + invoice_date: 'invoice_date', created_at: 'created_at', updated_at: 'updated_at', customer_id: 'customer_id', @@ -1215,6 +1371,9 @@ export const SalesInvoiceItemScalarFieldEnum = { unit_price: 'unit_price', total_amount: 'total_amount', created_at: 'created_at', + discount: 'discount', + notes: 'notes', + pricingModel: 'pricingModel', invoice_id: 'invoice_id', good_id: 'good_id', service_id: 'service_id', @@ -1296,18 +1455,37 @@ export type NullsOrder = (typeof NullsOrder)[keyof typeof NullsOrder] export const CustomerOrderByRelevanceFieldEnum = { id: 'id', - first_name: 'first_name', - last_name: 'last_name', - email: 'email', - mobile_number: 'mobile_number', - address: 'address', - account_id: 'account_id', complex_id: 'complex_id' } as const export type CustomerOrderByRelevanceFieldEnum = (typeof CustomerOrderByRelevanceFieldEnum)[keyof typeof CustomerOrderByRelevanceFieldEnum] +export const CustomerIndividualOrderByRelevanceFieldEnum = { + customer_id: 'customer_id', + first_name: 'first_name', + last_name: 'last_name', + national_id: 'national_id', + postal_code: 'postal_code', + economic_code: 'economic_code', + complex_id: 'complex_id' +} as const + +export type CustomerIndividualOrderByRelevanceFieldEnum = (typeof CustomerIndividualOrderByRelevanceFieldEnum)[keyof typeof CustomerIndividualOrderByRelevanceFieldEnum] + + +export const CustomerLegalOrderByRelevanceFieldEnum = { + customer_id: 'customer_id', + company_name: 'company_name', + economic_code: 'economic_code', + registration_number: 'registration_number', + postal_code: 'postal_code', + complex_id: 'complex_id' +} as const + +export type CustomerLegalOrderByRelevanceFieldEnum = (typeof CustomerLegalOrderByRelevanceFieldEnum)[keyof typeof CustomerLegalOrderByRelevanceFieldEnum] + + export const DeviceOrderByRelevanceFieldEnum = { account_id: 'account_id', app_version: 'app_version', @@ -1362,18 +1540,6 @@ export const TriggerLogOrderByRelevanceFieldEnum = { export type TriggerLogOrderByRelevanceFieldEnum = (typeof TriggerLogOrderByRelevanceFieldEnum)[keyof typeof TriggerLogOrderByRelevanceFieldEnum] -export const SalesInvoiceOrderByRelevanceFieldEnum = { - id: 'id', - code: 'code', - description: 'description', - customer_id: 'customer_id', - account_id: 'account_id', - complex_id: 'complex_id' -} as const - -export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByRelevanceFieldEnum)[keyof typeof SalesInvoiceOrderByRelevanceFieldEnum] - - export const JsonNullValueFilter = { DbNull: DbNull, JsonNull: JsonNull, @@ -1391,8 +1557,21 @@ export const QueryMode = { export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode] +export const SalesInvoiceOrderByRelevanceFieldEnum = { + id: 'id', + code: 'code', + notes: 'notes', + customer_id: 'customer_id', + account_id: 'account_id', + complex_id: 'complex_id' +} as const + +export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByRelevanceFieldEnum)[keyof typeof SalesInvoiceOrderByRelevanceFieldEnum] + + export const SalesInvoiceItemOrderByRelevanceFieldEnum = { id: 'id', + notes: 'notes', invoice_id: 'invoice_id', good_id: 'good_id', service_id: 'service_id' @@ -1450,16 +1629,23 @@ export type StringFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, /** - * Reference to a field of type 'Boolean' + * Reference to a field of type 'DateTime' */ -export type BooleanFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Boolean'> +export type DateTimeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'DateTime'> /** - * Reference to a field of type 'DateTime' + * Reference to a field of type 'CustomerType' */ -export type DateTimeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'DateTime'> +export type EnumCustomerTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'CustomerType'> + + + +/** + * Reference to a field of type 'Boolean' + */ +export type BooleanFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Boolean'> @@ -1477,13 +1663,6 @@ export type IntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'In -/** - * Reference to a field of type 'UnitType' - */ -export type EnumUnitTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'UnitType'> - - - /** * Reference to a field of type 'Json' */ @@ -1498,6 +1677,20 @@ export type EnumQueryModeFieldRefInput<$PrismaModel> = FieldRefInputType<$Prisma +/** + * Reference to a field of type 'UnitType' + */ +export type EnumUnitTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'UnitType'> + + + +/** + * Reference to a field of type 'SalesInvoiceItemPricingModel' + */ +export type EnumSalesInvoiceItemPricingModelFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'SalesInvoiceItemPricingModel'> + + + /** * Reference to a field of type 'PaymentMethodType' */ @@ -1607,6 +1800,8 @@ export type PrismaClientOptions = ({ } export type GlobalOmitConfig = { customer?: Prisma.CustomerOmit + customerIndividual?: Prisma.CustomerIndividualOmit + customerLegal?: Prisma.CustomerLegalOmit device?: Prisma.DeviceOmit good?: Prisma.GoodOmit goodCategory?: Prisma.GoodCategoryOmit diff --git a/src/generated/prisma/internal/prismaNamespaceBrowser.ts b/src/generated/prisma/internal/prismaNamespaceBrowser.ts index 163ac65..14ebf7e 100644 --- a/src/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/src/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -52,6 +52,8 @@ export const AnyNull = runtime.AnyNull export const ModelName = { Customer: 'Customer', + CustomerIndividual: 'CustomerIndividual', + CustomerLegal: 'CustomerLegal', Device: 'Device', Good: 'Good', GoodCategory: 'GoodCategory', @@ -81,22 +83,42 @@ export type TransactionIsolationLevel = (typeof TransactionIsolationLevel)[keyof export const CustomerScalarFieldEnum = { id: 'id', - first_name: 'first_name', - last_name: 'last_name', - email: 'email', - mobile_number: 'mobile_number', - address: 'address', - is_active: 'is_active', - account_id: 'account_id', - complex_id: 'complex_id', created_at: 'created_at', updated_at: 'updated_at', - deleted_at: 'deleted_at' + deleted_at: 'deleted_at', + type: 'type', + complex_id: 'complex_id', + is_favorite: 'is_favorite' } as const export type CustomerScalarFieldEnum = (typeof CustomerScalarFieldEnum)[keyof typeof CustomerScalarFieldEnum] +export const CustomerIndividualScalarFieldEnum = { + customer_id: 'customer_id', + first_name: 'first_name', + last_name: 'last_name', + national_id: 'national_id', + postal_code: 'postal_code', + economic_code: 'economic_code', + complex_id: 'complex_id' +} as const + +export type CustomerIndividualScalarFieldEnum = (typeof CustomerIndividualScalarFieldEnum)[keyof typeof CustomerIndividualScalarFieldEnum] + + +export const CustomerLegalScalarFieldEnum = { + customer_id: 'customer_id', + company_name: 'company_name', + economic_code: 'economic_code', + registration_number: 'registration_number', + postal_code: 'postal_code', + complex_id: 'complex_id' +} as const + +export type CustomerLegalScalarFieldEnum = (typeof CustomerLegalScalarFieldEnum)[keyof typeof CustomerLegalScalarFieldEnum] + + export const DeviceScalarFieldEnum = { account_id: 'account_id', app_version: 'app_version', @@ -164,7 +186,9 @@ export const SalesInvoiceScalarFieldEnum = { id: 'id', code: 'code', total_amount: 'total_amount', - description: 'description', + notes: 'notes', + unknown_customer: 'unknown_customer', + invoice_date: 'invoice_date', created_at: 'created_at', updated_at: 'updated_at', customer_id: 'customer_id', @@ -182,6 +206,9 @@ export const SalesInvoiceItemScalarFieldEnum = { unit_price: 'unit_price', total_amount: 'total_amount', created_at: 'created_at', + discount: 'discount', + notes: 'notes', + pricingModel: 'pricingModel', invoice_id: 'invoice_id', good_id: 'good_id', service_id: 'service_id', @@ -263,18 +290,37 @@ export type NullsOrder = (typeof NullsOrder)[keyof typeof NullsOrder] export const CustomerOrderByRelevanceFieldEnum = { id: 'id', - first_name: 'first_name', - last_name: 'last_name', - email: 'email', - mobile_number: 'mobile_number', - address: 'address', - account_id: 'account_id', complex_id: 'complex_id' } as const export type CustomerOrderByRelevanceFieldEnum = (typeof CustomerOrderByRelevanceFieldEnum)[keyof typeof CustomerOrderByRelevanceFieldEnum] +export const CustomerIndividualOrderByRelevanceFieldEnum = { + customer_id: 'customer_id', + first_name: 'first_name', + last_name: 'last_name', + national_id: 'national_id', + postal_code: 'postal_code', + economic_code: 'economic_code', + complex_id: 'complex_id' +} as const + +export type CustomerIndividualOrderByRelevanceFieldEnum = (typeof CustomerIndividualOrderByRelevanceFieldEnum)[keyof typeof CustomerIndividualOrderByRelevanceFieldEnum] + + +export const CustomerLegalOrderByRelevanceFieldEnum = { + customer_id: 'customer_id', + company_name: 'company_name', + economic_code: 'economic_code', + registration_number: 'registration_number', + postal_code: 'postal_code', + complex_id: 'complex_id' +} as const + +export type CustomerLegalOrderByRelevanceFieldEnum = (typeof CustomerLegalOrderByRelevanceFieldEnum)[keyof typeof CustomerLegalOrderByRelevanceFieldEnum] + + export const DeviceOrderByRelevanceFieldEnum = { account_id: 'account_id', app_version: 'app_version', @@ -329,18 +375,6 @@ export const TriggerLogOrderByRelevanceFieldEnum = { export type TriggerLogOrderByRelevanceFieldEnum = (typeof TriggerLogOrderByRelevanceFieldEnum)[keyof typeof TriggerLogOrderByRelevanceFieldEnum] -export const SalesInvoiceOrderByRelevanceFieldEnum = { - id: 'id', - code: 'code', - description: 'description', - customer_id: 'customer_id', - account_id: 'account_id', - complex_id: 'complex_id' -} as const - -export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByRelevanceFieldEnum)[keyof typeof SalesInvoiceOrderByRelevanceFieldEnum] - - export const JsonNullValueFilter = { DbNull: 'DbNull', JsonNull: 'JsonNull', @@ -358,8 +392,21 @@ export const QueryMode = { export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode] +export const SalesInvoiceOrderByRelevanceFieldEnum = { + id: 'id', + code: 'code', + notes: 'notes', + customer_id: 'customer_id', + account_id: 'account_id', + complex_id: 'complex_id' +} as const + +export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByRelevanceFieldEnum)[keyof typeof SalesInvoiceOrderByRelevanceFieldEnum] + + export const SalesInvoiceItemOrderByRelevanceFieldEnum = { id: 'id', + notes: 'notes', invoice_id: 'invoice_id', good_id: 'good_id', service_id: 'service_id' diff --git a/src/generated/prisma/models.ts b/src/generated/prisma/models.ts index 43db37b..8f5950b 100644 --- a/src/generated/prisma/models.ts +++ b/src/generated/prisma/models.ts @@ -9,6 +9,8 @@ * 🟢 You can import this file directly. */ export type * from './models/Customer.js' +export type * from './models/CustomerIndividual.js' +export type * from './models/CustomerLegal.js' export type * from './models/Device.js' export type * from './models/Good.js' export type * from './models/GoodCategory.js' diff --git a/src/generated/prisma/models/Customer.ts b/src/generated/prisma/models/Customer.ts index 26ee875..aeb46fc 100644 --- a/src/generated/prisma/models/Customer.ts +++ b/src/generated/prisma/models/Customer.ts @@ -26,94 +26,64 @@ export type AggregateCustomer = { export type CustomerMinAggregateOutputType = { id: string | null - first_name: string | null - last_name: string | null - email: string | null - mobile_number: string | null - address: string | null - is_active: boolean | null - account_id: string | null - complex_id: string | null created_at: Date | null updated_at: Date | null deleted_at: Date | null + type: $Enums.CustomerType | null + complex_id: string | null + is_favorite: boolean | null } export type CustomerMaxAggregateOutputType = { id: string | null - first_name: string | null - last_name: string | null - email: string | null - mobile_number: string | null - address: string | null - is_active: boolean | null - account_id: string | null - complex_id: string | null created_at: Date | null updated_at: Date | null deleted_at: Date | null + type: $Enums.CustomerType | null + complex_id: string | null + is_favorite: boolean | null } export type CustomerCountAggregateOutputType = { id: number - first_name: number - last_name: number - email: number - mobile_number: number - address: number - is_active: number - account_id: number - complex_id: number created_at: number updated_at: number deleted_at: number + type: number + complex_id: number + is_favorite: number _all: number } export type CustomerMinAggregateInputType = { id?: true - first_name?: true - last_name?: true - email?: true - mobile_number?: true - address?: true - is_active?: true - account_id?: true - complex_id?: true created_at?: true updated_at?: true deleted_at?: true + type?: true + complex_id?: true + is_favorite?: true } export type CustomerMaxAggregateInputType = { id?: true - first_name?: true - last_name?: true - email?: true - mobile_number?: true - address?: true - is_active?: true - account_id?: true - complex_id?: true created_at?: true updated_at?: true deleted_at?: true + type?: true + complex_id?: true + is_favorite?: true } export type CustomerCountAggregateInputType = { id?: true - first_name?: true - last_name?: true - email?: true - mobile_number?: true - address?: true - is_active?: true - account_id?: true - complex_id?: true created_at?: true updated_at?: true deleted_at?: true + type?: true + complex_id?: true + is_favorite?: true _all?: true } @@ -191,17 +161,12 @@ export type CustomerGroupByArgs | string - first_name?: Prisma.StringFilter<"Customer"> | string - last_name?: Prisma.StringFilter<"Customer"> | string - email?: Prisma.StringNullableFilter<"Customer"> | string | null - mobile_number?: Prisma.StringFilter<"Customer"> | string - address?: Prisma.StringNullableFilter<"Customer"> | string | null - is_active?: Prisma.BoolFilter<"Customer"> | boolean - account_id?: Prisma.StringFilter<"Customer"> | string - complex_id?: Prisma.StringFilter<"Customer"> | string created_at?: Prisma.DateTimeFilter<"Customer"> | Date | string updated_at?: Prisma.DateTimeFilter<"Customer"> | Date | string deleted_at?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null + type?: Prisma.EnumCustomerTypeFilter<"Customer"> | $Enums.CustomerType + complex_id?: Prisma.StringFilter<"Customer"> | string + is_favorite?: Prisma.BoolNullableFilter<"Customer"> | boolean | null sales_invoices?: Prisma.SalesInvoiceListRelationFilter + customerIndividuals?: Prisma.XOR | null + customerLegals?: Prisma.XOR | null } export type CustomerOrderByWithRelationInput = { id?: Prisma.SortOrder - first_name?: Prisma.SortOrder - last_name?: Prisma.SortOrder - email?: Prisma.SortOrderInput | Prisma.SortOrder - mobile_number?: Prisma.SortOrder - address?: Prisma.SortOrderInput | Prisma.SortOrder - is_active?: Prisma.SortOrder - account_id?: Prisma.SortOrder - complex_id?: Prisma.SortOrder created_at?: Prisma.SortOrder updated_at?: Prisma.SortOrder deleted_at?: Prisma.SortOrderInput | Prisma.SortOrder + type?: Prisma.SortOrder + complex_id?: Prisma.SortOrder + is_favorite?: Prisma.SortOrderInput | Prisma.SortOrder sales_invoices?: Prisma.SalesInvoiceOrderByRelationAggregateInput + customerIndividuals?: Prisma.CustomerIndividualOrderByWithRelationInput + customerLegals?: Prisma.CustomerLegalOrderByWithRelationInput _relevance?: Prisma.CustomerOrderByRelevanceInput } export type CustomerWhereUniqueInput = Prisma.AtLeast<{ id?: string - mobile_number?: string AND?: Prisma.CustomerWhereInput | Prisma.CustomerWhereInput[] OR?: Prisma.CustomerWhereInput[] NOT?: Prisma.CustomerWhereInput | Prisma.CustomerWhereInput[] - first_name?: Prisma.StringFilter<"Customer"> | string - last_name?: Prisma.StringFilter<"Customer"> | string - email?: Prisma.StringNullableFilter<"Customer"> | string | null - address?: Prisma.StringNullableFilter<"Customer"> | string | null - is_active?: Prisma.BoolFilter<"Customer"> | boolean - account_id?: Prisma.StringFilter<"Customer"> | string - complex_id?: Prisma.StringFilter<"Customer"> | string created_at?: Prisma.DateTimeFilter<"Customer"> | Date | string updated_at?: Prisma.DateTimeFilter<"Customer"> | Date | string deleted_at?: Prisma.DateTimeNullableFilter<"Customer"> | Date | string | null + type?: Prisma.EnumCustomerTypeFilter<"Customer"> | $Enums.CustomerType + complex_id?: Prisma.StringFilter<"Customer"> | string + is_favorite?: Prisma.BoolNullableFilter<"Customer"> | boolean | null sales_invoices?: Prisma.SalesInvoiceListRelationFilter -}, "id" | "mobile_number"> + customerIndividuals?: Prisma.XOR | null + customerLegals?: Prisma.XOR | null +}, "id"> export type CustomerOrderByWithAggregationInput = { id?: Prisma.SortOrder - first_name?: Prisma.SortOrder - last_name?: Prisma.SortOrder - email?: Prisma.SortOrderInput | Prisma.SortOrder - mobile_number?: Prisma.SortOrder - address?: Prisma.SortOrderInput | Prisma.SortOrder - is_active?: Prisma.SortOrder - account_id?: Prisma.SortOrder - complex_id?: Prisma.SortOrder created_at?: Prisma.SortOrder updated_at?: Prisma.SortOrder deleted_at?: Prisma.SortOrderInput | Prisma.SortOrder + type?: Prisma.SortOrder + complex_id?: Prisma.SortOrder + is_favorite?: Prisma.SortOrderInput | Prisma.SortOrder _count?: Prisma.CustomerCountOrderByAggregateInput _max?: Prisma.CustomerMaxOrderByAggregateInput _min?: Prisma.CustomerMinOrderByAggregateInput @@ -300,126 +251,94 @@ export type CustomerScalarWhereWithAggregatesInput = { OR?: Prisma.CustomerScalarWhereWithAggregatesInput[] NOT?: Prisma.CustomerScalarWhereWithAggregatesInput | Prisma.CustomerScalarWhereWithAggregatesInput[] id?: Prisma.StringWithAggregatesFilter<"Customer"> | string - first_name?: Prisma.StringWithAggregatesFilter<"Customer"> | string - last_name?: Prisma.StringWithAggregatesFilter<"Customer"> | string - email?: Prisma.StringNullableWithAggregatesFilter<"Customer"> | string | null - mobile_number?: Prisma.StringWithAggregatesFilter<"Customer"> | string - address?: Prisma.StringNullableWithAggregatesFilter<"Customer"> | string | null - is_active?: Prisma.BoolWithAggregatesFilter<"Customer"> | boolean - account_id?: Prisma.StringWithAggregatesFilter<"Customer"> | string - complex_id?: Prisma.StringWithAggregatesFilter<"Customer"> | string created_at?: Prisma.DateTimeWithAggregatesFilter<"Customer"> | Date | string updated_at?: Prisma.DateTimeWithAggregatesFilter<"Customer"> | Date | string deleted_at?: Prisma.DateTimeNullableWithAggregatesFilter<"Customer"> | Date | string | null + type?: Prisma.EnumCustomerTypeWithAggregatesFilter<"Customer"> | $Enums.CustomerType + complex_id?: Prisma.StringWithAggregatesFilter<"Customer"> | string + is_favorite?: Prisma.BoolNullableWithAggregatesFilter<"Customer"> | boolean | null } export type CustomerCreateInput = { id?: string - first_name: string - last_name: string - email?: string | null - mobile_number: string - address?: string | null - is_active?: boolean - account_id: string - complex_id: string created_at?: Date | string updated_at?: Date | string deleted_at?: Date | string | null + type: $Enums.CustomerType + complex_id: string + is_favorite?: boolean | null sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutCustomerInput + customerIndividuals?: Prisma.CustomerIndividualCreateNestedOneWithoutCustomerInput + customerLegals?: Prisma.CustomerLegalCreateNestedOneWithoutCustomerInput } export type CustomerUncheckedCreateInput = { id?: string - first_name: string - last_name: string - email?: string | null - mobile_number: string - address?: string | null - is_active?: boolean - account_id: string - complex_id: string created_at?: Date | string updated_at?: Date | string deleted_at?: Date | string | null + type: $Enums.CustomerType + complex_id: string + is_favorite?: boolean | null sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutCustomerInput + customerIndividuals?: Prisma.CustomerIndividualUncheckedCreateNestedOneWithoutCustomerInput + customerLegals?: Prisma.CustomerLegalUncheckedCreateNestedOneWithoutCustomerInput } export type CustomerUpdateInput = { id?: Prisma.StringFieldUpdateOperationsInput | string - first_name?: Prisma.StringFieldUpdateOperationsInput | string - last_name?: Prisma.StringFieldUpdateOperationsInput | string - email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - mobile_number?: Prisma.StringFieldUpdateOperationsInput | string - address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - is_active?: Prisma.BoolFieldUpdateOperationsInput | boolean - account_id?: Prisma.StringFieldUpdateOperationsInput | string - complex_id?: Prisma.StringFieldUpdateOperationsInput | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + type?: Prisma.EnumCustomerTypeFieldUpdateOperationsInput | $Enums.CustomerType + complex_id?: Prisma.StringFieldUpdateOperationsInput | string + is_favorite?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutCustomerNestedInput + customerIndividuals?: Prisma.CustomerIndividualUpdateOneWithoutCustomerNestedInput + customerLegals?: Prisma.CustomerLegalUpdateOneWithoutCustomerNestedInput } export type CustomerUncheckedUpdateInput = { id?: Prisma.StringFieldUpdateOperationsInput | string - first_name?: Prisma.StringFieldUpdateOperationsInput | string - last_name?: Prisma.StringFieldUpdateOperationsInput | string - email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - mobile_number?: Prisma.StringFieldUpdateOperationsInput | string - address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - is_active?: Prisma.BoolFieldUpdateOperationsInput | boolean - account_id?: Prisma.StringFieldUpdateOperationsInput | string - complex_id?: Prisma.StringFieldUpdateOperationsInput | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + type?: Prisma.EnumCustomerTypeFieldUpdateOperationsInput | $Enums.CustomerType + complex_id?: Prisma.StringFieldUpdateOperationsInput | string + is_favorite?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput + customerIndividuals?: Prisma.CustomerIndividualUncheckedUpdateOneWithoutCustomerNestedInput + customerLegals?: Prisma.CustomerLegalUncheckedUpdateOneWithoutCustomerNestedInput } export type CustomerCreateManyInput = { id?: string - first_name: string - last_name: string - email?: string | null - mobile_number: string - address?: string | null - is_active?: boolean - account_id: string - complex_id: string created_at?: Date | string updated_at?: Date | string deleted_at?: Date | string | null + type: $Enums.CustomerType + complex_id: string + is_favorite?: boolean | null } export type CustomerUpdateManyMutationInput = { id?: Prisma.StringFieldUpdateOperationsInput | string - first_name?: Prisma.StringFieldUpdateOperationsInput | string - last_name?: Prisma.StringFieldUpdateOperationsInput | string - email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - mobile_number?: Prisma.StringFieldUpdateOperationsInput | string - address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - is_active?: Prisma.BoolFieldUpdateOperationsInput | boolean - account_id?: Prisma.StringFieldUpdateOperationsInput | string - complex_id?: Prisma.StringFieldUpdateOperationsInput | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + type?: Prisma.EnumCustomerTypeFieldUpdateOperationsInput | $Enums.CustomerType + complex_id?: Prisma.StringFieldUpdateOperationsInput | string + is_favorite?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null } export type CustomerUncheckedUpdateManyInput = { id?: Prisma.StringFieldUpdateOperationsInput | string - first_name?: Prisma.StringFieldUpdateOperationsInput | string - last_name?: Prisma.StringFieldUpdateOperationsInput | string - email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - mobile_number?: Prisma.StringFieldUpdateOperationsInput | string - address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - is_active?: Prisma.BoolFieldUpdateOperationsInput | boolean - account_id?: Prisma.StringFieldUpdateOperationsInput | string - complex_id?: Prisma.StringFieldUpdateOperationsInput | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + type?: Prisma.EnumCustomerTypeFieldUpdateOperationsInput | $Enums.CustomerType + complex_id?: Prisma.StringFieldUpdateOperationsInput | string + is_favorite?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null } export type CustomerOrderByRelevanceInput = { @@ -430,47 +349,37 @@ export type CustomerOrderByRelevanceInput = { export type CustomerCountOrderByAggregateInput = { id?: Prisma.SortOrder - first_name?: Prisma.SortOrder - last_name?: Prisma.SortOrder - email?: Prisma.SortOrder - mobile_number?: Prisma.SortOrder - address?: Prisma.SortOrder - is_active?: Prisma.SortOrder - account_id?: Prisma.SortOrder - complex_id?: Prisma.SortOrder created_at?: Prisma.SortOrder updated_at?: Prisma.SortOrder deleted_at?: Prisma.SortOrder + type?: Prisma.SortOrder + complex_id?: Prisma.SortOrder + is_favorite?: Prisma.SortOrder } export type CustomerMaxOrderByAggregateInput = { id?: Prisma.SortOrder - first_name?: Prisma.SortOrder - last_name?: Prisma.SortOrder - email?: Prisma.SortOrder - mobile_number?: Prisma.SortOrder - address?: Prisma.SortOrder - is_active?: Prisma.SortOrder - account_id?: Prisma.SortOrder - complex_id?: Prisma.SortOrder created_at?: Prisma.SortOrder updated_at?: Prisma.SortOrder deleted_at?: Prisma.SortOrder + type?: Prisma.SortOrder + complex_id?: Prisma.SortOrder + is_favorite?: Prisma.SortOrder } export type CustomerMinOrderByAggregateInput = { id?: Prisma.SortOrder - first_name?: Prisma.SortOrder - last_name?: Prisma.SortOrder - email?: Prisma.SortOrder - mobile_number?: Prisma.SortOrder - address?: Prisma.SortOrder - is_active?: Prisma.SortOrder - account_id?: Prisma.SortOrder - complex_id?: Prisma.SortOrder created_at?: Prisma.SortOrder updated_at?: Prisma.SortOrder deleted_at?: Prisma.SortOrder + type?: Prisma.SortOrder + complex_id?: Prisma.SortOrder + is_favorite?: Prisma.SortOrder +} + +export type CustomerScalarRelationFilter = { + is?: Prisma.CustomerWhereInput + isNot?: Prisma.CustomerWhereInput } export type CustomerNullableScalarRelationFilter = { @@ -482,14 +391,6 @@ export type StringFieldUpdateOperationsInput = { set?: string } -export type NullableStringFieldUpdateOperationsInput = { - set?: string | null -} - -export type BoolFieldUpdateOperationsInput = { - set?: boolean -} - export type DateTimeFieldUpdateOperationsInput = { set?: Date | string } @@ -498,6 +399,42 @@ export type NullableDateTimeFieldUpdateOperationsInput = { set?: Date | string | null } +export type EnumCustomerTypeFieldUpdateOperationsInput = { + set?: $Enums.CustomerType +} + +export type NullableBoolFieldUpdateOperationsInput = { + set?: boolean | null +} + +export type CustomerCreateNestedOneWithoutCustomerIndividualsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutCustomerIndividualsInput + connect?: Prisma.CustomerWhereUniqueInput +} + +export type CustomerUpdateOneRequiredWithoutCustomerIndividualsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutCustomerIndividualsInput + upsert?: Prisma.CustomerUpsertWithoutCustomerIndividualsInput + connect?: Prisma.CustomerWhereUniqueInput + update?: Prisma.XOR, Prisma.CustomerUncheckedUpdateWithoutCustomerIndividualsInput> +} + +export type CustomerCreateNestedOneWithoutCustomerLegalsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutCustomerLegalsInput + connect?: Prisma.CustomerWhereUniqueInput +} + +export type CustomerUpdateOneRequiredWithoutCustomerLegalsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutCustomerLegalsInput + upsert?: Prisma.CustomerUpsertWithoutCustomerLegalsInput + connect?: Prisma.CustomerWhereUniqueInput + update?: Prisma.XOR, Prisma.CustomerUncheckedUpdateWithoutCustomerLegalsInput> +} + export type CustomerCreateNestedOneWithoutSales_invoicesInput = { create?: Prisma.XOR connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutSales_invoicesInput @@ -514,34 +451,156 @@ export type CustomerUpdateOneWithoutSales_invoicesNestedInput = { update?: Prisma.XOR, Prisma.CustomerUncheckedUpdateWithoutSales_invoicesInput> } -export type CustomerCreateWithoutSales_invoicesInput = { +export type CustomerCreateWithoutCustomerIndividualsInput = { id?: string - first_name: string - last_name: string - email?: string | null - mobile_number: string - address?: string | null - is_active?: boolean - account_id: string - complex_id: string created_at?: Date | string updated_at?: Date | string deleted_at?: Date | string | null + type: $Enums.CustomerType + complex_id: string + is_favorite?: boolean | null + sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutCustomerInput + customerLegals?: Prisma.CustomerLegalCreateNestedOneWithoutCustomerInput +} + +export type CustomerUncheckedCreateWithoutCustomerIndividualsInput = { + id?: string + created_at?: Date | string + updated_at?: Date | string + deleted_at?: Date | string | null + type: $Enums.CustomerType + complex_id: string + is_favorite?: boolean | null + sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutCustomerInput + customerLegals?: Prisma.CustomerLegalUncheckedCreateNestedOneWithoutCustomerInput +} + +export type CustomerCreateOrConnectWithoutCustomerIndividualsInput = { + where: Prisma.CustomerWhereUniqueInput + create: Prisma.XOR +} + +export type CustomerUpsertWithoutCustomerIndividualsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.CustomerWhereInput +} + +export type CustomerUpdateToOneWithWhereWithoutCustomerIndividualsInput = { + where?: Prisma.CustomerWhereInput + data: Prisma.XOR +} + +export type CustomerUpdateWithoutCustomerIndividualsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + type?: Prisma.EnumCustomerTypeFieldUpdateOperationsInput | $Enums.CustomerType + complex_id?: Prisma.StringFieldUpdateOperationsInput | string + is_favorite?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutCustomerNestedInput + customerLegals?: Prisma.CustomerLegalUpdateOneWithoutCustomerNestedInput +} + +export type CustomerUncheckedUpdateWithoutCustomerIndividualsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + type?: Prisma.EnumCustomerTypeFieldUpdateOperationsInput | $Enums.CustomerType + complex_id?: Prisma.StringFieldUpdateOperationsInput | string + is_favorite?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput + customerLegals?: Prisma.CustomerLegalUncheckedUpdateOneWithoutCustomerNestedInput +} + +export type CustomerCreateWithoutCustomerLegalsInput = { + id?: string + created_at?: Date | string + updated_at?: Date | string + deleted_at?: Date | string | null + type: $Enums.CustomerType + complex_id: string + is_favorite?: boolean | null + sales_invoices?: Prisma.SalesInvoiceCreateNestedManyWithoutCustomerInput + customerIndividuals?: Prisma.CustomerIndividualCreateNestedOneWithoutCustomerInput +} + +export type CustomerUncheckedCreateWithoutCustomerLegalsInput = { + id?: string + created_at?: Date | string + updated_at?: Date | string + deleted_at?: Date | string | null + type: $Enums.CustomerType + complex_id: string + is_favorite?: boolean | null + sales_invoices?: Prisma.SalesInvoiceUncheckedCreateNestedManyWithoutCustomerInput + customerIndividuals?: Prisma.CustomerIndividualUncheckedCreateNestedOneWithoutCustomerInput +} + +export type CustomerCreateOrConnectWithoutCustomerLegalsInput = { + where: Prisma.CustomerWhereUniqueInput + create: Prisma.XOR +} + +export type CustomerUpsertWithoutCustomerLegalsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.CustomerWhereInput +} + +export type CustomerUpdateToOneWithWhereWithoutCustomerLegalsInput = { + where?: Prisma.CustomerWhereInput + data: Prisma.XOR +} + +export type CustomerUpdateWithoutCustomerLegalsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + type?: Prisma.EnumCustomerTypeFieldUpdateOperationsInput | $Enums.CustomerType + complex_id?: Prisma.StringFieldUpdateOperationsInput | string + is_favorite?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + sales_invoices?: Prisma.SalesInvoiceUpdateManyWithoutCustomerNestedInput + customerIndividuals?: Prisma.CustomerIndividualUpdateOneWithoutCustomerNestedInput +} + +export type CustomerUncheckedUpdateWithoutCustomerLegalsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + type?: Prisma.EnumCustomerTypeFieldUpdateOperationsInput | $Enums.CustomerType + complex_id?: Prisma.StringFieldUpdateOperationsInput | string + is_favorite?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + sales_invoices?: Prisma.SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput + customerIndividuals?: Prisma.CustomerIndividualUncheckedUpdateOneWithoutCustomerNestedInput +} + +export type CustomerCreateWithoutSales_invoicesInput = { + id?: string + created_at?: Date | string + updated_at?: Date | string + deleted_at?: Date | string | null + type: $Enums.CustomerType + complex_id: string + is_favorite?: boolean | null + customerIndividuals?: Prisma.CustomerIndividualCreateNestedOneWithoutCustomerInput + customerLegals?: Prisma.CustomerLegalCreateNestedOneWithoutCustomerInput } export type CustomerUncheckedCreateWithoutSales_invoicesInput = { id?: string - first_name: string - last_name: string - email?: string | null - mobile_number: string - address?: string | null - is_active?: boolean - account_id: string - complex_id: string created_at?: Date | string updated_at?: Date | string deleted_at?: Date | string | null + type: $Enums.CustomerType + complex_id: string + is_favorite?: boolean | null + customerIndividuals?: Prisma.CustomerIndividualUncheckedCreateNestedOneWithoutCustomerInput + customerLegals?: Prisma.CustomerLegalUncheckedCreateNestedOneWithoutCustomerInput } export type CustomerCreateOrConnectWithoutSales_invoicesInput = { @@ -562,32 +621,26 @@ export type CustomerUpdateToOneWithWhereWithoutSales_invoicesInput = { export type CustomerUpdateWithoutSales_invoicesInput = { id?: Prisma.StringFieldUpdateOperationsInput | string - first_name?: Prisma.StringFieldUpdateOperationsInput | string - last_name?: Prisma.StringFieldUpdateOperationsInput | string - email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - mobile_number?: Prisma.StringFieldUpdateOperationsInput | string - address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - is_active?: Prisma.BoolFieldUpdateOperationsInput | boolean - account_id?: Prisma.StringFieldUpdateOperationsInput | string - complex_id?: Prisma.StringFieldUpdateOperationsInput | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + type?: Prisma.EnumCustomerTypeFieldUpdateOperationsInput | $Enums.CustomerType + complex_id?: Prisma.StringFieldUpdateOperationsInput | string + is_favorite?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + customerIndividuals?: Prisma.CustomerIndividualUpdateOneWithoutCustomerNestedInput + customerLegals?: Prisma.CustomerLegalUpdateOneWithoutCustomerNestedInput } export type CustomerUncheckedUpdateWithoutSales_invoicesInput = { id?: Prisma.StringFieldUpdateOperationsInput | string - first_name?: Prisma.StringFieldUpdateOperationsInput | string - last_name?: Prisma.StringFieldUpdateOperationsInput | string - email?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - mobile_number?: Prisma.StringFieldUpdateOperationsInput | string - address?: Prisma.NullableStringFieldUpdateOperationsInput | string | null - is_active?: Prisma.BoolFieldUpdateOperationsInput | boolean - account_id?: Prisma.StringFieldUpdateOperationsInput | string - complex_id?: Prisma.StringFieldUpdateOperationsInput | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string deleted_at?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null + type?: Prisma.EnumCustomerTypeFieldUpdateOperationsInput | $Enums.CustomerType + complex_id?: Prisma.StringFieldUpdateOperationsInput | string + is_favorite?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null + customerIndividuals?: Prisma.CustomerIndividualUncheckedUpdateOneWithoutCustomerNestedInput + customerLegals?: Prisma.CustomerLegalUncheckedUpdateOneWithoutCustomerNestedInput } @@ -623,18 +676,15 @@ export type CustomerCountOutputTypeCountSales_invoicesArgs = runtime.Types.Extensions.GetSelect<{ id?: boolean - first_name?: boolean - last_name?: boolean - email?: boolean - mobile_number?: boolean - address?: boolean - is_active?: boolean - account_id?: boolean - complex_id?: boolean created_at?: boolean updated_at?: boolean deleted_at?: boolean + type?: boolean + complex_id?: boolean + is_favorite?: boolean sales_invoices?: boolean | Prisma.Customer$sales_invoicesArgs + customerIndividuals?: boolean | Prisma.Customer$customerIndividualsArgs + customerLegals?: boolean | Prisma.Customer$customerLegalsArgs _count?: boolean | Prisma.CustomerCountOutputTypeDefaultArgs }, ExtArgs["result"]["customer"]> @@ -642,22 +692,19 @@ export type CustomerSelect = runtime.Types.Extensions.GetOmit<"id" | "first_name" | "last_name" | "email" | "mobile_number" | "address" | "is_active" | "account_id" | "complex_id" | "created_at" | "updated_at" | "deleted_at", ExtArgs["result"]["customer"]> +export type CustomerOmit = runtime.Types.Extensions.GetOmit<"id" | "created_at" | "updated_at" | "deleted_at" | "type" | "complex_id" | "is_favorite", ExtArgs["result"]["customer"]> export type CustomerInclude = { sales_invoices?: boolean | Prisma.Customer$sales_invoicesArgs + customerIndividuals?: boolean | Prisma.Customer$customerIndividualsArgs + customerLegals?: boolean | Prisma.Customer$customerLegalsArgs _count?: boolean | Prisma.CustomerCountOutputTypeDefaultArgs } @@ -665,20 +712,17 @@ export type $CustomerPayload[] + customerIndividuals: Prisma.$CustomerIndividualPayload | null + customerLegals: Prisma.$CustomerLegalPayload | null } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: string - first_name: string - last_name: string - email: string | null - mobile_number: string - address: string | null - is_active: boolean - account_id: string - complex_id: string created_at: Date updated_at: Date deleted_at: Date | null + type: $Enums.CustomerType + complex_id: string + is_favorite: boolean | null }, ExtArgs["result"]["customer"]> composites: {} } @@ -1020,6 +1064,8 @@ readonly fields: CustomerFieldRefs; export interface Prisma__CustomerClient extends Prisma.PrismaPromise { readonly [Symbol.toStringTag]: "PrismaPromise" sales_invoices = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + customerIndividuals = {}>(args?: Prisma.Subset>): Prisma.Prisma__CustomerIndividualClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + customerLegals = {}>(args?: Prisma.Subset>): Prisma.Prisma__CustomerLegalClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -1050,17 +1096,12 @@ export interface Prisma__CustomerClient - readonly first_name: Prisma.FieldRef<"Customer", 'String'> - readonly last_name: Prisma.FieldRef<"Customer", 'String'> - readonly email: Prisma.FieldRef<"Customer", 'String'> - readonly mobile_number: Prisma.FieldRef<"Customer", 'String'> - readonly address: Prisma.FieldRef<"Customer", 'String'> - readonly is_active: Prisma.FieldRef<"Customer", 'Boolean'> - readonly account_id: Prisma.FieldRef<"Customer", 'String'> - readonly complex_id: Prisma.FieldRef<"Customer", 'String'> readonly created_at: Prisma.FieldRef<"Customer", 'DateTime'> readonly updated_at: Prisma.FieldRef<"Customer", 'DateTime'> readonly deleted_at: Prisma.FieldRef<"Customer", 'DateTime'> + readonly type: Prisma.FieldRef<"Customer", 'CustomerType'> + readonly complex_id: Prisma.FieldRef<"Customer", 'String'> + readonly is_favorite: Prisma.FieldRef<"Customer", 'Boolean'> } @@ -1427,6 +1468,44 @@ export type Customer$sales_invoicesArgs = { + /** + * Select specific fields to fetch from the CustomerIndividual + */ + select?: Prisma.CustomerIndividualSelect | null + /** + * Omit specific fields from the CustomerIndividual + */ + omit?: Prisma.CustomerIndividualOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerIndividualInclude | null + where?: Prisma.CustomerIndividualWhereInput +} + +/** + * Customer.customerLegals + */ +export type Customer$customerLegalsArgs = { + /** + * Select specific fields to fetch from the CustomerLegal + */ + select?: Prisma.CustomerLegalSelect | null + /** + * Omit specific fields from the CustomerLegal + */ + omit?: Prisma.CustomerLegalOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerLegalInclude | null + where?: Prisma.CustomerLegalWhereInput +} + /** * Customer without action */ diff --git a/src/generated/prisma/models/CustomerIndividual.ts b/src/generated/prisma/models/CustomerIndividual.ts new file mode 100644 index 0000000..502568f --- /dev/null +++ b/src/generated/prisma/models/CustomerIndividual.ts @@ -0,0 +1,1238 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `CustomerIndividual` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums.js" +import type * as Prisma from "../internal/prismaNamespace.js" + +/** + * Model CustomerIndividual + * + */ +export type CustomerIndividualModel = runtime.Types.Result.DefaultSelection + +export type AggregateCustomerIndividual = { + _count: CustomerIndividualCountAggregateOutputType | null + _min: CustomerIndividualMinAggregateOutputType | null + _max: CustomerIndividualMaxAggregateOutputType | null +} + +export type CustomerIndividualMinAggregateOutputType = { + customer_id: string | null + first_name: string | null + last_name: string | null + national_id: string | null + postal_code: string | null + economic_code: string | null + complex_id: string | null +} + +export type CustomerIndividualMaxAggregateOutputType = { + customer_id: string | null + first_name: string | null + last_name: string | null + national_id: string | null + postal_code: string | null + economic_code: string | null + complex_id: string | null +} + +export type CustomerIndividualCountAggregateOutputType = { + customer_id: number + first_name: number + last_name: number + national_id: number + postal_code: number + economic_code: number + complex_id: number + _all: number +} + + +export type CustomerIndividualMinAggregateInputType = { + customer_id?: true + first_name?: true + last_name?: true + national_id?: true + postal_code?: true + economic_code?: true + complex_id?: true +} + +export type CustomerIndividualMaxAggregateInputType = { + customer_id?: true + first_name?: true + last_name?: true + national_id?: true + postal_code?: true + economic_code?: true + complex_id?: true +} + +export type CustomerIndividualCountAggregateInputType = { + customer_id?: true + first_name?: true + last_name?: true + national_id?: true + postal_code?: true + economic_code?: true + complex_id?: true + _all?: true +} + +export type CustomerIndividualAggregateArgs = { + /** + * Filter which CustomerIndividual to aggregate. + */ + where?: Prisma.CustomerIndividualWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of CustomerIndividuals to fetch. + */ + orderBy?: Prisma.CustomerIndividualOrderByWithRelationInput | Prisma.CustomerIndividualOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.CustomerIndividualWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` CustomerIndividuals from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` CustomerIndividuals. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned CustomerIndividuals + **/ + _count?: true | CustomerIndividualCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: CustomerIndividualMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: CustomerIndividualMaxAggregateInputType +} + +export type GetCustomerIndividualAggregateType = { + [P in keyof T & keyof AggregateCustomerIndividual]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type CustomerIndividualGroupByArgs = { + where?: Prisma.CustomerIndividualWhereInput + orderBy?: Prisma.CustomerIndividualOrderByWithAggregationInput | Prisma.CustomerIndividualOrderByWithAggregationInput[] + by: Prisma.CustomerIndividualScalarFieldEnum[] | Prisma.CustomerIndividualScalarFieldEnum + having?: Prisma.CustomerIndividualScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: CustomerIndividualCountAggregateInputType | true + _min?: CustomerIndividualMinAggregateInputType + _max?: CustomerIndividualMaxAggregateInputType +} + +export type CustomerIndividualGroupByOutputType = { + customer_id: string + first_name: string + last_name: string + national_id: string + postal_code: string + economic_code: string | null + complex_id: string + _count: CustomerIndividualCountAggregateOutputType | null + _min: CustomerIndividualMinAggregateOutputType | null + _max: CustomerIndividualMaxAggregateOutputType | null +} + +type GetCustomerIndividualGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof CustomerIndividualGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type CustomerIndividualWhereInput = { + AND?: Prisma.CustomerIndividualWhereInput | Prisma.CustomerIndividualWhereInput[] + OR?: Prisma.CustomerIndividualWhereInput[] + NOT?: Prisma.CustomerIndividualWhereInput | Prisma.CustomerIndividualWhereInput[] + customer_id?: Prisma.StringFilter<"CustomerIndividual"> | string + first_name?: Prisma.StringFilter<"CustomerIndividual"> | string + last_name?: Prisma.StringFilter<"CustomerIndividual"> | string + national_id?: Prisma.StringFilter<"CustomerIndividual"> | string + postal_code?: Prisma.StringFilter<"CustomerIndividual"> | string + economic_code?: Prisma.StringNullableFilter<"CustomerIndividual"> | string | null + complex_id?: Prisma.StringFilter<"CustomerIndividual"> | string + customer?: Prisma.XOR +} + +export type CustomerIndividualOrderByWithRelationInput = { + customer_id?: Prisma.SortOrder + first_name?: Prisma.SortOrder + last_name?: Prisma.SortOrder + national_id?: Prisma.SortOrder + postal_code?: Prisma.SortOrder + economic_code?: Prisma.SortOrderInput | Prisma.SortOrder + complex_id?: Prisma.SortOrder + customer?: Prisma.CustomerOrderByWithRelationInput + _relevance?: Prisma.CustomerIndividualOrderByRelevanceInput +} + +export type CustomerIndividualWhereUniqueInput = Prisma.AtLeast<{ + customer_id?: string + complex_id_national_id?: Prisma.CustomerIndividualComplex_idNational_idCompoundUniqueInput + AND?: Prisma.CustomerIndividualWhereInput | Prisma.CustomerIndividualWhereInput[] + OR?: Prisma.CustomerIndividualWhereInput[] + NOT?: Prisma.CustomerIndividualWhereInput | Prisma.CustomerIndividualWhereInput[] + first_name?: Prisma.StringFilter<"CustomerIndividual"> | string + last_name?: Prisma.StringFilter<"CustomerIndividual"> | string + national_id?: Prisma.StringFilter<"CustomerIndividual"> | string + postal_code?: Prisma.StringFilter<"CustomerIndividual"> | string + economic_code?: Prisma.StringNullableFilter<"CustomerIndividual"> | string | null + complex_id?: Prisma.StringFilter<"CustomerIndividual"> | string + customer?: Prisma.XOR +}, "customer_id" | "complex_id_national_id"> + +export type CustomerIndividualOrderByWithAggregationInput = { + customer_id?: Prisma.SortOrder + first_name?: Prisma.SortOrder + last_name?: Prisma.SortOrder + national_id?: Prisma.SortOrder + postal_code?: Prisma.SortOrder + economic_code?: Prisma.SortOrderInput | Prisma.SortOrder + complex_id?: Prisma.SortOrder + _count?: Prisma.CustomerIndividualCountOrderByAggregateInput + _max?: Prisma.CustomerIndividualMaxOrderByAggregateInput + _min?: Prisma.CustomerIndividualMinOrderByAggregateInput +} + +export type CustomerIndividualScalarWhereWithAggregatesInput = { + AND?: Prisma.CustomerIndividualScalarWhereWithAggregatesInput | Prisma.CustomerIndividualScalarWhereWithAggregatesInput[] + OR?: Prisma.CustomerIndividualScalarWhereWithAggregatesInput[] + NOT?: Prisma.CustomerIndividualScalarWhereWithAggregatesInput | Prisma.CustomerIndividualScalarWhereWithAggregatesInput[] + customer_id?: Prisma.StringWithAggregatesFilter<"CustomerIndividual"> | string + first_name?: Prisma.StringWithAggregatesFilter<"CustomerIndividual"> | string + last_name?: Prisma.StringWithAggregatesFilter<"CustomerIndividual"> | string + national_id?: Prisma.StringWithAggregatesFilter<"CustomerIndividual"> | string + postal_code?: Prisma.StringWithAggregatesFilter<"CustomerIndividual"> | string + economic_code?: Prisma.StringNullableWithAggregatesFilter<"CustomerIndividual"> | string | null + complex_id?: Prisma.StringWithAggregatesFilter<"CustomerIndividual"> | string +} + +export type CustomerIndividualCreateInput = { + first_name: string + last_name: string + national_id: string + postal_code: string + economic_code?: string | null + complex_id: string + customer: Prisma.CustomerCreateNestedOneWithoutCustomerIndividualsInput +} + +export type CustomerIndividualUncheckedCreateInput = { + customer_id: string + first_name: string + last_name: string + national_id: string + postal_code: string + economic_code?: string | null + complex_id: string +} + +export type CustomerIndividualUpdateInput = { + first_name?: Prisma.StringFieldUpdateOperationsInput | string + last_name?: Prisma.StringFieldUpdateOperationsInput | string + national_id?: Prisma.StringFieldUpdateOperationsInput | string + postal_code?: Prisma.StringFieldUpdateOperationsInput | string + economic_code?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + complex_id?: Prisma.StringFieldUpdateOperationsInput | string + customer?: Prisma.CustomerUpdateOneRequiredWithoutCustomerIndividualsNestedInput +} + +export type CustomerIndividualUncheckedUpdateInput = { + customer_id?: Prisma.StringFieldUpdateOperationsInput | string + first_name?: Prisma.StringFieldUpdateOperationsInput | string + last_name?: Prisma.StringFieldUpdateOperationsInput | string + national_id?: Prisma.StringFieldUpdateOperationsInput | string + postal_code?: Prisma.StringFieldUpdateOperationsInput | string + economic_code?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + complex_id?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type CustomerIndividualCreateManyInput = { + customer_id: string + first_name: string + last_name: string + national_id: string + postal_code: string + economic_code?: string | null + complex_id: string +} + +export type CustomerIndividualUpdateManyMutationInput = { + first_name?: Prisma.StringFieldUpdateOperationsInput | string + last_name?: Prisma.StringFieldUpdateOperationsInput | string + national_id?: Prisma.StringFieldUpdateOperationsInput | string + postal_code?: Prisma.StringFieldUpdateOperationsInput | string + economic_code?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + complex_id?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type CustomerIndividualUncheckedUpdateManyInput = { + customer_id?: Prisma.StringFieldUpdateOperationsInput | string + first_name?: Prisma.StringFieldUpdateOperationsInput | string + last_name?: Prisma.StringFieldUpdateOperationsInput | string + national_id?: Prisma.StringFieldUpdateOperationsInput | string + postal_code?: Prisma.StringFieldUpdateOperationsInput | string + economic_code?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + complex_id?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type CustomerIndividualNullableScalarRelationFilter = { + is?: Prisma.CustomerIndividualWhereInput | null + isNot?: Prisma.CustomerIndividualWhereInput | null +} + +export type CustomerIndividualOrderByRelevanceInput = { + fields: Prisma.CustomerIndividualOrderByRelevanceFieldEnum | Prisma.CustomerIndividualOrderByRelevanceFieldEnum[] + sort: Prisma.SortOrder + search: string +} + +export type CustomerIndividualComplex_idNational_idCompoundUniqueInput = { + complex_id: string + national_id: string +} + +export type CustomerIndividualCountOrderByAggregateInput = { + customer_id?: Prisma.SortOrder + first_name?: Prisma.SortOrder + last_name?: Prisma.SortOrder + national_id?: Prisma.SortOrder + postal_code?: Prisma.SortOrder + economic_code?: Prisma.SortOrder + complex_id?: Prisma.SortOrder +} + +export type CustomerIndividualMaxOrderByAggregateInput = { + customer_id?: Prisma.SortOrder + first_name?: Prisma.SortOrder + last_name?: Prisma.SortOrder + national_id?: Prisma.SortOrder + postal_code?: Prisma.SortOrder + economic_code?: Prisma.SortOrder + complex_id?: Prisma.SortOrder +} + +export type CustomerIndividualMinOrderByAggregateInput = { + customer_id?: Prisma.SortOrder + first_name?: Prisma.SortOrder + last_name?: Prisma.SortOrder + national_id?: Prisma.SortOrder + postal_code?: Prisma.SortOrder + economic_code?: Prisma.SortOrder + complex_id?: Prisma.SortOrder +} + +export type CustomerIndividualCreateNestedOneWithoutCustomerInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerIndividualCreateOrConnectWithoutCustomerInput + connect?: Prisma.CustomerIndividualWhereUniqueInput +} + +export type CustomerIndividualUncheckedCreateNestedOneWithoutCustomerInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerIndividualCreateOrConnectWithoutCustomerInput + connect?: Prisma.CustomerIndividualWhereUniqueInput +} + +export type CustomerIndividualUpdateOneWithoutCustomerNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerIndividualCreateOrConnectWithoutCustomerInput + upsert?: Prisma.CustomerIndividualUpsertWithoutCustomerInput + disconnect?: Prisma.CustomerIndividualWhereInput | boolean + delete?: Prisma.CustomerIndividualWhereInput | boolean + connect?: Prisma.CustomerIndividualWhereUniqueInput + update?: Prisma.XOR, Prisma.CustomerIndividualUncheckedUpdateWithoutCustomerInput> +} + +export type CustomerIndividualUncheckedUpdateOneWithoutCustomerNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerIndividualCreateOrConnectWithoutCustomerInput + upsert?: Prisma.CustomerIndividualUpsertWithoutCustomerInput + disconnect?: Prisma.CustomerIndividualWhereInput | boolean + delete?: Prisma.CustomerIndividualWhereInput | boolean + connect?: Prisma.CustomerIndividualWhereUniqueInput + update?: Prisma.XOR, Prisma.CustomerIndividualUncheckedUpdateWithoutCustomerInput> +} + +export type NullableStringFieldUpdateOperationsInput = { + set?: string | null +} + +export type CustomerIndividualCreateWithoutCustomerInput = { + first_name: string + last_name: string + national_id: string + postal_code: string + economic_code?: string | null + complex_id: string +} + +export type CustomerIndividualUncheckedCreateWithoutCustomerInput = { + first_name: string + last_name: string + national_id: string + postal_code: string + economic_code?: string | null + complex_id: string +} + +export type CustomerIndividualCreateOrConnectWithoutCustomerInput = { + where: Prisma.CustomerIndividualWhereUniqueInput + create: Prisma.XOR +} + +export type CustomerIndividualUpsertWithoutCustomerInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.CustomerIndividualWhereInput +} + +export type CustomerIndividualUpdateToOneWithWhereWithoutCustomerInput = { + where?: Prisma.CustomerIndividualWhereInput + data: Prisma.XOR +} + +export type CustomerIndividualUpdateWithoutCustomerInput = { + first_name?: Prisma.StringFieldUpdateOperationsInput | string + last_name?: Prisma.StringFieldUpdateOperationsInput | string + national_id?: Prisma.StringFieldUpdateOperationsInput | string + postal_code?: Prisma.StringFieldUpdateOperationsInput | string + economic_code?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + complex_id?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type CustomerIndividualUncheckedUpdateWithoutCustomerInput = { + first_name?: Prisma.StringFieldUpdateOperationsInput | string + last_name?: Prisma.StringFieldUpdateOperationsInput | string + national_id?: Prisma.StringFieldUpdateOperationsInput | string + postal_code?: Prisma.StringFieldUpdateOperationsInput | string + economic_code?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + complex_id?: Prisma.StringFieldUpdateOperationsInput | string +} + + + +export type CustomerIndividualSelect = runtime.Types.Extensions.GetSelect<{ + customer_id?: boolean + first_name?: boolean + last_name?: boolean + national_id?: boolean + postal_code?: boolean + economic_code?: boolean + complex_id?: boolean + customer?: boolean | Prisma.CustomerDefaultArgs +}, ExtArgs["result"]["customerIndividual"]> + + + +export type CustomerIndividualSelectScalar = { + customer_id?: boolean + first_name?: boolean + last_name?: boolean + national_id?: boolean + postal_code?: boolean + economic_code?: boolean + complex_id?: boolean +} + +export type CustomerIndividualOmit = runtime.Types.Extensions.GetOmit<"customer_id" | "first_name" | "last_name" | "national_id" | "postal_code" | "economic_code" | "complex_id", ExtArgs["result"]["customerIndividual"]> +export type CustomerIndividualInclude = { + customer?: boolean | Prisma.CustomerDefaultArgs +} + +export type $CustomerIndividualPayload = { + name: "CustomerIndividual" + objects: { + customer: Prisma.$CustomerPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + customer_id: string + first_name: string + last_name: string + national_id: string + postal_code: string + economic_code: string | null + complex_id: string + }, ExtArgs["result"]["customerIndividual"]> + composites: {} +} + +export type CustomerIndividualGetPayload = runtime.Types.Result.GetResult + +export type CustomerIndividualCountArgs = + Omit & { + select?: CustomerIndividualCountAggregateInputType | true + } + +export interface CustomerIndividualDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['CustomerIndividual'], meta: { name: 'CustomerIndividual' } } + /** + * Find zero or one CustomerIndividual that matches the filter. + * @param {CustomerIndividualFindUniqueArgs} args - Arguments to find a CustomerIndividual + * @example + * // Get one CustomerIndividual + * const customerIndividual = await prisma.customerIndividual.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__CustomerIndividualClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one CustomerIndividual that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {CustomerIndividualFindUniqueOrThrowArgs} args - Arguments to find a CustomerIndividual + * @example + * // Get one CustomerIndividual + * const customerIndividual = await prisma.customerIndividual.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__CustomerIndividualClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first CustomerIndividual that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerIndividualFindFirstArgs} args - Arguments to find a CustomerIndividual + * @example + * // Get one CustomerIndividual + * const customerIndividual = await prisma.customerIndividual.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__CustomerIndividualClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first CustomerIndividual that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerIndividualFindFirstOrThrowArgs} args - Arguments to find a CustomerIndividual + * @example + * // Get one CustomerIndividual + * const customerIndividual = await prisma.customerIndividual.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__CustomerIndividualClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more CustomerIndividuals that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerIndividualFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all CustomerIndividuals + * const customerIndividuals = await prisma.customerIndividual.findMany() + * + * // Get first 10 CustomerIndividuals + * const customerIndividuals = await prisma.customerIndividual.findMany({ take: 10 }) + * + * // Only select the `customer_id` + * const customerIndividualWithCustomer_idOnly = await prisma.customerIndividual.findMany({ select: { customer_id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a CustomerIndividual. + * @param {CustomerIndividualCreateArgs} args - Arguments to create a CustomerIndividual. + * @example + * // Create one CustomerIndividual + * const CustomerIndividual = await prisma.customerIndividual.create({ + * data: { + * // ... data to create a CustomerIndividual + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__CustomerIndividualClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many CustomerIndividuals. + * @param {CustomerIndividualCreateManyArgs} args - Arguments to create many CustomerIndividuals. + * @example + * // Create many CustomerIndividuals + * const customerIndividual = await prisma.customerIndividual.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Delete a CustomerIndividual. + * @param {CustomerIndividualDeleteArgs} args - Arguments to delete one CustomerIndividual. + * @example + * // Delete one CustomerIndividual + * const CustomerIndividual = await prisma.customerIndividual.delete({ + * where: { + * // ... filter to delete one CustomerIndividual + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__CustomerIndividualClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one CustomerIndividual. + * @param {CustomerIndividualUpdateArgs} args - Arguments to update one CustomerIndividual. + * @example + * // Update one CustomerIndividual + * const customerIndividual = await prisma.customerIndividual.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__CustomerIndividualClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more CustomerIndividuals. + * @param {CustomerIndividualDeleteManyArgs} args - Arguments to filter CustomerIndividuals to delete. + * @example + * // Delete a few CustomerIndividuals + * const { count } = await prisma.customerIndividual.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more CustomerIndividuals. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerIndividualUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many CustomerIndividuals + * const customerIndividual = await prisma.customerIndividual.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create or update one CustomerIndividual. + * @param {CustomerIndividualUpsertArgs} args - Arguments to update or create a CustomerIndividual. + * @example + * // Update or create a CustomerIndividual + * const customerIndividual = await prisma.customerIndividual.upsert({ + * create: { + * // ... data to create a CustomerIndividual + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the CustomerIndividual we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__CustomerIndividualClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of CustomerIndividuals. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerIndividualCountArgs} args - Arguments to filter CustomerIndividuals to count. + * @example + * // Count the number of CustomerIndividuals + * const count = await prisma.customerIndividual.count({ + * where: { + * // ... the filter for the CustomerIndividuals we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a CustomerIndividual. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerIndividualAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by CustomerIndividual. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerIndividualGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends CustomerIndividualGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: CustomerIndividualGroupByArgs['orderBy'] } + : { orderBy?: CustomerIndividualGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetCustomerIndividualGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the CustomerIndividual model + */ +readonly fields: CustomerIndividualFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for CustomerIndividual. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__CustomerIndividualClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + customer = {}>(args?: Prisma.Subset>): Prisma.Prisma__CustomerClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the CustomerIndividual model + */ +export interface CustomerIndividualFieldRefs { + readonly customer_id: Prisma.FieldRef<"CustomerIndividual", 'String'> + readonly first_name: Prisma.FieldRef<"CustomerIndividual", 'String'> + readonly last_name: Prisma.FieldRef<"CustomerIndividual", 'String'> + readonly national_id: Prisma.FieldRef<"CustomerIndividual", 'String'> + readonly postal_code: Prisma.FieldRef<"CustomerIndividual", 'String'> + readonly economic_code: Prisma.FieldRef<"CustomerIndividual", 'String'> + readonly complex_id: Prisma.FieldRef<"CustomerIndividual", 'String'> +} + + +// Custom InputTypes +/** + * CustomerIndividual findUnique + */ +export type CustomerIndividualFindUniqueArgs = { + /** + * Select specific fields to fetch from the CustomerIndividual + */ + select?: Prisma.CustomerIndividualSelect | null + /** + * Omit specific fields from the CustomerIndividual + */ + omit?: Prisma.CustomerIndividualOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerIndividualInclude | null + /** + * Filter, which CustomerIndividual to fetch. + */ + where: Prisma.CustomerIndividualWhereUniqueInput +} + +/** + * CustomerIndividual findUniqueOrThrow + */ +export type CustomerIndividualFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the CustomerIndividual + */ + select?: Prisma.CustomerIndividualSelect | null + /** + * Omit specific fields from the CustomerIndividual + */ + omit?: Prisma.CustomerIndividualOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerIndividualInclude | null + /** + * Filter, which CustomerIndividual to fetch. + */ + where: Prisma.CustomerIndividualWhereUniqueInput +} + +/** + * CustomerIndividual findFirst + */ +export type CustomerIndividualFindFirstArgs = { + /** + * Select specific fields to fetch from the CustomerIndividual + */ + select?: Prisma.CustomerIndividualSelect | null + /** + * Omit specific fields from the CustomerIndividual + */ + omit?: Prisma.CustomerIndividualOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerIndividualInclude | null + /** + * Filter, which CustomerIndividual to fetch. + */ + where?: Prisma.CustomerIndividualWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of CustomerIndividuals to fetch. + */ + orderBy?: Prisma.CustomerIndividualOrderByWithRelationInput | Prisma.CustomerIndividualOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for CustomerIndividuals. + */ + cursor?: Prisma.CustomerIndividualWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` CustomerIndividuals from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` CustomerIndividuals. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of CustomerIndividuals. + */ + distinct?: Prisma.CustomerIndividualScalarFieldEnum | Prisma.CustomerIndividualScalarFieldEnum[] +} + +/** + * CustomerIndividual findFirstOrThrow + */ +export type CustomerIndividualFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the CustomerIndividual + */ + select?: Prisma.CustomerIndividualSelect | null + /** + * Omit specific fields from the CustomerIndividual + */ + omit?: Prisma.CustomerIndividualOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerIndividualInclude | null + /** + * Filter, which CustomerIndividual to fetch. + */ + where?: Prisma.CustomerIndividualWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of CustomerIndividuals to fetch. + */ + orderBy?: Prisma.CustomerIndividualOrderByWithRelationInput | Prisma.CustomerIndividualOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for CustomerIndividuals. + */ + cursor?: Prisma.CustomerIndividualWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` CustomerIndividuals from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` CustomerIndividuals. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of CustomerIndividuals. + */ + distinct?: Prisma.CustomerIndividualScalarFieldEnum | Prisma.CustomerIndividualScalarFieldEnum[] +} + +/** + * CustomerIndividual findMany + */ +export type CustomerIndividualFindManyArgs = { + /** + * Select specific fields to fetch from the CustomerIndividual + */ + select?: Prisma.CustomerIndividualSelect | null + /** + * Omit specific fields from the CustomerIndividual + */ + omit?: Prisma.CustomerIndividualOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerIndividualInclude | null + /** + * Filter, which CustomerIndividuals to fetch. + */ + where?: Prisma.CustomerIndividualWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of CustomerIndividuals to fetch. + */ + orderBy?: Prisma.CustomerIndividualOrderByWithRelationInput | Prisma.CustomerIndividualOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing CustomerIndividuals. + */ + cursor?: Prisma.CustomerIndividualWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` CustomerIndividuals from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` CustomerIndividuals. + */ + skip?: number + distinct?: Prisma.CustomerIndividualScalarFieldEnum | Prisma.CustomerIndividualScalarFieldEnum[] +} + +/** + * CustomerIndividual create + */ +export type CustomerIndividualCreateArgs = { + /** + * Select specific fields to fetch from the CustomerIndividual + */ + select?: Prisma.CustomerIndividualSelect | null + /** + * Omit specific fields from the CustomerIndividual + */ + omit?: Prisma.CustomerIndividualOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerIndividualInclude | null + /** + * The data needed to create a CustomerIndividual. + */ + data: Prisma.XOR +} + +/** + * CustomerIndividual createMany + */ +export type CustomerIndividualCreateManyArgs = { + /** + * The data used to create many CustomerIndividuals. + */ + data: Prisma.CustomerIndividualCreateManyInput | Prisma.CustomerIndividualCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * CustomerIndividual update + */ +export type CustomerIndividualUpdateArgs = { + /** + * Select specific fields to fetch from the CustomerIndividual + */ + select?: Prisma.CustomerIndividualSelect | null + /** + * Omit specific fields from the CustomerIndividual + */ + omit?: Prisma.CustomerIndividualOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerIndividualInclude | null + /** + * The data needed to update a CustomerIndividual. + */ + data: Prisma.XOR + /** + * Choose, which CustomerIndividual to update. + */ + where: Prisma.CustomerIndividualWhereUniqueInput +} + +/** + * CustomerIndividual updateMany + */ +export type CustomerIndividualUpdateManyArgs = { + /** + * The data used to update CustomerIndividuals. + */ + data: Prisma.XOR + /** + * Filter which CustomerIndividuals to update + */ + where?: Prisma.CustomerIndividualWhereInput + /** + * Limit how many CustomerIndividuals to update. + */ + limit?: number +} + +/** + * CustomerIndividual upsert + */ +export type CustomerIndividualUpsertArgs = { + /** + * Select specific fields to fetch from the CustomerIndividual + */ + select?: Prisma.CustomerIndividualSelect | null + /** + * Omit specific fields from the CustomerIndividual + */ + omit?: Prisma.CustomerIndividualOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerIndividualInclude | null + /** + * The filter to search for the CustomerIndividual to update in case it exists. + */ + where: Prisma.CustomerIndividualWhereUniqueInput + /** + * In case the CustomerIndividual found by the `where` argument doesn't exist, create a new CustomerIndividual with this data. + */ + create: Prisma.XOR + /** + * In case the CustomerIndividual was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * CustomerIndividual delete + */ +export type CustomerIndividualDeleteArgs = { + /** + * Select specific fields to fetch from the CustomerIndividual + */ + select?: Prisma.CustomerIndividualSelect | null + /** + * Omit specific fields from the CustomerIndividual + */ + omit?: Prisma.CustomerIndividualOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerIndividualInclude | null + /** + * Filter which CustomerIndividual to delete. + */ + where: Prisma.CustomerIndividualWhereUniqueInput +} + +/** + * CustomerIndividual deleteMany + */ +export type CustomerIndividualDeleteManyArgs = { + /** + * Filter which CustomerIndividuals to delete + */ + where?: Prisma.CustomerIndividualWhereInput + /** + * Limit how many CustomerIndividuals to delete. + */ + limit?: number +} + +/** + * CustomerIndividual without action + */ +export type CustomerIndividualDefaultArgs = { + /** + * Select specific fields to fetch from the CustomerIndividual + */ + select?: Prisma.CustomerIndividualSelect | null + /** + * Omit specific fields from the CustomerIndividual + */ + omit?: Prisma.CustomerIndividualOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerIndividualInclude | null +} diff --git a/src/generated/prisma/models/CustomerLegal.ts b/src/generated/prisma/models/CustomerLegal.ts new file mode 100644 index 0000000..042cbc9 --- /dev/null +++ b/src/generated/prisma/models/CustomerLegal.ts @@ -0,0 +1,1204 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `CustomerLegal` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums.js" +import type * as Prisma from "../internal/prismaNamespace.js" + +/** + * Model CustomerLegal + * + */ +export type CustomerLegalModel = runtime.Types.Result.DefaultSelection + +export type AggregateCustomerLegal = { + _count: CustomerLegalCountAggregateOutputType | null + _min: CustomerLegalMinAggregateOutputType | null + _max: CustomerLegalMaxAggregateOutputType | null +} + +export type CustomerLegalMinAggregateOutputType = { + customer_id: string | null + company_name: string | null + economic_code: string | null + registration_number: string | null + postal_code: string | null + complex_id: string | null +} + +export type CustomerLegalMaxAggregateOutputType = { + customer_id: string | null + company_name: string | null + economic_code: string | null + registration_number: string | null + postal_code: string | null + complex_id: string | null +} + +export type CustomerLegalCountAggregateOutputType = { + customer_id: number + company_name: number + economic_code: number + registration_number: number + postal_code: number + complex_id: number + _all: number +} + + +export type CustomerLegalMinAggregateInputType = { + customer_id?: true + company_name?: true + economic_code?: true + registration_number?: true + postal_code?: true + complex_id?: true +} + +export type CustomerLegalMaxAggregateInputType = { + customer_id?: true + company_name?: true + economic_code?: true + registration_number?: true + postal_code?: true + complex_id?: true +} + +export type CustomerLegalCountAggregateInputType = { + customer_id?: true + company_name?: true + economic_code?: true + registration_number?: true + postal_code?: true + complex_id?: true + _all?: true +} + +export type CustomerLegalAggregateArgs = { + /** + * Filter which CustomerLegal to aggregate. + */ + where?: Prisma.CustomerLegalWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of CustomerLegals to fetch. + */ + orderBy?: Prisma.CustomerLegalOrderByWithRelationInput | Prisma.CustomerLegalOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.CustomerLegalWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` CustomerLegals from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` CustomerLegals. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned CustomerLegals + **/ + _count?: true | CustomerLegalCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: CustomerLegalMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: CustomerLegalMaxAggregateInputType +} + +export type GetCustomerLegalAggregateType = { + [P in keyof T & keyof AggregateCustomerLegal]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type CustomerLegalGroupByArgs = { + where?: Prisma.CustomerLegalWhereInput + orderBy?: Prisma.CustomerLegalOrderByWithAggregationInput | Prisma.CustomerLegalOrderByWithAggregationInput[] + by: Prisma.CustomerLegalScalarFieldEnum[] | Prisma.CustomerLegalScalarFieldEnum + having?: Prisma.CustomerLegalScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: CustomerLegalCountAggregateInputType | true + _min?: CustomerLegalMinAggregateInputType + _max?: CustomerLegalMaxAggregateInputType +} + +export type CustomerLegalGroupByOutputType = { + customer_id: string + company_name: string + economic_code: string + registration_number: string + postal_code: string + complex_id: string + _count: CustomerLegalCountAggregateOutputType | null + _min: CustomerLegalMinAggregateOutputType | null + _max: CustomerLegalMaxAggregateOutputType | null +} + +type GetCustomerLegalGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof CustomerLegalGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type CustomerLegalWhereInput = { + AND?: Prisma.CustomerLegalWhereInput | Prisma.CustomerLegalWhereInput[] + OR?: Prisma.CustomerLegalWhereInput[] + NOT?: Prisma.CustomerLegalWhereInput | Prisma.CustomerLegalWhereInput[] + customer_id?: Prisma.StringFilter<"CustomerLegal"> | string + company_name?: Prisma.StringFilter<"CustomerLegal"> | string + economic_code?: Prisma.StringFilter<"CustomerLegal"> | string + registration_number?: Prisma.StringFilter<"CustomerLegal"> | string + postal_code?: Prisma.StringFilter<"CustomerLegal"> | string + complex_id?: Prisma.StringFilter<"CustomerLegal"> | string + customer?: Prisma.XOR +} + +export type CustomerLegalOrderByWithRelationInput = { + customer_id?: Prisma.SortOrder + company_name?: Prisma.SortOrder + economic_code?: Prisma.SortOrder + registration_number?: Prisma.SortOrder + postal_code?: Prisma.SortOrder + complex_id?: Prisma.SortOrder + customer?: Prisma.CustomerOrderByWithRelationInput + _relevance?: Prisma.CustomerLegalOrderByRelevanceInput +} + +export type CustomerLegalWhereUniqueInput = Prisma.AtLeast<{ + customer_id?: string + registration_number?: string + complex_id_registration_number?: Prisma.CustomerLegalComplex_idRegistration_numberCompoundUniqueInput + AND?: Prisma.CustomerLegalWhereInput | Prisma.CustomerLegalWhereInput[] + OR?: Prisma.CustomerLegalWhereInput[] + NOT?: Prisma.CustomerLegalWhereInput | Prisma.CustomerLegalWhereInput[] + company_name?: Prisma.StringFilter<"CustomerLegal"> | string + economic_code?: Prisma.StringFilter<"CustomerLegal"> | string + postal_code?: Prisma.StringFilter<"CustomerLegal"> | string + complex_id?: Prisma.StringFilter<"CustomerLegal"> | string + customer?: Prisma.XOR +}, "customer_id" | "registration_number" | "complex_id_registration_number"> + +export type CustomerLegalOrderByWithAggregationInput = { + customer_id?: Prisma.SortOrder + company_name?: Prisma.SortOrder + economic_code?: Prisma.SortOrder + registration_number?: Prisma.SortOrder + postal_code?: Prisma.SortOrder + complex_id?: Prisma.SortOrder + _count?: Prisma.CustomerLegalCountOrderByAggregateInput + _max?: Prisma.CustomerLegalMaxOrderByAggregateInput + _min?: Prisma.CustomerLegalMinOrderByAggregateInput +} + +export type CustomerLegalScalarWhereWithAggregatesInput = { + AND?: Prisma.CustomerLegalScalarWhereWithAggregatesInput | Prisma.CustomerLegalScalarWhereWithAggregatesInput[] + OR?: Prisma.CustomerLegalScalarWhereWithAggregatesInput[] + NOT?: Prisma.CustomerLegalScalarWhereWithAggregatesInput | Prisma.CustomerLegalScalarWhereWithAggregatesInput[] + customer_id?: Prisma.StringWithAggregatesFilter<"CustomerLegal"> | string + company_name?: Prisma.StringWithAggregatesFilter<"CustomerLegal"> | string + economic_code?: Prisma.StringWithAggregatesFilter<"CustomerLegal"> | string + registration_number?: Prisma.StringWithAggregatesFilter<"CustomerLegal"> | string + postal_code?: Prisma.StringWithAggregatesFilter<"CustomerLegal"> | string + complex_id?: Prisma.StringWithAggregatesFilter<"CustomerLegal"> | string +} + +export type CustomerLegalCreateInput = { + company_name: string + economic_code: string + registration_number: string + postal_code: string + complex_id: string + customer: Prisma.CustomerCreateNestedOneWithoutCustomerLegalsInput +} + +export type CustomerLegalUncheckedCreateInput = { + customer_id: string + company_name: string + economic_code: string + registration_number: string + postal_code: string + complex_id: string +} + +export type CustomerLegalUpdateInput = { + company_name?: Prisma.StringFieldUpdateOperationsInput | string + economic_code?: Prisma.StringFieldUpdateOperationsInput | string + registration_number?: Prisma.StringFieldUpdateOperationsInput | string + postal_code?: Prisma.StringFieldUpdateOperationsInput | string + complex_id?: Prisma.StringFieldUpdateOperationsInput | string + customer?: Prisma.CustomerUpdateOneRequiredWithoutCustomerLegalsNestedInput +} + +export type CustomerLegalUncheckedUpdateInput = { + customer_id?: Prisma.StringFieldUpdateOperationsInput | string + company_name?: Prisma.StringFieldUpdateOperationsInput | string + economic_code?: Prisma.StringFieldUpdateOperationsInput | string + registration_number?: Prisma.StringFieldUpdateOperationsInput | string + postal_code?: Prisma.StringFieldUpdateOperationsInput | string + complex_id?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type CustomerLegalCreateManyInput = { + customer_id: string + company_name: string + economic_code: string + registration_number: string + postal_code: string + complex_id: string +} + +export type CustomerLegalUpdateManyMutationInput = { + company_name?: Prisma.StringFieldUpdateOperationsInput | string + economic_code?: Prisma.StringFieldUpdateOperationsInput | string + registration_number?: Prisma.StringFieldUpdateOperationsInput | string + postal_code?: Prisma.StringFieldUpdateOperationsInput | string + complex_id?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type CustomerLegalUncheckedUpdateManyInput = { + customer_id?: Prisma.StringFieldUpdateOperationsInput | string + company_name?: Prisma.StringFieldUpdateOperationsInput | string + economic_code?: Prisma.StringFieldUpdateOperationsInput | string + registration_number?: Prisma.StringFieldUpdateOperationsInput | string + postal_code?: Prisma.StringFieldUpdateOperationsInput | string + complex_id?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type CustomerLegalNullableScalarRelationFilter = { + is?: Prisma.CustomerLegalWhereInput | null + isNot?: Prisma.CustomerLegalWhereInput | null +} + +export type CustomerLegalOrderByRelevanceInput = { + fields: Prisma.CustomerLegalOrderByRelevanceFieldEnum | Prisma.CustomerLegalOrderByRelevanceFieldEnum[] + sort: Prisma.SortOrder + search: string +} + +export type CustomerLegalComplex_idRegistration_numberCompoundUniqueInput = { + complex_id: string + registration_number: string +} + +export type CustomerLegalCountOrderByAggregateInput = { + customer_id?: Prisma.SortOrder + company_name?: Prisma.SortOrder + economic_code?: Prisma.SortOrder + registration_number?: Prisma.SortOrder + postal_code?: Prisma.SortOrder + complex_id?: Prisma.SortOrder +} + +export type CustomerLegalMaxOrderByAggregateInput = { + customer_id?: Prisma.SortOrder + company_name?: Prisma.SortOrder + economic_code?: Prisma.SortOrder + registration_number?: Prisma.SortOrder + postal_code?: Prisma.SortOrder + complex_id?: Prisma.SortOrder +} + +export type CustomerLegalMinOrderByAggregateInput = { + customer_id?: Prisma.SortOrder + company_name?: Prisma.SortOrder + economic_code?: Prisma.SortOrder + registration_number?: Prisma.SortOrder + postal_code?: Prisma.SortOrder + complex_id?: Prisma.SortOrder +} + +export type CustomerLegalCreateNestedOneWithoutCustomerInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerLegalCreateOrConnectWithoutCustomerInput + connect?: Prisma.CustomerLegalWhereUniqueInput +} + +export type CustomerLegalUncheckedCreateNestedOneWithoutCustomerInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerLegalCreateOrConnectWithoutCustomerInput + connect?: Prisma.CustomerLegalWhereUniqueInput +} + +export type CustomerLegalUpdateOneWithoutCustomerNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerLegalCreateOrConnectWithoutCustomerInput + upsert?: Prisma.CustomerLegalUpsertWithoutCustomerInput + disconnect?: Prisma.CustomerLegalWhereInput | boolean + delete?: Prisma.CustomerLegalWhereInput | boolean + connect?: Prisma.CustomerLegalWhereUniqueInput + update?: Prisma.XOR, Prisma.CustomerLegalUncheckedUpdateWithoutCustomerInput> +} + +export type CustomerLegalUncheckedUpdateOneWithoutCustomerNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.CustomerLegalCreateOrConnectWithoutCustomerInput + upsert?: Prisma.CustomerLegalUpsertWithoutCustomerInput + disconnect?: Prisma.CustomerLegalWhereInput | boolean + delete?: Prisma.CustomerLegalWhereInput | boolean + connect?: Prisma.CustomerLegalWhereUniqueInput + update?: Prisma.XOR, Prisma.CustomerLegalUncheckedUpdateWithoutCustomerInput> +} + +export type CustomerLegalCreateWithoutCustomerInput = { + company_name: string + economic_code: string + registration_number: string + postal_code: string + complex_id: string +} + +export type CustomerLegalUncheckedCreateWithoutCustomerInput = { + company_name: string + economic_code: string + registration_number: string + postal_code: string + complex_id: string +} + +export type CustomerLegalCreateOrConnectWithoutCustomerInput = { + where: Prisma.CustomerLegalWhereUniqueInput + create: Prisma.XOR +} + +export type CustomerLegalUpsertWithoutCustomerInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.CustomerLegalWhereInput +} + +export type CustomerLegalUpdateToOneWithWhereWithoutCustomerInput = { + where?: Prisma.CustomerLegalWhereInput + data: Prisma.XOR +} + +export type CustomerLegalUpdateWithoutCustomerInput = { + company_name?: Prisma.StringFieldUpdateOperationsInput | string + economic_code?: Prisma.StringFieldUpdateOperationsInput | string + registration_number?: Prisma.StringFieldUpdateOperationsInput | string + postal_code?: Prisma.StringFieldUpdateOperationsInput | string + complex_id?: Prisma.StringFieldUpdateOperationsInput | string +} + +export type CustomerLegalUncheckedUpdateWithoutCustomerInput = { + company_name?: Prisma.StringFieldUpdateOperationsInput | string + economic_code?: Prisma.StringFieldUpdateOperationsInput | string + registration_number?: Prisma.StringFieldUpdateOperationsInput | string + postal_code?: Prisma.StringFieldUpdateOperationsInput | string + complex_id?: Prisma.StringFieldUpdateOperationsInput | string +} + + + +export type CustomerLegalSelect = runtime.Types.Extensions.GetSelect<{ + customer_id?: boolean + company_name?: boolean + economic_code?: boolean + registration_number?: boolean + postal_code?: boolean + complex_id?: boolean + customer?: boolean | Prisma.CustomerDefaultArgs +}, ExtArgs["result"]["customerLegal"]> + + + +export type CustomerLegalSelectScalar = { + customer_id?: boolean + company_name?: boolean + economic_code?: boolean + registration_number?: boolean + postal_code?: boolean + complex_id?: boolean +} + +export type CustomerLegalOmit = runtime.Types.Extensions.GetOmit<"customer_id" | "company_name" | "economic_code" | "registration_number" | "postal_code" | "complex_id", ExtArgs["result"]["customerLegal"]> +export type CustomerLegalInclude = { + customer?: boolean | Prisma.CustomerDefaultArgs +} + +export type $CustomerLegalPayload = { + name: "CustomerLegal" + objects: { + customer: Prisma.$CustomerPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + customer_id: string + company_name: string + economic_code: string + registration_number: string + postal_code: string + complex_id: string + }, ExtArgs["result"]["customerLegal"]> + composites: {} +} + +export type CustomerLegalGetPayload = runtime.Types.Result.GetResult + +export type CustomerLegalCountArgs = + Omit & { + select?: CustomerLegalCountAggregateInputType | true + } + +export interface CustomerLegalDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['CustomerLegal'], meta: { name: 'CustomerLegal' } } + /** + * Find zero or one CustomerLegal that matches the filter. + * @param {CustomerLegalFindUniqueArgs} args - Arguments to find a CustomerLegal + * @example + * // Get one CustomerLegal + * const customerLegal = await prisma.customerLegal.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__CustomerLegalClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one CustomerLegal that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {CustomerLegalFindUniqueOrThrowArgs} args - Arguments to find a CustomerLegal + * @example + * // Get one CustomerLegal + * const customerLegal = await prisma.customerLegal.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__CustomerLegalClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first CustomerLegal that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerLegalFindFirstArgs} args - Arguments to find a CustomerLegal + * @example + * // Get one CustomerLegal + * const customerLegal = await prisma.customerLegal.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__CustomerLegalClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first CustomerLegal that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerLegalFindFirstOrThrowArgs} args - Arguments to find a CustomerLegal + * @example + * // Get one CustomerLegal + * const customerLegal = await prisma.customerLegal.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__CustomerLegalClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more CustomerLegals that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerLegalFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all CustomerLegals + * const customerLegals = await prisma.customerLegal.findMany() + * + * // Get first 10 CustomerLegals + * const customerLegals = await prisma.customerLegal.findMany({ take: 10 }) + * + * // Only select the `customer_id` + * const customerLegalWithCustomer_idOnly = await prisma.customerLegal.findMany({ select: { customer_id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a CustomerLegal. + * @param {CustomerLegalCreateArgs} args - Arguments to create a CustomerLegal. + * @example + * // Create one CustomerLegal + * const CustomerLegal = await prisma.customerLegal.create({ + * data: { + * // ... data to create a CustomerLegal + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__CustomerLegalClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many CustomerLegals. + * @param {CustomerLegalCreateManyArgs} args - Arguments to create many CustomerLegals. + * @example + * // Create many CustomerLegals + * const customerLegal = await prisma.customerLegal.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Delete a CustomerLegal. + * @param {CustomerLegalDeleteArgs} args - Arguments to delete one CustomerLegal. + * @example + * // Delete one CustomerLegal + * const CustomerLegal = await prisma.customerLegal.delete({ + * where: { + * // ... filter to delete one CustomerLegal + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__CustomerLegalClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one CustomerLegal. + * @param {CustomerLegalUpdateArgs} args - Arguments to update one CustomerLegal. + * @example + * // Update one CustomerLegal + * const customerLegal = await prisma.customerLegal.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__CustomerLegalClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more CustomerLegals. + * @param {CustomerLegalDeleteManyArgs} args - Arguments to filter CustomerLegals to delete. + * @example + * // Delete a few CustomerLegals + * const { count } = await prisma.customerLegal.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more CustomerLegals. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerLegalUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many CustomerLegals + * const customerLegal = await prisma.customerLegal.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create or update one CustomerLegal. + * @param {CustomerLegalUpsertArgs} args - Arguments to update or create a CustomerLegal. + * @example + * // Update or create a CustomerLegal + * const customerLegal = await prisma.customerLegal.upsert({ + * create: { + * // ... data to create a CustomerLegal + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the CustomerLegal we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__CustomerLegalClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of CustomerLegals. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerLegalCountArgs} args - Arguments to filter CustomerLegals to count. + * @example + * // Count the number of CustomerLegals + * const count = await prisma.customerLegal.count({ + * where: { + * // ... the filter for the CustomerLegals we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a CustomerLegal. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerLegalAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by CustomerLegal. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {CustomerLegalGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends CustomerLegalGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: CustomerLegalGroupByArgs['orderBy'] } + : { orderBy?: CustomerLegalGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetCustomerLegalGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the CustomerLegal model + */ +readonly fields: CustomerLegalFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for CustomerLegal. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__CustomerLegalClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + customer = {}>(args?: Prisma.Subset>): Prisma.Prisma__CustomerClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the CustomerLegal model + */ +export interface CustomerLegalFieldRefs { + readonly customer_id: Prisma.FieldRef<"CustomerLegal", 'String'> + readonly company_name: Prisma.FieldRef<"CustomerLegal", 'String'> + readonly economic_code: Prisma.FieldRef<"CustomerLegal", 'String'> + readonly registration_number: Prisma.FieldRef<"CustomerLegal", 'String'> + readonly postal_code: Prisma.FieldRef<"CustomerLegal", 'String'> + readonly complex_id: Prisma.FieldRef<"CustomerLegal", 'String'> +} + + +// Custom InputTypes +/** + * CustomerLegal findUnique + */ +export type CustomerLegalFindUniqueArgs = { + /** + * Select specific fields to fetch from the CustomerLegal + */ + select?: Prisma.CustomerLegalSelect | null + /** + * Omit specific fields from the CustomerLegal + */ + omit?: Prisma.CustomerLegalOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerLegalInclude | null + /** + * Filter, which CustomerLegal to fetch. + */ + where: Prisma.CustomerLegalWhereUniqueInput +} + +/** + * CustomerLegal findUniqueOrThrow + */ +export type CustomerLegalFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the CustomerLegal + */ + select?: Prisma.CustomerLegalSelect | null + /** + * Omit specific fields from the CustomerLegal + */ + omit?: Prisma.CustomerLegalOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerLegalInclude | null + /** + * Filter, which CustomerLegal to fetch. + */ + where: Prisma.CustomerLegalWhereUniqueInput +} + +/** + * CustomerLegal findFirst + */ +export type CustomerLegalFindFirstArgs = { + /** + * Select specific fields to fetch from the CustomerLegal + */ + select?: Prisma.CustomerLegalSelect | null + /** + * Omit specific fields from the CustomerLegal + */ + omit?: Prisma.CustomerLegalOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerLegalInclude | null + /** + * Filter, which CustomerLegal to fetch. + */ + where?: Prisma.CustomerLegalWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of CustomerLegals to fetch. + */ + orderBy?: Prisma.CustomerLegalOrderByWithRelationInput | Prisma.CustomerLegalOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for CustomerLegals. + */ + cursor?: Prisma.CustomerLegalWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` CustomerLegals from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` CustomerLegals. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of CustomerLegals. + */ + distinct?: Prisma.CustomerLegalScalarFieldEnum | Prisma.CustomerLegalScalarFieldEnum[] +} + +/** + * CustomerLegal findFirstOrThrow + */ +export type CustomerLegalFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the CustomerLegal + */ + select?: Prisma.CustomerLegalSelect | null + /** + * Omit specific fields from the CustomerLegal + */ + omit?: Prisma.CustomerLegalOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerLegalInclude | null + /** + * Filter, which CustomerLegal to fetch. + */ + where?: Prisma.CustomerLegalWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of CustomerLegals to fetch. + */ + orderBy?: Prisma.CustomerLegalOrderByWithRelationInput | Prisma.CustomerLegalOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for CustomerLegals. + */ + cursor?: Prisma.CustomerLegalWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` CustomerLegals from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` CustomerLegals. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of CustomerLegals. + */ + distinct?: Prisma.CustomerLegalScalarFieldEnum | Prisma.CustomerLegalScalarFieldEnum[] +} + +/** + * CustomerLegal findMany + */ +export type CustomerLegalFindManyArgs = { + /** + * Select specific fields to fetch from the CustomerLegal + */ + select?: Prisma.CustomerLegalSelect | null + /** + * Omit specific fields from the CustomerLegal + */ + omit?: Prisma.CustomerLegalOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerLegalInclude | null + /** + * Filter, which CustomerLegals to fetch. + */ + where?: Prisma.CustomerLegalWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of CustomerLegals to fetch. + */ + orderBy?: Prisma.CustomerLegalOrderByWithRelationInput | Prisma.CustomerLegalOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing CustomerLegals. + */ + cursor?: Prisma.CustomerLegalWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` CustomerLegals from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` CustomerLegals. + */ + skip?: number + distinct?: Prisma.CustomerLegalScalarFieldEnum | Prisma.CustomerLegalScalarFieldEnum[] +} + +/** + * CustomerLegal create + */ +export type CustomerLegalCreateArgs = { + /** + * Select specific fields to fetch from the CustomerLegal + */ + select?: Prisma.CustomerLegalSelect | null + /** + * Omit specific fields from the CustomerLegal + */ + omit?: Prisma.CustomerLegalOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerLegalInclude | null + /** + * The data needed to create a CustomerLegal. + */ + data: Prisma.XOR +} + +/** + * CustomerLegal createMany + */ +export type CustomerLegalCreateManyArgs = { + /** + * The data used to create many CustomerLegals. + */ + data: Prisma.CustomerLegalCreateManyInput | Prisma.CustomerLegalCreateManyInput[] + skipDuplicates?: boolean +} + +/** + * CustomerLegal update + */ +export type CustomerLegalUpdateArgs = { + /** + * Select specific fields to fetch from the CustomerLegal + */ + select?: Prisma.CustomerLegalSelect | null + /** + * Omit specific fields from the CustomerLegal + */ + omit?: Prisma.CustomerLegalOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerLegalInclude | null + /** + * The data needed to update a CustomerLegal. + */ + data: Prisma.XOR + /** + * Choose, which CustomerLegal to update. + */ + where: Prisma.CustomerLegalWhereUniqueInput +} + +/** + * CustomerLegal updateMany + */ +export type CustomerLegalUpdateManyArgs = { + /** + * The data used to update CustomerLegals. + */ + data: Prisma.XOR + /** + * Filter which CustomerLegals to update + */ + where?: Prisma.CustomerLegalWhereInput + /** + * Limit how many CustomerLegals to update. + */ + limit?: number +} + +/** + * CustomerLegal upsert + */ +export type CustomerLegalUpsertArgs = { + /** + * Select specific fields to fetch from the CustomerLegal + */ + select?: Prisma.CustomerLegalSelect | null + /** + * Omit specific fields from the CustomerLegal + */ + omit?: Prisma.CustomerLegalOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerLegalInclude | null + /** + * The filter to search for the CustomerLegal to update in case it exists. + */ + where: Prisma.CustomerLegalWhereUniqueInput + /** + * In case the CustomerLegal found by the `where` argument doesn't exist, create a new CustomerLegal with this data. + */ + create: Prisma.XOR + /** + * In case the CustomerLegal was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * CustomerLegal delete + */ +export type CustomerLegalDeleteArgs = { + /** + * Select specific fields to fetch from the CustomerLegal + */ + select?: Prisma.CustomerLegalSelect | null + /** + * Omit specific fields from the CustomerLegal + */ + omit?: Prisma.CustomerLegalOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerLegalInclude | null + /** + * Filter which CustomerLegal to delete. + */ + where: Prisma.CustomerLegalWhereUniqueInput +} + +/** + * CustomerLegal deleteMany + */ +export type CustomerLegalDeleteManyArgs = { + /** + * Filter which CustomerLegals to delete + */ + where?: Prisma.CustomerLegalWhereInput + /** + * Limit how many CustomerLegals to delete. + */ + limit?: number +} + +/** + * CustomerLegal without action + */ +export type CustomerLegalDefaultArgs = { + /** + * Select specific fields to fetch from the CustomerLegal + */ + select?: Prisma.CustomerLegalSelect | null + /** + * Omit specific fields from the CustomerLegal + */ + omit?: Prisma.CustomerLegalOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.CustomerLegalInclude | null +} diff --git a/src/generated/prisma/models/SalesInvoice.ts b/src/generated/prisma/models/SalesInvoice.ts index 38934be..1f780ee 100644 --- a/src/generated/prisma/models/SalesInvoice.ts +++ b/src/generated/prisma/models/SalesInvoice.ts @@ -38,7 +38,8 @@ export type SalesInvoiceMinAggregateOutputType = { id: string | null code: string | null total_amount: runtime.Decimal | null - description: string | null + notes: string | null + invoice_date: Date | null created_at: Date | null updated_at: Date | null customer_id: string | null @@ -50,7 +51,8 @@ export type SalesInvoiceMaxAggregateOutputType = { id: string | null code: string | null total_amount: runtime.Decimal | null - description: string | null + notes: string | null + invoice_date: Date | null created_at: Date | null updated_at: Date | null customer_id: string | null @@ -62,7 +64,9 @@ export type SalesInvoiceCountAggregateOutputType = { id: number code: number total_amount: number - description: number + notes: number + unknown_customer: number + invoice_date: number created_at: number updated_at: number customer_id: number @@ -84,7 +88,8 @@ export type SalesInvoiceMinAggregateInputType = { id?: true code?: true total_amount?: true - description?: true + notes?: true + invoice_date?: true created_at?: true updated_at?: true customer_id?: true @@ -96,7 +101,8 @@ export type SalesInvoiceMaxAggregateInputType = { id?: true code?: true total_amount?: true - description?: true + notes?: true + invoice_date?: true created_at?: true updated_at?: true customer_id?: true @@ -108,7 +114,9 @@ export type SalesInvoiceCountAggregateInputType = { id?: true code?: true total_amount?: true - description?: true + notes?: true + unknown_customer?: true + invoice_date?: true created_at?: true updated_at?: true customer_id?: true @@ -207,7 +215,9 @@ export type SalesInvoiceGroupByOutputType = { id: string code: string total_amount: runtime.Decimal - description: string | null + notes: string | null + unknown_customer: runtime.JsonValue | null + invoice_date: Date | null created_at: Date updated_at: Date customer_id: string | null @@ -242,7 +252,9 @@ export type SalesInvoiceWhereInput = { id?: Prisma.StringFilter<"SalesInvoice"> | string code?: Prisma.StringFilter<"SalesInvoice"> | string total_amount?: Prisma.DecimalFilter<"SalesInvoice"> | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.StringNullableFilter<"SalesInvoice"> | string | null + notes?: Prisma.StringNullableFilter<"SalesInvoice"> | string | null + unknown_customer?: Prisma.JsonNullableFilter<"SalesInvoice"> + invoice_date?: Prisma.DateTimeNullableFilter<"SalesInvoice"> | Date | string | null created_at?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string updated_at?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string customer_id?: Prisma.StringNullableFilter<"SalesInvoice"> | string | null @@ -250,14 +262,16 @@ export type SalesInvoiceWhereInput = { complex_id?: Prisma.StringFilter<"SalesInvoice"> | string customer?: Prisma.XOR | null items?: Prisma.SalesInvoiceItemListRelationFilter - sales_invoice_payments?: Prisma.SalesInvoicePaymentListRelationFilter + payments?: Prisma.SalesInvoicePaymentListRelationFilter } export type SalesInvoiceOrderByWithRelationInput = { id?: Prisma.SortOrder code?: Prisma.SortOrder total_amount?: Prisma.SortOrder - description?: Prisma.SortOrderInput | Prisma.SortOrder + notes?: Prisma.SortOrderInput | Prisma.SortOrder + unknown_customer?: Prisma.SortOrderInput | Prisma.SortOrder + invoice_date?: Prisma.SortOrderInput | Prisma.SortOrder created_at?: Prisma.SortOrder updated_at?: Prisma.SortOrder customer_id?: Prisma.SortOrderInput | Prisma.SortOrder @@ -265,7 +279,7 @@ export type SalesInvoiceOrderByWithRelationInput = { complex_id?: Prisma.SortOrder customer?: Prisma.CustomerOrderByWithRelationInput items?: Prisma.SalesInvoiceItemOrderByRelationAggregateInput - sales_invoice_payments?: Prisma.SalesInvoicePaymentOrderByRelationAggregateInput + payments?: Prisma.SalesInvoicePaymentOrderByRelationAggregateInput _relevance?: Prisma.SalesInvoiceOrderByRelevanceInput } @@ -276,7 +290,9 @@ export type SalesInvoiceWhereUniqueInput = Prisma.AtLeast<{ OR?: Prisma.SalesInvoiceWhereInput[] NOT?: Prisma.SalesInvoiceWhereInput | Prisma.SalesInvoiceWhereInput[] total_amount?: Prisma.DecimalFilter<"SalesInvoice"> | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.StringNullableFilter<"SalesInvoice"> | string | null + notes?: Prisma.StringNullableFilter<"SalesInvoice"> | string | null + unknown_customer?: Prisma.JsonNullableFilter<"SalesInvoice"> + invoice_date?: Prisma.DateTimeNullableFilter<"SalesInvoice"> | Date | string | null created_at?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string updated_at?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string customer_id?: Prisma.StringNullableFilter<"SalesInvoice"> | string | null @@ -284,14 +300,16 @@ export type SalesInvoiceWhereUniqueInput = Prisma.AtLeast<{ complex_id?: Prisma.StringFilter<"SalesInvoice"> | string customer?: Prisma.XOR | null items?: Prisma.SalesInvoiceItemListRelationFilter - sales_invoice_payments?: Prisma.SalesInvoicePaymentListRelationFilter + payments?: Prisma.SalesInvoicePaymentListRelationFilter }, "id" | "code"> export type SalesInvoiceOrderByWithAggregationInput = { id?: Prisma.SortOrder code?: Prisma.SortOrder total_amount?: Prisma.SortOrder - description?: Prisma.SortOrderInput | Prisma.SortOrder + notes?: Prisma.SortOrderInput | Prisma.SortOrder + unknown_customer?: Prisma.SortOrderInput | Prisma.SortOrder + invoice_date?: Prisma.SortOrderInput | Prisma.SortOrder created_at?: Prisma.SortOrder updated_at?: Prisma.SortOrder customer_id?: Prisma.SortOrderInput | Prisma.SortOrder @@ -311,7 +329,9 @@ export type SalesInvoiceScalarWhereWithAggregatesInput = { id?: Prisma.StringWithAggregatesFilter<"SalesInvoice"> | string code?: Prisma.StringWithAggregatesFilter<"SalesInvoice"> | string total_amount?: Prisma.DecimalWithAggregatesFilter<"SalesInvoice"> | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.StringNullableWithAggregatesFilter<"SalesInvoice"> | string | null + notes?: Prisma.StringNullableWithAggregatesFilter<"SalesInvoice"> | string | null + unknown_customer?: Prisma.JsonNullableWithAggregatesFilter<"SalesInvoice"> + invoice_date?: Prisma.DateTimeNullableWithAggregatesFilter<"SalesInvoice"> | Date | string | null created_at?: Prisma.DateTimeWithAggregatesFilter<"SalesInvoice"> | Date | string updated_at?: Prisma.DateTimeWithAggregatesFilter<"SalesInvoice"> | Date | string customer_id?: Prisma.StringNullableWithAggregatesFilter<"SalesInvoice"> | string | null @@ -323,63 +343,73 @@ export type SalesInvoiceCreateInput = { id?: string code: string total_amount: runtime.Decimal | runtime.DecimalJsLike | number | string - description?: string | null + notes?: string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Date | string | null created_at?: Date | string updated_at?: Date | string account_id: string complex_id: string customer?: Prisma.CustomerCreateNestedOneWithoutSales_invoicesInput items?: Prisma.SalesInvoiceItemCreateNestedManyWithoutInvoiceInput - sales_invoice_payments?: Prisma.SalesInvoicePaymentCreateNestedManyWithoutInvoiceInput + payments?: Prisma.SalesInvoicePaymentCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceUncheckedCreateInput = { id?: string code: string total_amount: runtime.Decimal | runtime.DecimalJsLike | number | string - description?: string | null + notes?: string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Date | string | null created_at?: Date | string updated_at?: Date | string customer_id?: string | null account_id: string complex_id: string items?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutInvoiceInput - sales_invoice_payments?: Prisma.SalesInvoicePaymentUncheckedCreateNestedManyWithoutInvoiceInput + payments?: Prisma.SalesInvoicePaymentUncheckedCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceUpdateInput = { id?: Prisma.StringFieldUpdateOperationsInput | string code?: Prisma.StringFieldUpdateOperationsInput | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string account_id?: Prisma.StringFieldUpdateOperationsInput | string complex_id?: Prisma.StringFieldUpdateOperationsInput | string customer?: Prisma.CustomerUpdateOneWithoutSales_invoicesNestedInput items?: Prisma.SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput - sales_invoice_payments?: Prisma.SalesInvoicePaymentUpdateManyWithoutInvoiceNestedInput + payments?: Prisma.SalesInvoicePaymentUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceUncheckedUpdateInput = { id?: Prisma.StringFieldUpdateOperationsInput | string code?: Prisma.StringFieldUpdateOperationsInput | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string customer_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null account_id?: Prisma.StringFieldUpdateOperationsInput | string complex_id?: Prisma.StringFieldUpdateOperationsInput | string items?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceNestedInput - sales_invoice_payments?: Prisma.SalesInvoicePaymentUncheckedUpdateManyWithoutInvoiceNestedInput + payments?: Prisma.SalesInvoicePaymentUncheckedUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceCreateManyInput = { id?: string code: string total_amount: runtime.Decimal | runtime.DecimalJsLike | number | string - description?: string | null + notes?: string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Date | string | null created_at?: Date | string updated_at?: Date | string customer_id?: string | null @@ -391,7 +421,9 @@ export type SalesInvoiceUpdateManyMutationInput = { id?: Prisma.StringFieldUpdateOperationsInput | string code?: Prisma.StringFieldUpdateOperationsInput | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string account_id?: Prisma.StringFieldUpdateOperationsInput | string @@ -402,7 +434,9 @@ export type SalesInvoiceUncheckedUpdateManyInput = { id?: Prisma.StringFieldUpdateOperationsInput | string code?: Prisma.StringFieldUpdateOperationsInput | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string customer_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null @@ -430,7 +464,9 @@ export type SalesInvoiceCountOrderByAggregateInput = { id?: Prisma.SortOrder code?: Prisma.SortOrder total_amount?: Prisma.SortOrder - description?: Prisma.SortOrder + notes?: Prisma.SortOrder + unknown_customer?: Prisma.SortOrder + invoice_date?: Prisma.SortOrder created_at?: Prisma.SortOrder updated_at?: Prisma.SortOrder customer_id?: Prisma.SortOrder @@ -446,7 +482,8 @@ export type SalesInvoiceMaxOrderByAggregateInput = { id?: Prisma.SortOrder code?: Prisma.SortOrder total_amount?: Prisma.SortOrder - description?: Prisma.SortOrder + notes?: Prisma.SortOrder + invoice_date?: Prisma.SortOrder created_at?: Prisma.SortOrder updated_at?: Prisma.SortOrder customer_id?: Prisma.SortOrder @@ -458,7 +495,8 @@ export type SalesInvoiceMinOrderByAggregateInput = { id?: Prisma.SortOrder code?: Prisma.SortOrder total_amount?: Prisma.SortOrder - description?: Prisma.SortOrder + notes?: Prisma.SortOrder + invoice_date?: Prisma.SortOrder created_at?: Prisma.SortOrder updated_at?: Prisma.SortOrder customer_id?: Prisma.SortOrder @@ -531,44 +569,48 @@ export type SalesInvoiceUpdateOneRequiredWithoutItemsNestedInput = { update?: Prisma.XOR, Prisma.SalesInvoiceUncheckedUpdateWithoutItemsInput> } -export type SalesInvoiceCreateNestedOneWithoutSales_invoice_paymentsInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutSales_invoice_paymentsInput +export type SalesInvoiceCreateNestedOneWithoutPaymentsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutPaymentsInput connect?: Prisma.SalesInvoiceWhereUniqueInput } -export type SalesInvoiceUpdateOneRequiredWithoutSales_invoice_paymentsNestedInput = { - create?: Prisma.XOR - connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutSales_invoice_paymentsInput - upsert?: Prisma.SalesInvoiceUpsertWithoutSales_invoice_paymentsInput +export type SalesInvoiceUpdateOneRequiredWithoutPaymentsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutPaymentsInput + upsert?: Prisma.SalesInvoiceUpsertWithoutPaymentsInput connect?: Prisma.SalesInvoiceWhereUniqueInput - update?: Prisma.XOR, Prisma.SalesInvoiceUncheckedUpdateWithoutSales_invoice_paymentsInput> + update?: Prisma.XOR, Prisma.SalesInvoiceUncheckedUpdateWithoutPaymentsInput> } export type SalesInvoiceCreateWithoutCustomerInput = { id?: string code: string total_amount: runtime.Decimal | runtime.DecimalJsLike | number | string - description?: string | null + notes?: string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Date | string | null created_at?: Date | string updated_at?: Date | string account_id: string complex_id: string items?: Prisma.SalesInvoiceItemCreateNestedManyWithoutInvoiceInput - sales_invoice_payments?: Prisma.SalesInvoicePaymentCreateNestedManyWithoutInvoiceInput + payments?: Prisma.SalesInvoicePaymentCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceUncheckedCreateWithoutCustomerInput = { id?: string code: string total_amount: runtime.Decimal | runtime.DecimalJsLike | number | string - description?: string | null + notes?: string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Date | string | null created_at?: Date | string updated_at?: Date | string account_id: string complex_id: string items?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutInvoiceInput - sales_invoice_payments?: Prisma.SalesInvoicePaymentUncheckedCreateNestedManyWithoutInvoiceInput + payments?: Prisma.SalesInvoicePaymentUncheckedCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceCreateOrConnectWithoutCustomerInput = { @@ -604,7 +646,9 @@ export type SalesInvoiceScalarWhereInput = { id?: Prisma.StringFilter<"SalesInvoice"> | string code?: Prisma.StringFilter<"SalesInvoice"> | string total_amount?: Prisma.DecimalFilter<"SalesInvoice"> | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.StringNullableFilter<"SalesInvoice"> | string | null + notes?: Prisma.StringNullableFilter<"SalesInvoice"> | string | null + unknown_customer?: Prisma.JsonNullableFilter<"SalesInvoice"> + invoice_date?: Prisma.DateTimeNullableFilter<"SalesInvoice"> | Date | string | null created_at?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string updated_at?: Prisma.DateTimeFilter<"SalesInvoice"> | Date | string customer_id?: Prisma.StringNullableFilter<"SalesInvoice"> | string | null @@ -616,26 +660,30 @@ export type SalesInvoiceCreateWithoutItemsInput = { id?: string code: string total_amount: runtime.Decimal | runtime.DecimalJsLike | number | string - description?: string | null + notes?: string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Date | string | null created_at?: Date | string updated_at?: Date | string account_id: string complex_id: string customer?: Prisma.CustomerCreateNestedOneWithoutSales_invoicesInput - sales_invoice_payments?: Prisma.SalesInvoicePaymentCreateNestedManyWithoutInvoiceInput + payments?: Prisma.SalesInvoicePaymentCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceUncheckedCreateWithoutItemsInput = { id?: string code: string total_amount: runtime.Decimal | runtime.DecimalJsLike | number | string - description?: string | null + notes?: string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Date | string | null created_at?: Date | string updated_at?: Date | string customer_id?: string | null account_id: string complex_id: string - sales_invoice_payments?: Prisma.SalesInvoicePaymentUncheckedCreateNestedManyWithoutInvoiceInput + payments?: Prisma.SalesInvoicePaymentUncheckedCreateNestedManyWithoutInvoiceInput } export type SalesInvoiceCreateOrConnectWithoutItemsInput = { @@ -658,33 +706,39 @@ export type SalesInvoiceUpdateWithoutItemsInput = { id?: Prisma.StringFieldUpdateOperationsInput | string code?: Prisma.StringFieldUpdateOperationsInput | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string account_id?: Prisma.StringFieldUpdateOperationsInput | string complex_id?: Prisma.StringFieldUpdateOperationsInput | string customer?: Prisma.CustomerUpdateOneWithoutSales_invoicesNestedInput - sales_invoice_payments?: Prisma.SalesInvoicePaymentUpdateManyWithoutInvoiceNestedInput + payments?: Prisma.SalesInvoicePaymentUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceUncheckedUpdateWithoutItemsInput = { id?: Prisma.StringFieldUpdateOperationsInput | string code?: Prisma.StringFieldUpdateOperationsInput | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string customer_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null account_id?: Prisma.StringFieldUpdateOperationsInput | string complex_id?: Prisma.StringFieldUpdateOperationsInput | string - sales_invoice_payments?: Prisma.SalesInvoicePaymentUncheckedUpdateManyWithoutInvoiceNestedInput + payments?: Prisma.SalesInvoicePaymentUncheckedUpdateManyWithoutInvoiceNestedInput } -export type SalesInvoiceCreateWithoutSales_invoice_paymentsInput = { +export type SalesInvoiceCreateWithoutPaymentsInput = { id?: string code: string total_amount: runtime.Decimal | runtime.DecimalJsLike | number | string - description?: string | null + notes?: string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Date | string | null created_at?: Date | string updated_at?: Date | string account_id: string @@ -693,11 +747,13 @@ export type SalesInvoiceCreateWithoutSales_invoice_paymentsInput = { items?: Prisma.SalesInvoiceItemCreateNestedManyWithoutInvoiceInput } -export type SalesInvoiceUncheckedCreateWithoutSales_invoice_paymentsInput = { +export type SalesInvoiceUncheckedCreateWithoutPaymentsInput = { id?: string code: string total_amount: runtime.Decimal | runtime.DecimalJsLike | number | string - description?: string | null + notes?: string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Date | string | null created_at?: Date | string updated_at?: Date | string customer_id?: string | null @@ -706,27 +762,29 @@ export type SalesInvoiceUncheckedCreateWithoutSales_invoice_paymentsInput = { items?: Prisma.SalesInvoiceItemUncheckedCreateNestedManyWithoutInvoiceInput } -export type SalesInvoiceCreateOrConnectWithoutSales_invoice_paymentsInput = { +export type SalesInvoiceCreateOrConnectWithoutPaymentsInput = { where: Prisma.SalesInvoiceWhereUniqueInput - create: Prisma.XOR + create: Prisma.XOR } -export type SalesInvoiceUpsertWithoutSales_invoice_paymentsInput = { - update: Prisma.XOR - create: Prisma.XOR +export type SalesInvoiceUpsertWithoutPaymentsInput = { + update: Prisma.XOR + create: Prisma.XOR where?: Prisma.SalesInvoiceWhereInput } -export type SalesInvoiceUpdateToOneWithWhereWithoutSales_invoice_paymentsInput = { +export type SalesInvoiceUpdateToOneWithWhereWithoutPaymentsInput = { where?: Prisma.SalesInvoiceWhereInput - data: Prisma.XOR + data: Prisma.XOR } -export type SalesInvoiceUpdateWithoutSales_invoice_paymentsInput = { +export type SalesInvoiceUpdateWithoutPaymentsInput = { id?: Prisma.StringFieldUpdateOperationsInput | string code?: Prisma.StringFieldUpdateOperationsInput | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string account_id?: Prisma.StringFieldUpdateOperationsInput | string @@ -735,11 +793,13 @@ export type SalesInvoiceUpdateWithoutSales_invoice_paymentsInput = { items?: Prisma.SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput } -export type SalesInvoiceUncheckedUpdateWithoutSales_invoice_paymentsInput = { +export type SalesInvoiceUncheckedUpdateWithoutPaymentsInput = { id?: Prisma.StringFieldUpdateOperationsInput | string code?: Prisma.StringFieldUpdateOperationsInput | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string customer_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null @@ -752,7 +812,9 @@ export type SalesInvoiceCreateManyCustomerInput = { id?: string code: string total_amount: runtime.Decimal | runtime.DecimalJsLike | number | string - description?: string | null + notes?: string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Date | string | null created_at?: Date | string updated_at?: Date | string account_id: string @@ -763,33 +825,39 @@ export type SalesInvoiceUpdateWithoutCustomerInput = { id?: Prisma.StringFieldUpdateOperationsInput | string code?: Prisma.StringFieldUpdateOperationsInput | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string account_id?: Prisma.StringFieldUpdateOperationsInput | string complex_id?: Prisma.StringFieldUpdateOperationsInput | string items?: Prisma.SalesInvoiceItemUpdateManyWithoutInvoiceNestedInput - sales_invoice_payments?: Prisma.SalesInvoicePaymentUpdateManyWithoutInvoiceNestedInput + payments?: Prisma.SalesInvoicePaymentUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceUncheckedUpdateWithoutCustomerInput = { id?: Prisma.StringFieldUpdateOperationsInput | string code?: Prisma.StringFieldUpdateOperationsInput | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string account_id?: Prisma.StringFieldUpdateOperationsInput | string complex_id?: Prisma.StringFieldUpdateOperationsInput | string items?: Prisma.SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceNestedInput - sales_invoice_payments?: Prisma.SalesInvoicePaymentUncheckedUpdateManyWithoutInvoiceNestedInput + payments?: Prisma.SalesInvoicePaymentUncheckedUpdateManyWithoutInvoiceNestedInput } export type SalesInvoiceUncheckedUpdateManyWithoutCustomerInput = { id?: Prisma.StringFieldUpdateOperationsInput | string code?: Prisma.StringFieldUpdateOperationsInput | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string - description?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + unknown_customer?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue + invoice_date?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string account_id?: Prisma.StringFieldUpdateOperationsInput | string @@ -803,12 +871,12 @@ export type SalesInvoiceUncheckedUpdateManyWithoutCustomerInput = { export type SalesInvoiceCountOutputType = { items: number - sales_invoice_payments: number + payments: number } export type SalesInvoiceCountOutputTypeSelect = { items?: boolean | SalesInvoiceCountOutputTypeCountItemsArgs - sales_invoice_payments?: boolean | SalesInvoiceCountOutputTypeCountSales_invoice_paymentsArgs + payments?: boolean | SalesInvoiceCountOutputTypeCountPaymentsArgs } /** @@ -831,7 +899,7 @@ export type SalesInvoiceCountOutputTypeCountItemsArgs = { +export type SalesInvoiceCountOutputTypeCountPaymentsArgs = { where?: Prisma.SalesInvoicePaymentWhereInput } @@ -840,7 +908,9 @@ export type SalesInvoiceSelect items?: boolean | Prisma.SalesInvoice$itemsArgs - sales_invoice_payments?: boolean | Prisma.SalesInvoice$sales_invoice_paymentsArgs + payments?: boolean | Prisma.SalesInvoice$paymentsArgs _count?: boolean | Prisma.SalesInvoiceCountOutputTypeDefaultArgs }, ExtArgs["result"]["salesInvoice"]> @@ -858,7 +928,9 @@ export type SalesInvoiceSelectScalar = { id?: boolean code?: boolean total_amount?: boolean - description?: boolean + notes?: boolean + unknown_customer?: boolean + invoice_date?: boolean created_at?: boolean updated_at?: boolean customer_id?: boolean @@ -866,11 +938,11 @@ export type SalesInvoiceSelectScalar = { complex_id?: boolean } -export type SalesInvoiceOmit = runtime.Types.Extensions.GetOmit<"id" | "code" | "total_amount" | "description" | "created_at" | "updated_at" | "customer_id" | "account_id" | "complex_id", ExtArgs["result"]["salesInvoice"]> +export type SalesInvoiceOmit = runtime.Types.Extensions.GetOmit<"id" | "code" | "total_amount" | "notes" | "unknown_customer" | "invoice_date" | "created_at" | "updated_at" | "customer_id" | "account_id" | "complex_id", ExtArgs["result"]["salesInvoice"]> export type SalesInvoiceInclude = { customer?: boolean | Prisma.SalesInvoice$customerArgs items?: boolean | Prisma.SalesInvoice$itemsArgs - sales_invoice_payments?: boolean | Prisma.SalesInvoice$sales_invoice_paymentsArgs + payments?: boolean | Prisma.SalesInvoice$paymentsArgs _count?: boolean | Prisma.SalesInvoiceCountOutputTypeDefaultArgs } @@ -879,13 +951,15 @@ export type $SalesInvoicePayload | null items: Prisma.$SalesInvoiceItemPayload[] - sales_invoice_payments: Prisma.$SalesInvoicePaymentPayload[] + payments: Prisma.$SalesInvoicePaymentPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: string code: string total_amount: runtime.Decimal - description: string | null + notes: string | null + unknown_customer: runtime.JsonValue | null + invoice_date: Date | null created_at: Date updated_at: Date customer_id: string | null @@ -1233,7 +1307,7 @@ export interface Prisma__SalesInvoiceClient = {}>(args?: Prisma.Subset>): Prisma.Prisma__CustomerClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> items = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> - sales_invoice_payments = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> + payments = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -1266,7 +1340,9 @@ export interface SalesInvoiceFieldRefs { readonly id: Prisma.FieldRef<"SalesInvoice", 'String'> readonly code: Prisma.FieldRef<"SalesInvoice", 'String'> readonly total_amount: Prisma.FieldRef<"SalesInvoice", 'Decimal'> - readonly description: Prisma.FieldRef<"SalesInvoice", 'String'> + readonly notes: Prisma.FieldRef<"SalesInvoice", 'String'> + readonly unknown_customer: Prisma.FieldRef<"SalesInvoice", 'Json'> + readonly invoice_date: Prisma.FieldRef<"SalesInvoice", 'DateTime'> readonly created_at: Prisma.FieldRef<"SalesInvoice", 'DateTime'> readonly updated_at: Prisma.FieldRef<"SalesInvoice", 'DateTime'> readonly customer_id: Prisma.FieldRef<"SalesInvoice", 'String'> @@ -1658,9 +1734,9 @@ export type SalesInvoice$itemsArgs = { +export type SalesInvoice$paymentsArgs = { /** * Select specific fields to fetch from the SalesInvoicePayment */ diff --git a/src/generated/prisma/models/SalesInvoiceItem.ts b/src/generated/prisma/models/SalesInvoiceItem.ts index 39eac8d..d7c5687 100644 --- a/src/generated/prisma/models/SalesInvoiceItem.ts +++ b/src/generated/prisma/models/SalesInvoiceItem.ts @@ -30,12 +30,14 @@ export type SalesInvoiceItemAvgAggregateOutputType = { quantity: runtime.Decimal | null unit_price: runtime.Decimal | null total_amount: runtime.Decimal | null + discount: runtime.Decimal | null } export type SalesInvoiceItemSumAggregateOutputType = { quantity: runtime.Decimal | null unit_price: runtime.Decimal | null total_amount: runtime.Decimal | null + discount: runtime.Decimal | null } export type SalesInvoiceItemMinAggregateOutputType = { @@ -45,6 +47,9 @@ export type SalesInvoiceItemMinAggregateOutputType = { unit_price: runtime.Decimal | null total_amount: runtime.Decimal | null created_at: Date | null + discount: runtime.Decimal | null + notes: string | null + pricingModel: $Enums.SalesInvoiceItemPricingModel | null invoice_id: string | null good_id: string | null service_id: string | null @@ -57,6 +62,9 @@ export type SalesInvoiceItemMaxAggregateOutputType = { unit_price: runtime.Decimal | null total_amount: runtime.Decimal | null created_at: Date | null + discount: runtime.Decimal | null + notes: string | null + pricingModel: $Enums.SalesInvoiceItemPricingModel | null invoice_id: string | null good_id: string | null service_id: string | null @@ -69,6 +77,9 @@ export type SalesInvoiceItemCountAggregateOutputType = { unit_price: number total_amount: number created_at: number + discount: number + notes: number + pricingModel: number invoice_id: number good_id: number service_id: number @@ -81,12 +92,14 @@ export type SalesInvoiceItemAvgAggregateInputType = { quantity?: true unit_price?: true total_amount?: true + discount?: true } export type SalesInvoiceItemSumAggregateInputType = { quantity?: true unit_price?: true total_amount?: true + discount?: true } export type SalesInvoiceItemMinAggregateInputType = { @@ -96,6 +109,9 @@ export type SalesInvoiceItemMinAggregateInputType = { unit_price?: true total_amount?: true created_at?: true + discount?: true + notes?: true + pricingModel?: true invoice_id?: true good_id?: true service_id?: true @@ -108,6 +124,9 @@ export type SalesInvoiceItemMaxAggregateInputType = { unit_price?: true total_amount?: true created_at?: true + discount?: true + notes?: true + pricingModel?: true invoice_id?: true good_id?: true service_id?: true @@ -120,6 +139,9 @@ export type SalesInvoiceItemCountAggregateInputType = { unit_price?: true total_amount?: true created_at?: true + discount?: true + notes?: true + pricingModel?: true invoice_id?: true good_id?: true service_id?: true @@ -220,6 +242,9 @@ export type SalesInvoiceItemGroupByOutputType = { unit_price: runtime.Decimal total_amount: runtime.Decimal created_at: Date + discount: runtime.Decimal + notes: string | null + pricingModel: $Enums.SalesInvoiceItemPricingModel invoice_id: string good_id: string | null service_id: string | null @@ -256,6 +281,9 @@ export type SalesInvoiceItemWhereInput = { unit_price?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFilter<"SalesInvoiceItem"> | Date | string + discount?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.StringNullableFilter<"SalesInvoiceItem"> | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFilter<"SalesInvoiceItem"> | $Enums.SalesInvoiceItemPricingModel invoice_id?: Prisma.StringFilter<"SalesInvoiceItem"> | string good_id?: Prisma.StringNullableFilter<"SalesInvoiceItem"> | string | null service_id?: Prisma.StringNullableFilter<"SalesInvoiceItem"> | string | null @@ -272,6 +300,9 @@ export type SalesInvoiceItemOrderByWithRelationInput = { unit_price?: Prisma.SortOrder total_amount?: Prisma.SortOrder created_at?: Prisma.SortOrder + discount?: Prisma.SortOrder + notes?: Prisma.SortOrderInput | Prisma.SortOrder + pricingModel?: Prisma.SortOrder invoice_id?: Prisma.SortOrder good_id?: Prisma.SortOrderInput | Prisma.SortOrder service_id?: Prisma.SortOrderInput | Prisma.SortOrder @@ -292,6 +323,9 @@ export type SalesInvoiceItemWhereUniqueInput = Prisma.AtLeast<{ unit_price?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFilter<"SalesInvoiceItem"> | Date | string + discount?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.StringNullableFilter<"SalesInvoiceItem"> | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFilter<"SalesInvoiceItem"> | $Enums.SalesInvoiceItemPricingModel invoice_id?: Prisma.StringFilter<"SalesInvoiceItem"> | string good_id?: Prisma.StringNullableFilter<"SalesInvoiceItem"> | string | null service_id?: Prisma.StringNullableFilter<"SalesInvoiceItem"> | string | null @@ -308,6 +342,9 @@ export type SalesInvoiceItemOrderByWithAggregationInput = { unit_price?: Prisma.SortOrder total_amount?: Prisma.SortOrder created_at?: Prisma.SortOrder + discount?: Prisma.SortOrder + notes?: Prisma.SortOrderInput | Prisma.SortOrder + pricingModel?: Prisma.SortOrder invoice_id?: Prisma.SortOrder good_id?: Prisma.SortOrderInput | Prisma.SortOrder service_id?: Prisma.SortOrderInput | Prisma.SortOrder @@ -329,6 +366,9 @@ export type SalesInvoiceItemScalarWhereWithAggregatesInput = { unit_price?: Prisma.DecimalWithAggregatesFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalWithAggregatesFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeWithAggregatesFilter<"SalesInvoiceItem"> | Date | string + discount?: Prisma.DecimalWithAggregatesFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.StringNullableWithAggregatesFilter<"SalesInvoiceItem"> | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelWithAggregatesFilter<"SalesInvoiceItem"> | $Enums.SalesInvoiceItemPricingModel invoice_id?: Prisma.StringWithAggregatesFilter<"SalesInvoiceItem"> | string good_id?: Prisma.StringNullableWithAggregatesFilter<"SalesInvoiceItem"> | string | null service_id?: Prisma.StringNullableWithAggregatesFilter<"SalesInvoiceItem"> | string | null @@ -342,6 +382,9 @@ export type SalesInvoiceItemCreateInput = { unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Date | string + discount?: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + pricingModel?: $Enums.SalesInvoiceItemPricingModel payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue invoice: Prisma.SalesInvoiceCreateNestedOneWithoutItemsInput good?: Prisma.GoodCreateNestedOneWithoutSales_invoice_itemsInput @@ -355,6 +398,9 @@ export type SalesInvoiceItemUncheckedCreateInput = { unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Date | string + discount?: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + pricingModel?: $Enums.SalesInvoiceItemPricingModel invoice_id: string good_id?: string | null service_id?: string | null @@ -368,6 +414,9 @@ export type SalesInvoiceItemUpdateInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue invoice?: Prisma.SalesInvoiceUpdateOneRequiredWithoutItemsNestedInput good?: Prisma.GoodUpdateOneWithoutSales_invoice_itemsNestedInput @@ -381,6 +430,9 @@ export type SalesInvoiceItemUncheckedUpdateInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel invoice_id?: Prisma.StringFieldUpdateOperationsInput | string good_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null service_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null @@ -394,6 +446,9 @@ export type SalesInvoiceItemCreateManyInput = { unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Date | string + discount?: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + pricingModel?: $Enums.SalesInvoiceItemPricingModel invoice_id: string good_id?: string | null service_id?: string | null @@ -407,6 +462,9 @@ export type SalesInvoiceItemUpdateManyMutationInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue } @@ -417,6 +475,9 @@ export type SalesInvoiceItemUncheckedUpdateManyInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel invoice_id?: Prisma.StringFieldUpdateOperationsInput | string good_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null service_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null @@ -446,6 +507,9 @@ export type SalesInvoiceItemCountOrderByAggregateInput = { unit_price?: Prisma.SortOrder total_amount?: Prisma.SortOrder created_at?: Prisma.SortOrder + discount?: Prisma.SortOrder + notes?: Prisma.SortOrder + pricingModel?: Prisma.SortOrder invoice_id?: Prisma.SortOrder good_id?: Prisma.SortOrder service_id?: Prisma.SortOrder @@ -456,6 +520,7 @@ export type SalesInvoiceItemAvgOrderByAggregateInput = { quantity?: Prisma.SortOrder unit_price?: Prisma.SortOrder total_amount?: Prisma.SortOrder + discount?: Prisma.SortOrder } export type SalesInvoiceItemMaxOrderByAggregateInput = { @@ -465,6 +530,9 @@ export type SalesInvoiceItemMaxOrderByAggregateInput = { unit_price?: Prisma.SortOrder total_amount?: Prisma.SortOrder created_at?: Prisma.SortOrder + discount?: Prisma.SortOrder + notes?: Prisma.SortOrder + pricingModel?: Prisma.SortOrder invoice_id?: Prisma.SortOrder good_id?: Prisma.SortOrder service_id?: Prisma.SortOrder @@ -477,6 +545,9 @@ export type SalesInvoiceItemMinOrderByAggregateInput = { unit_price?: Prisma.SortOrder total_amount?: Prisma.SortOrder created_at?: Prisma.SortOrder + discount?: Prisma.SortOrder + notes?: Prisma.SortOrder + pricingModel?: Prisma.SortOrder invoice_id?: Prisma.SortOrder good_id?: Prisma.SortOrder service_id?: Prisma.SortOrder @@ -486,6 +557,7 @@ export type SalesInvoiceItemSumOrderByAggregateInput = { quantity?: Prisma.SortOrder unit_price?: Prisma.SortOrder total_amount?: Prisma.SortOrder + discount?: Prisma.SortOrder } export type SalesInvoiceItemCreateNestedManyWithoutGoodInput = { @@ -576,6 +648,10 @@ export type EnumUnitTypeFieldUpdateOperationsInput = { set?: $Enums.UnitType } +export type EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput = { + set?: $Enums.SalesInvoiceItemPricingModel +} + export type SalesInvoiceItemCreateNestedManyWithoutServiceInput = { create?: Prisma.XOR | Prisma.SalesInvoiceItemCreateWithoutServiceInput[] | Prisma.SalesInvoiceItemUncheckedCreateWithoutServiceInput[] connectOrCreate?: Prisma.SalesInvoiceItemCreateOrConnectWithoutServiceInput | Prisma.SalesInvoiceItemCreateOrConnectWithoutServiceInput[] @@ -625,6 +701,9 @@ export type SalesInvoiceItemCreateWithoutGoodInput = { unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Date | string + discount?: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + pricingModel?: $Enums.SalesInvoiceItemPricingModel payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue invoice: Prisma.SalesInvoiceCreateNestedOneWithoutItemsInput service?: Prisma.ServiceCreateNestedOneWithoutSales_invoice_itemsInput @@ -637,6 +716,9 @@ export type SalesInvoiceItemUncheckedCreateWithoutGoodInput = { unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Date | string + discount?: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + pricingModel?: $Enums.SalesInvoiceItemPricingModel invoice_id: string service_id?: string | null payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue @@ -678,6 +760,9 @@ export type SalesInvoiceItemScalarWhereInput = { unit_price?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFilter<"SalesInvoiceItem"> | Date | string + discount?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.StringNullableFilter<"SalesInvoiceItem"> | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFilter<"SalesInvoiceItem"> | $Enums.SalesInvoiceItemPricingModel invoice_id?: Prisma.StringFilter<"SalesInvoiceItem"> | string good_id?: Prisma.StringNullableFilter<"SalesInvoiceItem"> | string | null service_id?: Prisma.StringNullableFilter<"SalesInvoiceItem"> | string | null @@ -691,6 +776,9 @@ export type SalesInvoiceItemCreateWithoutInvoiceInput = { unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Date | string + discount?: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + pricingModel?: $Enums.SalesInvoiceItemPricingModel payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue good?: Prisma.GoodCreateNestedOneWithoutSales_invoice_itemsInput service?: Prisma.ServiceCreateNestedOneWithoutSales_invoice_itemsInput @@ -703,6 +791,9 @@ export type SalesInvoiceItemUncheckedCreateWithoutInvoiceInput = { unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Date | string + discount?: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + pricingModel?: $Enums.SalesInvoiceItemPricingModel good_id?: string | null service_id?: string | null payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue @@ -741,6 +832,9 @@ export type SalesInvoiceItemCreateWithoutServiceInput = { unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Date | string + discount?: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + pricingModel?: $Enums.SalesInvoiceItemPricingModel payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue invoice: Prisma.SalesInvoiceCreateNestedOneWithoutItemsInput good?: Prisma.GoodCreateNestedOneWithoutSales_invoice_itemsInput @@ -753,6 +847,9 @@ export type SalesInvoiceItemUncheckedCreateWithoutServiceInput = { unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Date | string + discount?: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + pricingModel?: $Enums.SalesInvoiceItemPricingModel invoice_id: string good_id?: string | null payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue @@ -791,6 +888,9 @@ export type SalesInvoiceItemCreateManyGoodInput = { unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Date | string + discount?: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + pricingModel?: $Enums.SalesInvoiceItemPricingModel invoice_id: string service_id?: string | null payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue @@ -803,6 +903,9 @@ export type SalesInvoiceItemUpdateWithoutGoodInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue invoice?: Prisma.SalesInvoiceUpdateOneRequiredWithoutItemsNestedInput service?: Prisma.ServiceUpdateOneWithoutSales_invoice_itemsNestedInput @@ -815,6 +918,9 @@ export type SalesInvoiceItemUncheckedUpdateWithoutGoodInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel invoice_id?: Prisma.StringFieldUpdateOperationsInput | string service_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue @@ -827,6 +933,9 @@ export type SalesInvoiceItemUncheckedUpdateManyWithoutGoodInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel invoice_id?: Prisma.StringFieldUpdateOperationsInput | string service_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue @@ -839,6 +948,9 @@ export type SalesInvoiceItemCreateManyInvoiceInput = { unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Date | string + discount?: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + pricingModel?: $Enums.SalesInvoiceItemPricingModel good_id?: string | null service_id?: string | null payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue @@ -851,6 +963,9 @@ export type SalesInvoiceItemUpdateWithoutInvoiceInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue good?: Prisma.GoodUpdateOneWithoutSales_invoice_itemsNestedInput service?: Prisma.ServiceUpdateOneWithoutSales_invoice_itemsNestedInput @@ -863,6 +978,9 @@ export type SalesInvoiceItemUncheckedUpdateWithoutInvoiceInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel good_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null service_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue @@ -875,6 +993,9 @@ export type SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel good_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null service_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue @@ -887,6 +1008,9 @@ export type SalesInvoiceItemCreateManyServiceInput = { unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Date | string + discount?: runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: string | null + pricingModel?: $Enums.SalesInvoiceItemPricingModel invoice_id: string good_id?: string | null payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue @@ -899,6 +1023,9 @@ export type SalesInvoiceItemUpdateWithoutServiceInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue invoice?: Prisma.SalesInvoiceUpdateOneRequiredWithoutItemsNestedInput good?: Prisma.GoodUpdateOneWithoutSales_invoice_itemsNestedInput @@ -911,6 +1038,9 @@ export type SalesInvoiceItemUncheckedUpdateWithoutServiceInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel invoice_id?: Prisma.StringFieldUpdateOperationsInput | string good_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue @@ -923,6 +1053,9 @@ export type SalesInvoiceItemUncheckedUpdateManyWithoutServiceInput = { unit_price?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string total_amount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + discount?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string + notes?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + pricingModel?: Prisma.EnumSalesInvoiceItemPricingModelFieldUpdateOperationsInput | $Enums.SalesInvoiceItemPricingModel invoice_id?: Prisma.StringFieldUpdateOperationsInput | string good_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue @@ -937,6 +1070,9 @@ export type SalesInvoiceItemSelect = runtime.Types.Extensions.GetOmit<"id" | "quantity" | "unit_type" | "unit_price" | "total_amount" | "created_at" | "invoice_id" | "good_id" | "service_id" | "payload", ExtArgs["result"]["salesInvoiceItem"]> +export type SalesInvoiceItemOmit = runtime.Types.Extensions.GetOmit<"id" | "quantity" | "unit_type" | "unit_price" | "total_amount" | "created_at" | "discount" | "notes" | "pricingModel" | "invoice_id" | "good_id" | "service_id" | "payload", ExtArgs["result"]["salesInvoiceItem"]> export type SalesInvoiceItemInclude = { invoice?: boolean | Prisma.SalesInvoiceDefaultArgs good?: boolean | Prisma.SalesInvoiceItem$goodArgs @@ -982,6 +1121,9 @@ export type $SalesInvoiceItemPayload readonly total_amount: Prisma.FieldRef<"SalesInvoiceItem", 'Decimal'> readonly created_at: Prisma.FieldRef<"SalesInvoiceItem", 'DateTime'> + readonly discount: Prisma.FieldRef<"SalesInvoiceItem", 'Decimal'> + readonly notes: Prisma.FieldRef<"SalesInvoiceItem", 'String'> + readonly pricingModel: Prisma.FieldRef<"SalesInvoiceItem", 'SalesInvoiceItemPricingModel'> readonly invoice_id: Prisma.FieldRef<"SalesInvoiceItem", 'String'> readonly good_id: Prisma.FieldRef<"SalesInvoiceItem", 'String'> readonly service_id: Prisma.FieldRef<"SalesInvoiceItem", 'String'> diff --git a/src/generated/prisma/models/SalesInvoicePayment.ts b/src/generated/prisma/models/SalesInvoicePayment.ts index 3657a65..a57bbdc 100644 --- a/src/generated/prisma/models/SalesInvoicePayment.ts +++ b/src/generated/prisma/models/SalesInvoicePayment.ts @@ -283,7 +283,7 @@ export type SalesInvoicePaymentCreateInput = { payment_method: $Enums.PaymentMethodType paid_at: Date | string created_at?: Date | string - invoice: Prisma.SalesInvoiceCreateNestedOneWithoutSales_invoice_paymentsInput + invoice: Prisma.SalesInvoiceCreateNestedOneWithoutPaymentsInput } export type SalesInvoicePaymentUncheckedCreateInput = { @@ -301,7 +301,7 @@ export type SalesInvoicePaymentUpdateInput = { payment_method?: Prisma.EnumPaymentMethodTypeFieldUpdateOperationsInput | $Enums.PaymentMethodType paid_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string - invoice?: Prisma.SalesInvoiceUpdateOneRequiredWithoutSales_invoice_paymentsNestedInput + invoice?: Prisma.SalesInvoiceUpdateOneRequiredWithoutPaymentsNestedInput } export type SalesInvoicePaymentUncheckedUpdateInput = { diff --git a/src/modules/customers/dto/create-customer-individual.dto.ts b/src/modules/customers/dto/create-customer-individual.dto.ts new file mode 100644 index 0000000..d5f3754 --- /dev/null +++ b/src/modules/customers/dto/create-customer-individual.dto.ts @@ -0,0 +1,32 @@ +import { ApiProperty } from '@nestjs/swagger' +import { IsBoolean, IsNumber, IsString, MaxLength, MinLength } from 'class-validator' + +export class CreateCustomerIndividualDto { + @IsString() + @ApiProperty({ required: true }) + first_name: string + + @IsString() + @ApiProperty({ required: true }) + last_name: string + + @IsNumber() + @MaxLength(10) + @MinLength(10) + @ApiProperty({ required: true, maxLength: 10, minLength: 10 }) + national_code: number + + @IsNumber() + @MaxLength(10) + @MinLength(10) + @ApiProperty({ required: true, maxLength: 10, minLength: 10 }) + postal_code: number + + @IsBoolean() + @ApiProperty({ required: false, default: false }) + is_favorite: boolean + + @IsNumber() + @ApiProperty({ required: false }) + economic_code: number +} diff --git a/src/modules/customers/dto/create-customer-legal.dto.ts b/src/modules/customers/dto/create-customer-legal.dto.ts new file mode 100644 index 0000000..1464d3a --- /dev/null +++ b/src/modules/customers/dto/create-customer-legal.dto.ts @@ -0,0 +1,22 @@ +import { ApiProperty } from '@nestjs/swagger' +import { IsNumber, IsString, MaxLength, MinLength } from 'class-validator' + +export class CreateCustomerLegalDto { + @IsString() + @ApiProperty({ required: true }) + company_name: string + + @IsString() + @ApiProperty({ required: true }) + economic_code: string + + @IsString() + @ApiProperty({ required: true }) + registration_number: string + + @IsNumber() + @MaxLength(10) + @MinLength(10) + @ApiProperty({ required: true, maxLength: 10, minLength: 10 }) + postal_code: number +} diff --git a/src/modules/sales-invoice-items/dto/create-sales-invoice-item.dto.ts b/src/modules/sales-invoice-items/dto/create-sales-invoice-item.dto.ts index 93cf146..b0cf942 100644 --- a/src/modules/sales-invoice-items/dto/create-sales-invoice-item.dto.ts +++ b/src/modules/sales-invoice-items/dto/create-sales-invoice-item.dto.ts @@ -1,7 +1,7 @@ import { ApiProperty, PartialType } from '@nestjs/swagger' import { IsEnum, IsNumber, IsObject, IsOptional, IsString } from 'class-validator' -import type { SaleInvoicePayload } from '../../../common/interfaces/sale-invoice-payload' -import { UnitType } from '../../../generated/prisma/enums' +import type { SaleInvoiceStandardPayload } from '../../../common/interfaces/sale-invoice-payload' +import { SalesInvoiceItemPricingModel, UnitType } from '../../../generated/prisma/enums' export class CreateSalesInvoiceItemDto { @IsNumber() @@ -34,10 +34,20 @@ export class CreateSalesInvoiceItemDto { @ApiProperty({ enum: Object.values(UnitType) }) unit_type: UnitType + @IsEnum(SalesInvoiceItemPricingModel) + @ApiProperty({ enum: Object.values(SalesInvoiceItemPricingModel) }) + @IsOptional() + pricingModel: SalesInvoiceItemPricingModel + @IsOptional() @IsObject() @ApiProperty({ required: false, default: {} }) - payload?: SaleInvoicePayload + payload?: SaleInvoiceStandardPayload + + @IsOptional() + @IsString() + @ApiProperty({ required: false, default: '' }) + notes: string } export class UpdateSalesInvoiceItemDto extends PartialType(CreateSalesInvoiceItemDto) {} diff --git a/src/modules/sales-invoices/dto/create-sales-invoice.dto.ts b/src/modules/sales-invoices/dto/create-sales-invoice.dto.ts index 5d76495..61427b7 100644 --- a/src/modules/sales-invoices/dto/create-sales-invoice.dto.ts +++ b/src/modules/sales-invoices/dto/create-sales-invoice.dto.ts @@ -1,24 +1,62 @@ import { ApiProperty, PartialType } from '@nestjs/swagger' -import { ArrayMinSize, IsNumber, IsOptional, IsString } from 'class-validator' +import { + ArrayMinSize, + IsDateString, + IsEnum, + IsNumber, + IsObject, + IsOptional, + IsString, +} from 'class-validator' +import type { CustomerIndividual, CustomerLegal } from '../../../generated/prisma/client' +import { CustomerType } from '../../../generated/prisma/enums' import { CreateSalesInvoiceItemDto } from '../../sales-invoice-items/dto/create-sales-invoice-item.dto' export class CreateSalesInvoiceDto { - @IsString() - @ApiProperty() - code: string - @IsNumber() @ApiProperty({ required: true, default: 0 }) total_amount: number + @ApiProperty({ required: true }) + @IsDateString({ strict: true }, { message: 'invoice_date must be a valid ISO-8601 string' }) + invoice_date: Date + + @ApiProperty({ required: true }) + @IsObject() + payments: { + terminal: number + cash: number + set_off: number + } + + @ApiProperty() + @ArrayMinSize(1) + items: CreateSalesInvoiceItemDto[] + + @ApiProperty({ required: false }) + @IsOptional() + @IsString() + notes?: string + + @ApiProperty({ required: true, default: CustomerType.UNKNOWN }) + @IsEnum(CustomerType) + customer_type: CustomerType + @IsOptional() @IsString() @ApiProperty({ required: false }) customer_id?: string - @ApiProperty() - @ArrayMinSize(1) - items: CreateSalesInvoiceItemDto[] + @ApiProperty({ required: false }) + @IsOptional() + @IsObject() + customer?: + | { + first_name: string + last_name: string + } + | CustomerIndividual + | CustomerLegal } export class UpdateSalesInvoiceDto extends PartialType(CreateSalesInvoiceDto) {} diff --git a/src/modules/sales-invoices/sales-invoices.controller.ts b/src/modules/sales-invoices/sales-invoices.controller.ts index cb9c8fe..4e2c8ca 100644 --- a/src/modules/sales-invoices/sales-invoices.controller.ts +++ b/src/modules/sales-invoices/sales-invoices.controller.ts @@ -1,4 +1,6 @@ import { Body, Controller, Get, Param, Post } from '@nestjs/common' +import { reqTokenPayload } from '../auth/current-user.decorator' +import { CreateSalesInvoiceDto } from './dto/create-sales-invoice.dto' import { SalesInvoicesService } from './sales-invoices.service' @Controller('sales_invoices') @@ -16,7 +18,7 @@ export class SalesInvoicesController { } @Post() - create(@Body() data: any) { - return this.salesInvoicesService.create(data) + create(@Body() data: CreateSalesInvoiceDto, @reqTokenPayload() account) { + return this.salesInvoicesService.create(data, account) } } diff --git a/src/modules/sales-invoices/sales-invoices.service.ts b/src/modules/sales-invoices/sales-invoices.service.ts index 4b54b25..5b0db8d 100644 --- a/src/modules/sales-invoices/sales-invoices.service.ts +++ b/src/modules/sales-invoices/sales-invoices.service.ts @@ -1,7 +1,38 @@ import { Injectable } from '@nestjs/common' +import { ResponseMapper } from '../../common/response/response-mapper' +import type { CustomerIndividual, CustomerLegal } from '../../generated/prisma/client' +import { CustomerType, PaymentMethodType } from '../../generated/prisma/enums' +import { PrismaService } from '../../prisma/prisma.service' +import { CreateSalesInvoiceDto } from './dto/create-sales-invoice.dto' + +// Define type guard for CustomerIndividual +function isCustomerIndividual(customer: any): customer is CustomerIndividual { + console.log( + customer && + typeof customer.first_name === 'string' && + typeof customer.last_name === 'string', + ) + + return ( + customer && + typeof customer.first_name === 'string' && + typeof customer.last_name === 'string' + ) +} + +// Define type guard for CustomerLegal +function isCustomerLegal(customer: any): customer is CustomerLegal { + return ( + customer && + typeof customer.company_name === 'string' && + typeof customer.registration_number === 'string' + ) +} @Injectable() export class SalesInvoicesService { + constructor(private prisma: PrismaService) {} + findAll() { // TODO: Implement fetching all sales invoices return [] @@ -12,8 +43,152 @@ export class SalesInvoicesService { return {} } - create(data: any) { - // TODO: Implement sales invoice creation - return data + async create(data: CreateSalesInvoiceDto, account) { + data.invoice_date = new Date(data.invoice_date).toISOString() as any + + const salesInvoice = await this.prisma.$transaction(async $tx => { + const payments = Object.entries(data.payments) + .filter(([_, value]) => value > 0 && PaymentMethodType[_.toUpperCase()]) + .map(([key, value]) => { + return { + amount: value, + payment_method: key.toLocaleUpperCase() as PaymentMethodType, + paid_at: data.invoice_date, + } + }) + + const totalPayments = payments.reduce((sum, payment) => sum + payment.amount, 0) + if (totalPayments !== data.total_amount) { + throw new Error('مبلغ پرداختی باید برابر با مبلغ کل فاکتور باشد.') + } + + const { customer_id, customer_type, customer, ...invoiceData } = data + let newCustomerId: string | null = customer_id || null + if (customer_id) { + } else if ( + customer_type === CustomerType.INDIVIDUAL && + isCustomerIndividual(customer) + ) { + let customerIndividual = await $tx.customerIndividual.findUnique({ + where: { + complex_id_national_id: { + complex_id: account.complex_id, + national_id: customer.national_id, + }, + }, + }) + + if (customerIndividual) { + await $tx.customerIndividual.update({ + where: { + complex_id_national_id: { + complex_id: account.complex_id, + national_id: customer.national_id, + }, + }, + data: { + ...customer, + }, + }) + } else { + const customerIndividual = await $tx.customerIndividual.create({ + data: { + ...customer, + }, + }) + const createdCustomer = await $tx.customer.create({ + data: { + type: CustomerType.INDIVIDUAL, + complex_id: account.complex_id, + customerIndividuals: { + connect: { + customer_id: customerIndividual.customer_id, + }, + }, + }, + }) + + if (createdCustomer && createdCustomer.id) { + newCustomerId = createdCustomer.id + } + } + } else if (data.customer_type === CustomerType.LEGAL && isCustomerLegal(customer)) { + let customerLegal = await $tx.customerLegal.findUnique({ + where: { + complex_id_registration_number: { + complex_id: account.complex_id, + registration_number: customer.registration_number, + }, + }, + }) + + if (customerLegal) { + await $tx.customerLegal.update({ + where: { + complex_id_registration_number: { + complex_id: account.complex_id, + registration_number: customer.registration_number, + }, + }, + data: { + ...customer, + }, + }) + } else { + const customerLegal = await $tx.customerLegal.create({ + data: { + ...customer, + }, + }) + const createdCustomer = await $tx.customer.create({ + data: { + type: CustomerType.LEGAL, + complex_id: account.complex_id, + customerIndividuals: { + connect: { + customer_id: customerLegal.customer_id, + }, + }, + }, + }) + + if (createdCustomer && createdCustomer.id) { + newCustomerId = createdCustomer.id + } + } + } + + const salesInvoice = await $tx.salesInvoice.create({ + data: { + ...invoiceData, + account_id: account.account_id, + customer_id: newCustomerId, + total_amount: data.total_amount, + code: 'INV-' + Date.now(), + complex_id: account.complex_id, + items: { + createMany: { + data: data.items.map(item => ({ + good_id: item.good_id, + quantity: item.quantity, + unit_price: item.unit_price, + total_amount: item.total_amount, + payload: item.payload, + unit_type: item.unit_type, + pricing_model: item.pricingModel, + })), + }, + }, + payments: { + createMany: { + data: payments, + }, + }, + }, + }) + + return salesInvoice + }) + return ResponseMapper.create(salesInvoice) } }