feat: add stock keeping unit management with create, update, and retrieval functionalities
- Implemented CreateStockKeepingUnitDto for creating stock keeping units. - Added StockKeepingUnitsService for handling business logic related to stock keeping units. - Created StockKeepingUnitsController to manage HTTP requests for stock keeping units. - Developed UpdateStockKeepingUnitDto for updating existing stock keeping units. - Introduced StockKeepingUnitsServiceFindAllResponseDto for response structure. - Established stock keeping units module for encapsulation of related components. feat: enhance sales invoice fiscal management with new endpoints - Created SalesInvoicesFilterDto for filtering sales invoices. - Implemented PosSalesInvoiceFiscalController for managing fiscal operations on sales invoices. - Developed PosSalesInvoiceFiscalService to handle fiscal logic and interactions. - Added methods for sending, retrying, and checking the status of fiscal invoices. - Integrated error handling and response mapping for fiscal operations.
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
||||
# AI Agent Specification
|
||||
|
||||
## Identity
|
||||
- Name: `consumer_api_agent`
|
||||
- Purpose: Assist with development, refactoring, migration, debugging, and data-safe operations for this repository.
|
||||
- Scope: Entire project rooted at `consumer_api`.
|
||||
|
||||
## Core Responsibilities
|
||||
- Implement and refactor backend features in NestJS modules.
|
||||
- Keep Prisma schema/migrations consistent and safe.
|
||||
- Preserve API behavior unless explicitly asked to change it.
|
||||
- Prefer minimal, focused changes over broad rewrites.
|
||||
|
||||
## Working Rules
|
||||
- Follow repository instructions in `AGENTS.md`.
|
||||
- Respect existing project conventions (naming, DTO patterns, response mapping).
|
||||
- Do not revert unrelated user changes.
|
||||
- Do not run destructive DB commands unless explicitly requested.
|
||||
- For risky DB operations, perform backup-first workflow.
|
||||
|
||||
## Code Standards
|
||||
- Keep functions small and cohesive.
|
||||
- Extract reusable logic to utilities/services when complexity grows.
|
||||
- Validate DTO inputs at boundaries.
|
||||
- Use typed response DTO aliases where possible.
|
||||
- Keep Prisma queries explicit with `select` for response control.
|
||||
|
||||
## Database Safety
|
||||
- Never run `prisma migrate reset` on important environments unless explicitly approved.
|
||||
- Treat applied migration files as immutable history.
|
||||
- Prefer forward-only migrations.
|
||||
- For data updates:
|
||||
- Use transactions.
|
||||
- Verify row counts before/after.
|
||||
- Keep operations idempotent when feasible.
|
||||
|
||||
## API Patterns
|
||||
- List endpoints: paginate + summary payload.
|
||||
- Detail endpoints: full resource shape.
|
||||
- Enum presentation: use shared translator utility (`translateEnumValue`).
|
||||
- Fiscal status fallback rule: if no fiscal record, return `NOT_SEND`.
|
||||
|
||||
## Execution Checklist
|
||||
1. Read target module/controller/service/DTO before edits.
|
||||
2. Apply minimal patch.
|
||||
3. Run typecheck (`pnpm -s tsc --noEmit`).
|
||||
4. If data logic changed, verify behavior with targeted checks.
|
||||
5. Summarize changed files and behavior impact.
|
||||
|
||||
## Useful Commands
|
||||
- Type check:
|
||||
- `pnpm -s tsc --noEmit`
|
||||
- Prisma migration status:
|
||||
- `pnpm prisma migrate status`
|
||||
- Create migration:
|
||||
- `pnpm prisma migrate dev --name <name>`
|
||||
- Apply production migrations:
|
||||
- `pnpm prisma migrate deploy`
|
||||
|
||||
## Communication Style
|
||||
- Be concise, direct, and implementation-focused.
|
||||
- Call out assumptions and risky steps before execution.
|
||||
- Provide concrete next actions after each completed task.
|
||||
+1533
File diff suppressed because one or more lines are too long
@@ -82,6 +82,7 @@
|
||||
"dump-triggers": "tsx scripts/dump-triggers.ts",
|
||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"generate:permissions": "tsx scripts/generate-permissions.ts",
|
||||
"seed:sku": "tsx scripts/seedStockKeepingUnits.ts",
|
||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||
"start": "nest start",
|
||||
"start:debug": "nest start --debug --watch",
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `permission_business_activities` DROP FOREIGN KEY `permission_business_activities_business_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `permission_business_activities` DROP FOREIGN KEY `permission_business_activities_permission_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `permission_complexes` DROP FOREIGN KEY `permission_complexes_complex_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `permission_complexes` DROP FOREIGN KEY `permission_complexes_permission_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `permission_consumers` DROP FOREIGN KEY `permission_consumers_consumer_account_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `permission_poses` DROP FOREIGN KEY `permission_poses_permission_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `permission_poses` DROP FOREIGN KEY `permission_poses_pos_id_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `permission_business_activities_business_id_fkey` ON `permission_business_activities`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `permission_complexes_complex_id_fkey` ON `permission_complexes`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `permission_poses_pos_id_fkey` ON `permission_poses`;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_consumers` ADD CONSTRAINT `permission_consumers_consumer_account_id_fkey` FOREIGN KEY (`consumer_account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_poses` ADD CONSTRAINT `permission_poses_pos_id_fkey` FOREIGN KEY (`pos_id`) REFERENCES `poses`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_poses` ADD CONSTRAINT `permission_poses_permission_id_fkey` FOREIGN KEY (`permission_id`) REFERENCES `permission_consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_complexes` ADD CONSTRAINT `permission_complexes_complex_id_fkey` FOREIGN KEY (`complex_id`) REFERENCES `complexes`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_complexes` ADD CONSTRAINT `permission_complexes_permission_id_fkey` FOREIGN KEY (`permission_id`) REFERENCES `permission_consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_business_activities` ADD CONSTRAINT `permission_business_activities_business_id_fkey` FOREIGN KEY (`business_id`) REFERENCES `business_activities`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_business_activities` ADD CONSTRAINT `permission_business_activities_permission_id_fkey` FOREIGN KEY (`permission_id`) REFERENCES `permission_consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -1,2 +0,0 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE `goods` ADD COLUMN `image_url` VARCHAR(255) NULL;
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `consumer_id` on the `licenses` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `expires_at` on the `licenses` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `starts_at` on the `licenses` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `status` on the `licenses` table. All the data in the column will be lost.
|
||||
- A unique constraint covering the columns `[activated_license_id]` on the table `consumers` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `activation_expires_at` to the `licenses` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `charged_license_transaction_id` to the `licenses` table without a default value. This is not possible if the table is not empty.
|
||||
- Made the column `partner_id` on table `licenses` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `licenses` DROP FOREIGN KEY `licenses_consumer_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `licenses` DROP FOREIGN KEY `licenses_partner_id_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `licenses_consumer_id_key` ON `licenses`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `licenses_partner_id_fkey` ON `licenses`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `consumers` ADD COLUMN `activated_license_id` VARCHAR(191) NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `licenses` DROP COLUMN `consumer_id`,
|
||||
DROP COLUMN `expires_at`,
|
||||
DROP COLUMN `starts_at`,
|
||||
DROP COLUMN `status`,
|
||||
ADD COLUMN `activation_expires_at` DATETIME(3) NOT NULL,
|
||||
ADD COLUMN `charged_license_transaction_id` VARCHAR(191) NOT NULL,
|
||||
MODIFY `partner_id` VARCHAR(191) NOT NULL;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `activated_licenses` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`starts_at` DATETIME(3) NOT NULL,
|
||||
`expires_at` DATETIME(3) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`license_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `activated_licenses_id_key`(`id`),
|
||||
UNIQUE INDEX `activated_licenses_license_id_key`(`license_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `charged_license_transactions` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `consumers_activated_license_id_key` ON `consumers`(`activated_license_id`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `consumers` ADD CONSTRAINT `consumers_activated_license_id_fkey` FOREIGN KEY (`activated_license_id`) REFERENCES `activated_licenses`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `licenses` ADD CONSTRAINT `licenses_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `licenses` ADD CONSTRAINT `licenses_charged_license_transaction_id_fkey` FOREIGN KEY (`charged_license_transaction_id`) REFERENCES `charged_license_transactions`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `activated_licenses` ADD CONSTRAINT `activated_licenses_license_id_fkey` FOREIGN KEY (`license_id`) REFERENCES `licenses`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `charged_license_transactions` ADD CONSTRAINT `charged_license_transactions_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `activated_license_id` on the `consumers` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `activation_expires_at` on the `licenses` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `partner_id` on the `licenses` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `license_quota` on the `partners` table. All the data in the column will be lost.
|
||||
- Added the required column `consumer_id` to the `activated_licenses` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `activation_expires_at` to the `charged_license_transactions` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `consumers` DROP FOREIGN KEY `consumers_activated_license_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `licenses` DROP FOREIGN KEY `licenses_partner_id_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `consumers_activated_license_id_key` ON `consumers`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `licenses_partner_id_fkey` ON `licenses`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `activated_licenses` ADD COLUMN `consumer_id` VARCHAR(191) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `charged_license_transactions` ADD COLUMN `activation_expires_at` DATETIME(3) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `consumers` DROP COLUMN `activated_license_id`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `licenses` DROP COLUMN `activation_expires_at`,
|
||||
DROP COLUMN `partner_id`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `partners` DROP COLUMN `license_quota`;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `activated_licenses` ADD CONSTRAINT `activated_licenses_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
-70
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `user_devices` table. If the table is not empty, all the data it contains will be lost.
|
||||
- A unique constraint covering the columns `[tracking_code]` on the table `charged_license_transactions` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `tracking_code` to the `charged_license_transactions` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropTable
|
||||
DROP TABLE `user_devices`;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `consumer_devices` (
|
||||
`uuid` VARCHAR(255) NOT NULL,
|
||||
`app_version` VARCHAR(20) NOT NULL,
|
||||
`build_number` VARCHAR(20) NOT NULL,
|
||||
`platform` VARCHAR(100) NOT NULL,
|
||||
`brand` VARCHAR(100) NOT NULL,
|
||||
`model` VARCHAR(100) NOT NULL,
|
||||
`device` VARCHAR(100) NOT NULL,
|
||||
`os_version` VARCHAR(20) NOT NULL,
|
||||
`sdk_version` VARCHAR(20) NOT NULL,
|
||||
`release_number` VARCHAR(20) NOT NULL,
|
||||
`browser_name` VARCHAR(100) NULL,
|
||||
`fcm_token` VARCHAR(100) NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`consumer_id` VARCHAR(191) NOT NULL,
|
||||
UNIQUE INDEX `consumer_devices_uuid_key` (`uuid`),
|
||||
PRIMARY KEY (`uuid`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `application_released_info` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`version` VARCHAR(191) NOT NULL,
|
||||
`build_number` VARCHAR(191) NOT NULL,
|
||||
`is_stable` BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
`is_minimum_supported` BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
`type` ENUM('ANDROID', 'IOS') NOT NULL,
|
||||
`notes` JSON NULL,
|
||||
`release_date` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `consumer_devices`
|
||||
ADD CONSTRAINT `consumer_devices_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `charged_license_transactions`
|
||||
ADD COLUMN `tracking_code` VARCHAR(191) NULL;
|
||||
|
||||
UPDATE `charged_license_transactions`
|
||||
SET
|
||||
`tracking_code` = CONCAT(
|
||||
'TRX-',
|
||||
UPPER(
|
||||
REPLACE (`id`, '-', '')
|
||||
)
|
||||
)
|
||||
WHERE
|
||||
`tracking_code` IS NULL
|
||||
OR `tracking_code` = '';
|
||||
|
||||
ALTER TABLE `charged_license_transactions`
|
||||
MODIFY `tracking_code` VARCHAR(191) NOT NULL;
|
||||
|
||||
CREATE UNIQUE INDEX `charged_license_transactions_tracking_code_key` ON `charged_license_transactions` (`tracking_code`);
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `is_stable` on the `application_released_info` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `type` on the `application_released_info` table. All the data in the column will be lost.
|
||||
- Added the required column `platform` to the `application_released_info` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `release_type` to the `application_released_info` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `publisher` to the `consumer_devices` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `application_released_info` DROP COLUMN `is_stable`,
|
||||
DROP COLUMN `type`,
|
||||
ADD COLUMN `platform` ENUM('ANDROID', 'IOS') NOT NULL,
|
||||
ADD COLUMN `release_type` ENUM('STABLE', 'BETA', 'ALPHA') NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `consumer_devices` ADD COLUMN `publisher` ENUM('DIRECT', 'CAFE_BAZAR', 'MAYKET') NOT NULL,
|
||||
ADD COLUMN `user_agent` VARCHAR(100) NULL;
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `tax_id` on the `complexes` table. All the data in the column will be lost.
|
||||
- A unique constraint covering the columns `[economic_code]` on the table `business_activities` will be added. If there are existing duplicate values, this will fail.
|
||||
- A unique constraint covering the columns `[mobile_number,national_code,partner_id]` on the table `consumers` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `economic_code` to the `business_activities` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `national_code` to the `consumers` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `partner_id` to the `consumers` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX `consumers_mobile_number_key` ON `consumers`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `business_activities` ADD COLUMN `economic_code` VARCHAR(191) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `complexes` DROP COLUMN `tax_id`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `consumers` ADD COLUMN `national_code` VARCHAR(191) NOT NULL,
|
||||
ADD COLUMN `partner_id` VARCHAR(191) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `licenses` ADD COLUMN `accounts_limit` INTEGER NOT NULL DEFAULT 3;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `business_activities_economic_code_key` ON `business_activities`(`economic_code`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `consumers_mobile_number_national_code_partner_id_key` ON `consumers`(`mobile_number`, `national_code`, `partner_id`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `consumers` ADD CONSTRAINT `consumers_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `branch_code` to the `complexes` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `complexes` ADD COLUMN `branch_code` VARCHAR(191) NOT NULL;
|
||||
@@ -1,151 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `charged_license_transaction_id` on the `licenses` table. All the data in the column will be lost.
|
||||
- You are about to drop the `activated_licenses` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `charged_license_transactions` table. If the table is not empty, all the data it contains will be lost.
|
||||
- A unique constraint covering the columns `[mobile_number,partner_id]` on the table `consumers` will be added. If there are existing duplicate values, this will fail.
|
||||
- A unique constraint covering the columns `[national_code,partner_id]` on the table `consumers` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `charge_transaction_id` to the `licenses` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `activated_licenses` DROP FOREIGN KEY `activated_licenses_consumer_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `activated_licenses` DROP FOREIGN KEY `activated_licenses_license_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `charged_license_transactions` DROP FOREIGN KEY `charged_license_transactions_partner_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `licenses` DROP FOREIGN KEY `licenses_charged_license_transaction_id_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `consumers_mobile_number_national_code_partner_id_key` ON `consumers`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `licenses_charged_license_transaction_id_fkey` ON `licenses`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `licenses` DROP COLUMN `charged_license_transaction_id`,
|
||||
ADD COLUMN `charge_transaction_id` VARCHAR(191) NOT NULL;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `activated_licenses`;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `charged_license_transactions`;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `licenses_activated` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`starts_at` DATETIME(3) NOT NULL,
|
||||
`expires_at` DATETIME(3) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`license_id` VARCHAR(191) NOT NULL,
|
||||
`business_activity_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `licenses_activated_id_key`(`id`),
|
||||
UNIQUE INDEX `licenses_activated_license_id_key`(`license_id`),
|
||||
UNIQUE INDEX `licenses_activated_business_activity_id_key`(`business_activity_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `license_charged_transactions` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`activation_expires_at` DATETIME(3) NOT NULL,
|
||||
`tracking_code` VARCHAR(191) NOT NULL,
|
||||
`purchased_count` INTEGER NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `license_charged_transactions_tracking_code_key`(`tracking_code`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `license_renew` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`charge_transaction_id` VARCHAR(191) NOT NULL,
|
||||
`activation_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `license_renew_charge_transaction` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`activation_expires_at` DATETIME(3) NOT NULL,
|
||||
`tracking_code` VARCHAR(191) NOT NULL,
|
||||
`purchased_count` INTEGER NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `license_renew_charge_transaction_tracking_code_key`(`tracking_code`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `partner_account_quota_charge_transaction` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`purchased_count` INTEGER NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `partner_account_quota_allocation` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`charge_transaction_id` VARCHAR(191) NOT NULL,
|
||||
`license_id` VARCHAR(191) NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `consumers_mobile_number_partner_id_key` ON `consumers`(`mobile_number`, `partner_id`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `consumers_national_code_partner_id_key` ON `consumers`(`national_code`, `partner_id`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `licenses` ADD CONSTRAINT `licenses_charge_transaction_id_fkey` FOREIGN KEY (`charge_transaction_id`) REFERENCES `license_charged_transactions`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `licenses_activated` ADD CONSTRAINT `licenses_activated_license_id_fkey` FOREIGN KEY (`license_id`) REFERENCES `licenses`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `licenses_activated` ADD CONSTRAINT `licenses_activated_business_activity_id_fkey` FOREIGN KEY (`business_activity_id`) REFERENCES `business_activities`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_charged_transactions` ADD CONSTRAINT `license_charged_transactions_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_renew` ADD CONSTRAINT `license_renew_charge_transaction_id_fkey` FOREIGN KEY (`charge_transaction_id`) REFERENCES `license_renew_charge_transaction`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_renew` ADD CONSTRAINT `license_renew_activation_id_fkey` FOREIGN KEY (`activation_id`) REFERENCES `licenses_activated`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_renew_charge_transaction` ADD CONSTRAINT `license_renew_charge_transaction_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `partner_account_quota_charge_transaction` ADD CONSTRAINT `partner_account_quota_charge_transaction_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `partner_account_quota_allocation` ADD CONSTRAINT `partner_account_quota_allocation_charge_transaction_id_fkey` FOREIGN KEY (`charge_transaction_id`) REFERENCES `partner_account_quota_charge_transaction`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `partner_account_quota_allocation` ADD CONSTRAINT `partner_account_quota_allocation_license_id_fkey` FOREIGN KEY (`license_id`) REFERENCES `licenses`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[tracking_code]` on the table `partner_account_quota_charge_transaction` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `expires_at` to the `license_renew` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `activation_expires_at` to the `partner_account_quota_charge_transaction` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `tracking_code` to the `partner_account_quota_charge_transaction` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `license_renew` ADD COLUMN `expires_at` DATETIME(3) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `partner_account_quota_charge_transaction` ADD COLUMN `activation_expires_at` DATETIME(3) NOT NULL,
|
||||
ADD COLUMN `tracking_code` VARCHAR(191) NOT NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `partner_account_quota_charge_transaction_tracking_code_key` ON `partner_account_quota_charge_transaction`(`tracking_code`);
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `serial` on the `poses` table. All the data in the column will be lost.
|
||||
- A unique constraint covering the columns `[serial_number]` on the table `poses` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX `poses_serial_key` ON `poses`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `poses` DROP COLUMN `serial`,
|
||||
ADD COLUMN `serial_number` VARCHAR(191) NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `poses_serial_number_key` ON `poses`(`serial_number`);
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[account_id]` on the table `poses` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `licenses` MODIFY `accounts_limit` INTEGER NOT NULL DEFAULT 2;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `partners` ADD COLUMN `logo_url` VARCHAR(191) NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `poses` ADD COLUMN `account_id` VARCHAR(191) NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `poses_account_id_key` ON `poses`(`account_id`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `poses` ADD CONSTRAINT `poses_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `partner_account_quota_allocation` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `partner_account_quota_allocation` DROP FOREIGN KEY `partner_account_quota_allocation_charge_transaction_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `partner_account_quota_allocation` DROP FOREIGN KEY `partner_account_quota_allocation_license_id_fkey`;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `partner_account_quota_allocation`;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `partner_account_quota_credit` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`charge_transaction_id` VARCHAR(191) NOT NULL,
|
||||
`allocation_id` VARCHAR(191) NULL,
|
||||
|
||||
UNIQUE INDEX `partner_account_quota_credit_allocation_id_key`(`allocation_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `license_account_allocation` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`license_activation_id` VARCHAR(191) NOT NULL,
|
||||
`account_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `license_account_allocation_account_id_key`(`account_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `partner_account_quota_credit` ADD CONSTRAINT `partner_account_quota_credit_charge_transaction_id_fkey` FOREIGN KEY (`charge_transaction_id`) REFERENCES `partner_account_quota_charge_transaction`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `partner_account_quota_credit` ADD CONSTRAINT `partner_account_quota_credit_allocation_id_fkey` FOREIGN KEY (`allocation_id`) REFERENCES `license_account_allocation`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_license_activation_id_fkey` FOREIGN KEY (`license_activation_id`) REFERENCES `licenses_activated`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -1,30 +0,0 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `license_account_allocation` DROP FOREIGN KEY `license_account_allocation_account_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `license_account_allocation` DROP FOREIGN KEY `license_account_allocation_license_activation_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `partner_account_quota_credit` DROP FOREIGN KEY `partner_account_quota_credit_charge_transaction_id_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `license_account_allocation_license_activation_id_fkey` ON `license_account_allocation`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `partner_account_quota_credit_charge_transaction_id_fkey` ON `partner_account_quota_credit`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `license_account_allocation` MODIFY `license_activation_id` VARCHAR(191) NULL,
|
||||
MODIFY `account_id` VARCHAR(191) NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `partner_account_quota_credit` MODIFY `charge_transaction_id` VARCHAR(191) NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `partner_account_quota_credit` ADD CONSTRAINT `partner_account_quota_credit_charge_transaction_id_fkey` FOREIGN KEY (`charge_transaction_id`) REFERENCES `partner_account_quota_charge_transaction`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_license_activation_id_fkey` FOREIGN KEY (`license_activation_id`) REFERENCES `licenses_activated`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `allocation_id` on the `partner_account_quota_credit` table. All the data in the column will be lost.
|
||||
- A unique constraint covering the columns `[economic_code,consumer_id]` on the table `business_activities` will be added. If there are existing duplicate values, this will fail.
|
||||
- A unique constraint covering the columns `[credit_id]` on the table `license_account_allocation` will be added. If there are existing duplicate values, this will fail.
|
||||
- Made the column `account_id` on table `poses` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `license_renew` DROP FOREIGN KEY `license_renew_activation_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `partner_account_quota_credit` DROP FOREIGN KEY `partner_account_quota_credit_allocation_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `poses` DROP FOREIGN KEY `poses_account_id_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `business_activities_economic_code_key` ON `business_activities`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `license_renew_activation_id_fkey` ON `license_renew`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `partner_account_quota_credit_allocation_id_key` ON `partner_account_quota_credit`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `license_account_allocation` ADD COLUMN `credit_id` VARCHAR(191) NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `license_renew` MODIFY `activation_id` VARCHAR(191) NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `partner_account_quota_credit` DROP COLUMN `allocation_id`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `poses` MODIFY `account_id` VARCHAR(191) NOT NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `business_activities_economic_code_consumer_id_key` ON `business_activities`(`economic_code`, `consumer_id`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `license_account_allocation_credit_id_key` ON `license_account_allocation`(`credit_id`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `poses` ADD CONSTRAINT `poses_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_renew` ADD CONSTRAINT `license_renew_activation_id_fkey` FOREIGN KEY (`activation_id`) REFERENCES `licenses_activated`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_credit_id_fkey` FOREIGN KEY (`credit_id`) REFERENCES `partner_account_quota_credit`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `complex_id` on the `customer_individuals` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `complex_id` on the `customer_legal` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `unknown_customer` on the `customers` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `complex_id` on the `goods` table. All the data in the column will be lost.
|
||||
- A unique constraint covering the columns `[business_activity_id,national_id]` on the table `customer_individuals` will be added. If there are existing duplicate values, this will fail.
|
||||
- A unique constraint covering the columns `[business_activity_id,economic_code]` on the table `customer_legal` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `business_activity_id` to the `customer_individuals` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `mobile_number` to the `customer_individuals` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `business_activity_id` to the `customer_legal` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `customer_individuals` DROP FOREIGN KEY `customer_individuals_complex_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `customer_legal` DROP FOREIGN KEY `customer_legal_complex_id_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `goods` DROP FOREIGN KEY `goods_complex_id_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `customer_individuals_complex_id_idx` ON `customer_individuals`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `customer_individuals_complex_id_national_id_key` ON `customer_individuals`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `customer_legal_complex_id_idx` ON `customer_legal`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `customer_legal_complex_id_registration_number_key` ON `customer_legal`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `goods_complex_id_fkey` ON `goods`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `customer_individuals` DROP COLUMN `complex_id`,
|
||||
ADD COLUMN `business_activity_id` VARCHAR(191) NOT NULL,
|
||||
ADD COLUMN `mobile_number` CHAR(15) NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `customer_legal` DROP COLUMN `complex_id`,
|
||||
ADD COLUMN `business_activity_id` VARCHAR(191) NOT NULL,
|
||||
MODIFY `registration_number` CHAR(20) NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `customers` DROP COLUMN `unknown_customer`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `goods` DROP COLUMN `complex_id`,
|
||||
ADD COLUMN `business_activity_id` VARCHAR(191) NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX `customer_individuals_business_activity_id_idx` ON `customer_individuals`(`business_activity_id`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `customer_individuals_business_activity_id_national_id_key` ON `customer_individuals`(`business_activity_id`, `national_id`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX `customer_legal_business_activity_id_idx` ON `customer_legal`(`business_activity_id`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `customer_legal_business_activity_id_economic_code_key` ON `customer_legal`(`business_activity_id`, `economic_code`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `customer_individuals` ADD CONSTRAINT `customer_individuals_business_activity_id_fkey` FOREIGN KEY (`business_activity_id`) REFERENCES `business_activities`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `customer_legal` ADD CONSTRAINT `customer_legal_business_activity_id_fkey` FOREIGN KEY (`business_activity_id`) REFERENCES `business_activities`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `goods` ADD CONSTRAINT `goods_business_activity_id_fkey` FOREIGN KEY (`business_activity_id`) REFERENCES `business_activities`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
Consumer profile split migration.
|
||||
|
||||
Existing profile data is copied into `individual_consumers` before the source
|
||||
columns are removed from `consumers`.
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `consumers`
|
||||
ADD COLUMN `type` ENUM('INDIVIDUAL', 'LEGAL') NOT NULL DEFAULT 'INDIVIDUAL';
|
||||
|
||||
UPDATE `consumers` SET `type` = 'INDIVIDUAL';
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `consumers` DROP FOREIGN KEY `consumers_partner_id_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `consumers_mobile_number_partner_id_key` ON `consumers`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `consumers_national_code_partner_id_key` ON `consumers`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `consumers_partner_id_fkey` ON `consumers`;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `individual_consumers` (
|
||||
`first_name` VARCHAR(191) NOT NULL,
|
||||
`last_name` VARCHAR(191) NOT NULL,
|
||||
`mobile_number` VARCHAR(191) NOT NULL,
|
||||
`national_code` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NOT NULL,
|
||||
`consumer_id` VARCHAR(191) NOT NULL,
|
||||
UNIQUE INDEX `individual_consumers_mobile_number_consumer_id_key` (
|
||||
`mobile_number`,
|
||||
`consumer_id`
|
||||
),
|
||||
UNIQUE INDEX `individual_consumers_partner_id_national_code_key` (`partner_id`, `national_code`),
|
||||
PRIMARY KEY (`consumer_id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `legal_consumers` (
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`registration_code` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NOT NULL,
|
||||
`consumer_id` VARCHAR(191) NOT NULL,
|
||||
UNIQUE INDEX `legal_consumers_partner_id_registration_code_key` (
|
||||
`partner_id`,
|
||||
`registration_code`
|
||||
),
|
||||
PRIMARY KEY (`consumer_id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
INSERT INTO
|
||||
`individual_consumers` (
|
||||
`first_name`,
|
||||
`last_name`,
|
||||
`mobile_number`,
|
||||
`national_code`,
|
||||
`created_at`,
|
||||
`updated_at`,
|
||||
`partner_id`,
|
||||
`consumer_id`
|
||||
)
|
||||
SELECT
|
||||
`first_name`,
|
||||
`last_name`,
|
||||
`mobile_number`,
|
||||
`national_code`,
|
||||
`created_at`,
|
||||
`updated_at`,
|
||||
`partner_id`,
|
||||
`id`
|
||||
FROM `consumers`;
|
||||
|
||||
ALTER TABLE `consumers`
|
||||
DROP COLUMN `first_name`,
|
||||
DROP COLUMN `last_name`,
|
||||
DROP COLUMN `mobile_number`,
|
||||
DROP COLUMN `national_code`,
|
||||
DROP COLUMN `partner_id`,
|
||||
MODIFY `type` ENUM('INDIVIDUAL', 'LEGAL') NOT NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `individual_consumers`
|
||||
ADD CONSTRAINT `individual_consumers_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `individual_consumers`
|
||||
ADD CONSTRAINT `individual_consumers_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `legal_consumers`
|
||||
ADD CONSTRAINT `legal_consumers_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `legal_consumers`
|
||||
ADD CONSTRAINT `legal_consumers_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -1,22 +0,0 @@
|
||||
ALTER TABLE `individual_consumers` RENAME TO `consumers_individual`;
|
||||
ALTER TABLE `legal_consumers` RENAME TO `consumers_legal`;
|
||||
|
||||
ALTER TABLE `consumers_individual`
|
||||
RENAME INDEX `individual_consumers_mobile_number_consumer_id_key` TO `consumers_individual_mobile_number_consumer_id_key`;
|
||||
ALTER TABLE `consumers_individual`
|
||||
RENAME INDEX `individual_consumers_partner_id_national_code_key` TO `consumers_individual_partner_id_national_code_key`;
|
||||
ALTER TABLE `consumers_legal`
|
||||
RENAME INDEX `legal_consumers_partner_id_registration_code_key` TO `consumers_legal_partner_id_registration_code_key`;
|
||||
|
||||
ALTER TABLE `consumers_individual` DROP FOREIGN KEY `individual_consumers_partner_id_fkey`;
|
||||
ALTER TABLE `consumers_individual` DROP FOREIGN KEY `individual_consumers_consumer_id_fkey`;
|
||||
ALTER TABLE `consumers_legal` DROP FOREIGN KEY `legal_consumers_partner_id_fkey`;
|
||||
ALTER TABLE `consumers_legal` DROP FOREIGN KEY `legal_consumers_consumer_id_fkey`;
|
||||
|
||||
ALTER TABLE `consumers_individual`
|
||||
ADD CONSTRAINT `consumers_individual_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `consumers_individual_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `consumers_legal`
|
||||
ADD CONSTRAINT `consumers_legal_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `consumers_legal_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `account_id` on the `sales_invoices` table. All the data in the column will be lost.
|
||||
- A unique constraint covering the columns `[invoice_number,pos_id]` on the table `sales_invoices` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `fiscal_id` to the `business_activities` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `partner_token` to the `business_activities` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `consumer_account_id` to the `sales_invoices` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `invoice_number` to the `sales_invoices` table without a default value. This is not possible if the table is not empty.
|
||||
- Made the column `invoice_date` on table `sales_invoices` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `sales_invoices` DROP FOREIGN KEY `sales_invoices_account_id_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `sales_invoices_account_id_fkey` ON `sales_invoices`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `business_activities` ADD COLUMN `fiscal_id` VARCHAR(191) NOT NULL DEFAULT '',
|
||||
ADD COLUMN `partner_token` VARCHAR(191) NOT NULL DEFAULT '';
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `sales_invoice_items` ADD COLUMN `good_snapshot` JSON NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `sales_invoice_payments` MODIFY `paid_at` TIMESTAMP(0) NOT NULL,
|
||||
MODIFY `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `sales_invoices` DROP COLUMN `account_id`,
|
||||
ADD COLUMN `consumer_account_id` VARCHAR(191) NOT NULL,
|
||||
ADD COLUMN `invoice_number` INTEGER NOT NULL,
|
||||
MODIFY `invoice_date` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `sale_invoice_fiscals` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`retry_count` INTEGER NOT NULL DEFAULT 0,
|
||||
`last_attempt_at` TIMESTAMP(0) NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`invoice_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `sale_invoice_fiscals_invoice_id_key`(`invoice_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `sale_invoice_fiscal_attempts` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`attempt_no` INTEGER NOT NULL,
|
||||
`status` VARCHAR(50) NOT NULL,
|
||||
`tax_id` VARCHAR(191) NULL,
|
||||
`request_payload` JSON NULL,
|
||||
`response_payload` JSON NULL,
|
||||
`error_message` TEXT NULL,
|
||||
`sent_at` TIMESTAMP(0) NULL,
|
||||
`received_at` TIMESTAMP(0) NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`fiscal_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `sale_invoice_fiscal_attempts_tax_id_key`(`tax_id`),
|
||||
INDEX `sale_invoice_fiscal_attempts_status_idx`(`status`),
|
||||
INDEX `sale_invoice_fiscal_attempts_tax_id_idx`(`tax_id`),
|
||||
UNIQUE INDEX `sale_invoice_fiscal_attempts_fiscal_id_attempt_no_key`(`fiscal_id`, `attempt_no`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `sales_invoices_invoice_number_pos_id_key` ON `sales_invoices`(`invoice_number`, `pos_id`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sales_invoices` ADD CONSTRAINT `sales_invoices_consumer_account_id_fkey` FOREIGN KEY (`consumer_account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sale_invoice_fiscals` ADD CONSTRAINT `sale_invoice_fiscals_invoice_id_fkey` FOREIGN KEY (`invoice_id`) REFERENCES `sales_invoices`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sale_invoice_fiscal_attempts` ADD CONSTRAINT `sale_invoice_fiscal_attempts_fiscal_id_fkey` FOREIGN KEY (`fiscal_id`) REFERENCES `sale_invoice_fiscals`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -1,3 +0,0 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE `business_activities` ALTER COLUMN `fiscal_id` DROP DEFAULT,
|
||||
ALTER COLUMN `partner_token` DROP DEFAULT;
|
||||
@@ -1,2 +0,0 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE `partners` ADD COLUMN `fiscal_switch_type` ENUM('NAMA', 'SUN') NOT NULL DEFAULT 'NAMA';
|
||||
+470
-176
@@ -37,76 +37,6 @@ CREATE TABLE `accounts` (
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `consumer_accounts` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`role` ENUM('OWNER', 'MANAGER', 'OPERATOR') NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`consumer_id` VARCHAR(191) NOT NULL,
|
||||
`account_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `consumer_accounts_account_id_key`(`account_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `consumers` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`mobile_number` VARCHAR(191) NOT NULL,
|
||||
`first_name` VARCHAR(191) NOT NULL,
|
||||
`last_name` VARCHAR(191) NOT NULL,
|
||||
`status` ENUM('ACTIVE', 'SUSPENDED') NOT NULL DEFAULT 'ACTIVE',
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `consumers_mobile_number_key`(`mobile_number`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `business_activities` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`guild_id` VARCHAR(191) NOT NULL,
|
||||
`consumer_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `complexes` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`address` VARCHAR(191) NULL,
|
||||
`tax_id` VARCHAR(191) NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`business_activity_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `poses` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`serial` VARCHAR(191) NOT NULL,
|
||||
`model` VARCHAR(191) NULL,
|
||||
`status` ENUM('ACTIVE', 'DISABLED') NOT NULL DEFAULT 'ACTIVE',
|
||||
`pos_type` ENUM('PSP', 'MOBILE', 'WEB', 'API') NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`complex_id` VARCHAR(191) NOT NULL,
|
||||
`device_id` VARCHAR(191) NULL,
|
||||
`provider_id` VARCHAR(191) NULL,
|
||||
|
||||
UNIQUE INDEX `poses_serial_key`(`serial`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `device_brands` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
@@ -129,18 +59,108 @@ CREATE TABLE `devices` (
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `license_charged_transactions` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`activation_expires_at` DATETIME(3) NOT NULL,
|
||||
`tracking_code` VARCHAR(191) NOT NULL,
|
||||
`purchased_count` INTEGER NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `license_charged_transactions_tracking_code_key`(`tracking_code`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `licenses` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`accounts_limit` INTEGER NOT NULL DEFAULT 2,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`charge_transaction_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `licenses_activated` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`starts_at` DATETIME(3) NOT NULL,
|
||||
`expires_at` DATETIME(3) NOT NULL,
|
||||
`status` ENUM('ACTIVE', 'EXPIRED', 'SUSPENDED') NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NULL,
|
||||
`consumer_id` VARCHAR(191) NOT NULL,
|
||||
`license_id` VARCHAR(191) NOT NULL,
|
||||
`business_activity_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `licenses_consumer_id_key`(`consumer_id`),
|
||||
UNIQUE INDEX `licenses_activated_id_key`(`id`),
|
||||
UNIQUE INDEX `licenses_activated_license_id_key`(`license_id`),
|
||||
UNIQUE INDEX `licenses_activated_business_activity_id_key`(`business_activity_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `license_renew_charge_transaction` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`activation_expires_at` DATETIME(3) NOT NULL,
|
||||
`tracking_code` VARCHAR(191) NOT NULL,
|
||||
`purchased_count` INTEGER NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `license_renew_charge_transaction_tracking_code_key`(`tracking_code`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `license_renew` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`expires_at` DATETIME(3) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`charge_transaction_id` VARCHAR(191) NOT NULL,
|
||||
`activation_id` VARCHAR(191) NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `partner_account_quota_charge_transaction` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`activation_expires_at` DATETIME(3) NOT NULL,
|
||||
`tracking_code` VARCHAR(191) NOT NULL,
|
||||
`purchased_count` INTEGER NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `partner_account_quota_charge_transaction_tracking_code_key`(`tracking_code`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `partner_account_quota_credit` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`charge_transaction_id` VARCHAR(191) NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `license_account_allocation` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`license_activation_id` VARCHAR(191) NULL,
|
||||
`account_id` VARCHAR(191) NULL,
|
||||
`credit_id` VARCHAR(191) NULL,
|
||||
|
||||
UNIQUE INDEX `license_account_allocation_account_id_key`(`account_id`),
|
||||
UNIQUE INDEX `license_account_allocation_credit_id_key`(`credit_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
@@ -162,8 +182,9 @@ CREATE TABLE `partners` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`code` VARCHAR(191) NOT NULL,
|
||||
`license_quota` INTEGER NULL DEFAULT 0,
|
||||
`status` ENUM('ACTIVE', 'SUSPENDED') NOT NULL DEFAULT 'ACTIVE',
|
||||
`fiscal_switch_type` ENUM('NAMA', 'SUN') NOT NULL,
|
||||
`logo_url` VARCHAR(191) NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
|
||||
@@ -240,75 +261,145 @@ CREATE TABLE `providers` (
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `trigger_logs` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`message` TEXT NOT NULL,
|
||||
`createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`name` TEXT NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `user_devices` (
|
||||
`account_id` VARCHAR(255) NULL,
|
||||
CREATE TABLE `consumer_devices` (
|
||||
`uuid` VARCHAR(255) NOT NULL,
|
||||
`app_version` VARCHAR(20) NOT NULL,
|
||||
`build_number` VARCHAR(20) NOT NULL,
|
||||
`uuid` VARCHAR(255) NOT NULL,
|
||||
`platform` VARCHAR(100) NOT NULL,
|
||||
`brand` VARCHAR(100) NOT NULL,
|
||||
`model` VARCHAR(100) NOT NULL,
|
||||
`device` VARCHAR(100) NOT NULL,
|
||||
`publisher` ENUM('DIRECT', 'CAFE_BAZAR', 'MAYKET') NOT NULL,
|
||||
`os_version` VARCHAR(20) NOT NULL,
|
||||
`sdk_version` VARCHAR(20) NOT NULL,
|
||||
`release_number` VARCHAR(20) NOT NULL,
|
||||
`user_agent` VARCHAR(100) NULL,
|
||||
`browser_name` VARCHAR(100) NULL,
|
||||
`fcm_token` VARCHAR(100) NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`consumer_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `user_devices_uuid_key`(`uuid`),
|
||||
UNIQUE INDEX `consumer_devices_uuid_key`(`uuid`),
|
||||
PRIMARY KEY (`uuid`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `customers` (
|
||||
CREATE TABLE `application_released_info` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`is_favorite` BOOLEAN NULL DEFAULT false,
|
||||
`version` VARCHAR(191) NOT NULL,
|
||||
`build_number` VARCHAR(191) NOT NULL,
|
||||
`is_minimum_supported` BOOLEAN NOT NULL DEFAULT false,
|
||||
`release_type` ENUM('STABLE', 'BETA', 'ALPHA') NOT NULL,
|
||||
`platform` ENUM('ANDROID', 'IOS') NOT NULL,
|
||||
`notes` JSON NULL,
|
||||
`release_date` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`deleted_at` TIMESTAMP(0) NULL,
|
||||
`type` ENUM('INDIVIDUAL', 'LEGAL', 'UNKNOWN') NOT NULL,
|
||||
`unknown_customer` JSON NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `customer_individuals` (
|
||||
`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,
|
||||
`customer_id` VARCHAR(191) NOT NULL,
|
||||
`complex_id` VARCHAR(191) NOT NULL,
|
||||
CREATE TABLE `consumer_accounts` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`role` ENUM('OWNER', 'MANAGER', 'OPERATOR') NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`consumer_id` VARCHAR(191) NOT NULL,
|
||||
`account_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
INDEX `customer_individuals_complex_id_idx`(`complex_id`),
|
||||
UNIQUE INDEX `customer_individuals_complex_id_national_id_key`(`complex_id`, `national_id`),
|
||||
PRIMARY KEY (`customer_id`)
|
||||
UNIQUE INDEX `consumer_accounts_account_id_key`(`account_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `customer_legal` (
|
||||
`company_name` VARCHAR(255) NOT NULL,
|
||||
`economic_code` CHAR(10) NOT NULL,
|
||||
`registration_number` CHAR(20) NOT NULL,
|
||||
`postal_code` CHAR(10) NOT NULL,
|
||||
`customer_id` VARCHAR(191) NOT NULL,
|
||||
`complex_id` VARCHAR(191) NOT NULL,
|
||||
CREATE TABLE `consumers` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`type` ENUM('INDIVIDUAL', 'LEGAL') NOT NULL,
|
||||
`status` ENUM('ACTIVE', 'SUSPENDED') NOT NULL DEFAULT 'ACTIVE',
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
|
||||
INDEX `customer_legal_complex_id_idx`(`complex_id`),
|
||||
UNIQUE INDEX `customer_legal_complex_id_registration_number_key`(`complex_id`, `registration_number`),
|
||||
PRIMARY KEY (`customer_id`)
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `consumers_individual` (
|
||||
`first_name` VARCHAR(191) NOT NULL,
|
||||
`last_name` VARCHAR(191) NOT NULL,
|
||||
`mobile_number` VARCHAR(191) NOT NULL,
|
||||
`national_code` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NOT NULL,
|
||||
`consumer_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `consumers_individual_mobile_number_consumer_id_key`(`mobile_number`, `consumer_id`),
|
||||
UNIQUE INDEX `consumers_individual_partner_id_national_code_key`(`partner_id`, `national_code`),
|
||||
PRIMARY KEY (`consumer_id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `consumers_legal` (
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`registration_code` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`partner_id` VARCHAR(191) NOT NULL,
|
||||
`consumer_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `consumers_legal_partner_id_registration_code_key`(`partner_id`, `registration_code`),
|
||||
PRIMARY KEY (`consumer_id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `business_activities` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`economic_code` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`fiscal_id` VARCHAR(191) NOT NULL,
|
||||
`partner_token` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`guild_id` VARCHAR(191) NOT NULL,
|
||||
`consumer_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `business_activities_economic_code_consumer_id_key`(`economic_code`, `consumer_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `complexes` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`branch_code` VARCHAR(191) NOT NULL,
|
||||
`address` VARCHAR(191) NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`business_activity_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `poses` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`model` VARCHAR(191) NULL,
|
||||
`serial_number` VARCHAR(191) NULL,
|
||||
`status` ENUM('ACTIVE', 'DISABLED') NOT NULL DEFAULT 'ACTIVE',
|
||||
`pos_type` ENUM('PSP', 'MOBILE', 'WEB', 'API') NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`complex_id` VARCHAR(191) NOT NULL,
|
||||
`device_id` VARCHAR(191) NULL,
|
||||
`provider_id` VARCHAR(191) NULL,
|
||||
`account_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `poses_serial_number_key`(`serial_number`),
|
||||
UNIQUE INDEX `poses_account_id_key`(`account_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
@@ -316,18 +407,19 @@ CREATE TABLE `goods` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`is_default_guild_good` BOOLEAN NOT NULL DEFAULT false,
|
||||
`sku` VARCHAR(100) NOT NULL,
|
||||
`unit_type` ENUM('COUNT', 'GRAM', 'KILOGRAM', 'MILLILITER', 'LITER', 'METER', 'HOUR') NOT NULL,
|
||||
`pricing_model` ENUM('STANDARD', 'GOLD') NOT NULL,
|
||||
`description` TEXT NULL,
|
||||
`local_sku` VARCHAR(100) NULL,
|
||||
`barcode` VARCHAR(100) NULL,
|
||||
`base_sale_price` DECIMAL(15, 0) NULL DEFAULT 0.00,
|
||||
`image_url` VARCHAR(255) NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`deleted_at` TIMESTAMP(0) NULL,
|
||||
`complex_id` VARCHAR(191) NULL,
|
||||
`sku_id` VARCHAR(191) NOT NULL,
|
||||
`measure_unit_id` VARCHAR(191) NOT NULL,
|
||||
`category_id` VARCHAR(191) NULL,
|
||||
`business_activity_id` VARCHAR(191) NULL,
|
||||
|
||||
UNIQUE INDEX `goods_local_sku_key`(`local_sku`),
|
||||
UNIQUE INDEX `goods_barcode_key`(`barcode`),
|
||||
@@ -351,6 +443,87 @@ CREATE TABLE `good_categories` (
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `measure_units` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`code` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
|
||||
UNIQUE INDEX `measure_units_code_key`(`code`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `stock_keeping_units` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`code` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`VAT` DECIMAL(5, 2) NOT NULL,
|
||||
`type` ENUM('GOLD') NOT NULL DEFAULT 'GOLD',
|
||||
`is_public` BOOLEAN NOT NULL DEFAULT true,
|
||||
`is_domestic` BOOLEAN NOT NULL DEFAULT false,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `stock_keeping_units_code_key`(`code`),
|
||||
INDEX `stock_keeping_units_code_idx`(`code`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `trigger_logs` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`message` TEXT NOT NULL,
|
||||
`createdAt` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`name` TEXT NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `customers` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`is_favorite` BOOLEAN NULL DEFAULT false,
|
||||
`type` ENUM('INDIVIDUAL', 'LEGAL', 'UNKNOWN') NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`deleted_at` TIMESTAMP(0) NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `customer_individuals` (
|
||||
`first_name` VARCHAR(255) NOT NULL,
|
||||
`last_name` VARCHAR(255) NOT NULL,
|
||||
`national_id` CHAR(10) NOT NULL,
|
||||
`mobile_number` CHAR(15) NOT NULL,
|
||||
`postal_code` CHAR(10) NOT NULL,
|
||||
`economic_code` CHAR(10) NULL,
|
||||
`customer_id` VARCHAR(191) NOT NULL,
|
||||
`business_activity_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
INDEX `customer_individuals_business_activity_id_idx`(`business_activity_id`),
|
||||
UNIQUE INDEX `customer_individuals_business_activity_id_national_id_key`(`business_activity_id`, `national_id`),
|
||||
PRIMARY KEY (`customer_id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `customer_legal` (
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`economic_code` CHAR(10) NOT NULL,
|
||||
`registration_number` CHAR(20) NULL,
|
||||
`postal_code` CHAR(10) NOT NULL,
|
||||
`customer_id` VARCHAR(191) NOT NULL,
|
||||
`business_activity_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
INDEX `customer_legal_business_activity_id_idx`(`business_activity_id`),
|
||||
UNIQUE INDEX `customer_legal_business_activity_id_economic_code_key`(`business_activity_id`, `economic_code`),
|
||||
PRIMARY KEY (`customer_id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `guilds` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
@@ -367,16 +540,18 @@ CREATE TABLE `sales_invoices` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`code` VARCHAR(100) NOT NULL,
|
||||
`total_amount` DECIMAL(15, 2) NOT NULL,
|
||||
`invoice_number` INTEGER NOT NULL,
|
||||
`invoice_date` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`notes` TEXT NULL,
|
||||
`unknown_customer` JSON NULL,
|
||||
`invoice_date` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`customer_id` VARCHAR(191) NULL,
|
||||
`account_id` VARCHAR(191) NOT NULL,
|
||||
`consumer_account_id` VARCHAR(191) NOT NULL,
|
||||
`pos_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `sales_invoices_code_key`(`code`),
|
||||
UNIQUE INDEX `sales_invoices_invoice_number_pos_id_key`(`invoice_number`, `pos_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
@@ -384,34 +559,90 @@ CREATE TABLE `sales_invoices` (
|
||||
CREATE TABLE `sales_invoice_items` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`quantity` DECIMAL(10, 0) NOT NULL,
|
||||
`unit_type` ENUM('COUNT', 'GRAM', 'KILOGRAM', 'MILLILITER', 'LITER', 'METER', 'HOUR') NOT NULL,
|
||||
`measure_unit_text` VARCHAR(50) NOT NULL,
|
||||
`measure_unit_code` VARCHAR(50) NOT NULL,
|
||||
`sku_code` VARCHAR(50) NOT NULL,
|
||||
`sku_vat` DECIMAL(15, 2) NOT NULL DEFAULT 0.00,
|
||||
`unit_price` DECIMAL(15, 2) NOT NULL DEFAULT 0.00,
|
||||
`total_amount` DECIMAL(15, 2) NOT NULL DEFAULT 0.00,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`discount` DECIMAL(15, 2) NOT NULL DEFAULT 0.00,
|
||||
`notes` TEXT NULL,
|
||||
`payload` JSON NULL,
|
||||
`good_snapshot` JSON NULL,
|
||||
`invoice_id` VARCHAR(191) NOT NULL,
|
||||
`good_id` VARCHAR(191) NULL,
|
||||
`service_id` VARCHAR(191) NULL,
|
||||
`payload` JSON NULL,
|
||||
|
||||
INDEX `sales_invoice_items_invoice_id_good_id_idx`(`invoice_id`, `good_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `sale_invoice_fiscals` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`retry_count` INTEGER NOT NULL DEFAULT 0,
|
||||
`last_attempt_at` TIMESTAMP(0) NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`updated_at` TIMESTAMP(0) NOT NULL,
|
||||
`invoice_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `sale_invoice_fiscals_invoice_id_key`(`invoice_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `sale_invoice_fiscal_attempts` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`attempt_no` INTEGER NOT NULL,
|
||||
`status` ENUM('SUCCESS', 'FAILURE', 'NOT_SEND', 'QUEUED') NOT NULL,
|
||||
`tax_id` VARCHAR(191) NULL,
|
||||
`type` ENUM('MAIN', 'UPDATE', 'REVOKE', 'REMOVE') NOT NULL,
|
||||
`request_payload` JSON NULL,
|
||||
`response_payload` JSON NULL,
|
||||
`error_message` TEXT NULL,
|
||||
`sent_at` TIMESTAMP(0) NULL,
|
||||
`received_at` TIMESTAMP(0) NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`fiscal_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `sale_invoice_fiscal_attempts_tax_id_key`(`tax_id`),
|
||||
INDEX `sale_invoice_fiscal_attempts_status_idx`(`status`),
|
||||
INDEX `sale_invoice_fiscal_attempts_tax_id_idx`(`tax_id`),
|
||||
UNIQUE INDEX `sale_invoice_fiscal_attempts_fiscal_id_attempt_no_key`(`fiscal_id`, `attempt_no`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `sales_invoice_payments` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`invoice_id` VARCHAR(191) NOT NULL,
|
||||
`amount` DECIMAL(15, 2) NOT NULL,
|
||||
`payment_method` ENUM('TERMINAL', 'CASH', 'SET_OFF', 'CARD', 'BANK', 'CHECK', 'OTHER') NOT NULL,
|
||||
`paid_at` DATETIME(3) NOT NULL,
|
||||
`created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
`paid_at` TIMESTAMP(0) NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`invoice_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
INDEX `sales_invoice_payments_invoice_id_idx`(`invoice_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `sales_invoice_payment_terminal_info` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`terminal_id` VARCHAR(191) NOT NULL,
|
||||
`stan` VARCHAR(191) NOT NULL,
|
||||
`rrn` VARCHAR(191) NOT NULL,
|
||||
`transaction_date_time` DATETIME(3) NOT NULL,
|
||||
`customer_card_no` VARCHAR(191) NULL,
|
||||
`description` VARCHAR(191) NULL,
|
||||
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
`payment_id` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `sales_invoice_payment_terminal_info_payment_id_key`(`payment_id`),
|
||||
UNIQUE INDEX `sales_invoice_payment_terminal_info_terminal_id_stan_rrn_pay_key`(`terminal_id`, `stan`, `rrn`, `payment_id`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `services` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
@@ -456,12 +687,99 @@ ALTER TABLE `admin_accounts` ADD CONSTRAINT `admin_accounts_admin_id_fkey` FOREI
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `admin_accounts` ADD CONSTRAINT `admin_accounts_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `devices` ADD CONSTRAINT `devices_brand_id_fkey` FOREIGN KEY (`brand_id`) REFERENCES `device_brands`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_charged_transactions` ADD CONSTRAINT `license_charged_transactions_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `licenses` ADD CONSTRAINT `licenses_charge_transaction_id_fkey` FOREIGN KEY (`charge_transaction_id`) REFERENCES `license_charged_transactions`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `licenses_activated` ADD CONSTRAINT `licenses_activated_license_id_fkey` FOREIGN KEY (`license_id`) REFERENCES `licenses`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `licenses_activated` ADD CONSTRAINT `licenses_activated_business_activity_id_fkey` FOREIGN KEY (`business_activity_id`) REFERENCES `business_activities`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_renew_charge_transaction` ADD CONSTRAINT `license_renew_charge_transaction_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_renew` ADD CONSTRAINT `license_renew_charge_transaction_id_fkey` FOREIGN KEY (`charge_transaction_id`) REFERENCES `license_renew_charge_transaction`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_renew` ADD CONSTRAINT `license_renew_activation_id_fkey` FOREIGN KEY (`activation_id`) REFERENCES `licenses_activated`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `partner_account_quota_charge_transaction` ADD CONSTRAINT `partner_account_quota_charge_transaction_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `partner_account_quota_credit` ADD CONSTRAINT `partner_account_quota_credit_charge_transaction_id_fkey` FOREIGN KEY (`charge_transaction_id`) REFERENCES `partner_account_quota_charge_transaction`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_license_activation_id_fkey` FOREIGN KEY (`license_activation_id`) REFERENCES `licenses_activated`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_credit_id_fkey` FOREIGN KEY (`credit_id`) REFERENCES `partner_account_quota_credit`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `partner_accounts` ADD CONSTRAINT `partner_accounts_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `partner_accounts` ADD CONSTRAINT `partner_accounts_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_consumers` ADD CONSTRAINT `permission_consumers_consumer_account_id_fkey` FOREIGN KEY (`consumer_account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_poses` ADD CONSTRAINT `permission_poses_pos_id_fkey` FOREIGN KEY (`pos_id`) REFERENCES `poses`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_poses` ADD CONSTRAINT `permission_poses_permission_id_fkey` FOREIGN KEY (`permission_id`) REFERENCES `permission_consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_complexes` ADD CONSTRAINT `permission_complexes_complex_id_fkey` FOREIGN KEY (`complex_id`) REFERENCES `complexes`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_complexes` ADD CONSTRAINT `permission_complexes_permission_id_fkey` FOREIGN KEY (`permission_id`) REFERENCES `permission_consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_business_activities` ADD CONSTRAINT `permission_business_activities_business_id_fkey` FOREIGN KEY (`business_id`) REFERENCES `business_activities`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_business_activities` ADD CONSTRAINT `permission_business_activities_permission_id_fkey` FOREIGN KEY (`permission_id`) REFERENCES `permission_consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `provider_accounts` ADD CONSTRAINT `provider_accounts_provider_id_fkey` FOREIGN KEY (`provider_id`) REFERENCES `providers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `provider_accounts` ADD CONSTRAINT `provider_accounts_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `consumer_devices` ADD CONSTRAINT `consumer_devices_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `consumer_accounts` ADD CONSTRAINT `consumer_accounts_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `consumer_accounts` ADD CONSTRAINT `consumer_accounts_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `consumers_individual` ADD CONSTRAINT `consumers_individual_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `consumers_individual` ADD CONSTRAINT `consumers_individual_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `consumers_legal` ADD CONSTRAINT `consumers_legal_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `consumers_legal` ADD CONSTRAINT `consumers_legal_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `business_activities` ADD CONSTRAINT `business_activities_guild_id_fkey` FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
@@ -481,64 +799,19 @@ ALTER TABLE `poses` ADD CONSTRAINT `poses_device_id_fkey` FOREIGN KEY (`device_i
|
||||
ALTER TABLE `poses` ADD CONSTRAINT `poses_provider_id_fkey` FOREIGN KEY (`provider_id`) REFERENCES `providers`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `devices` ADD CONSTRAINT `devices_brand_id_fkey` FOREIGN KEY (`brand_id`) REFERENCES `device_brands`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE `poses` ADD CONSTRAINT `poses_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `licenses` ADD CONSTRAINT `licenses_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
ALTER TABLE `goods` ADD CONSTRAINT `goods_sku_id_fkey` FOREIGN KEY (`sku_id`) REFERENCES `stock_keeping_units`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `licenses` ADD CONSTRAINT `licenses_consumer_id_fkey` FOREIGN KEY (`consumer_id`) REFERENCES `consumers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `partner_accounts` ADD CONSTRAINT `partner_accounts_partner_id_fkey` FOREIGN KEY (`partner_id`) REFERENCES `partners`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `partner_accounts` ADD CONSTRAINT `partner_accounts_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_consumers` ADD CONSTRAINT `permission_consumers_consumer_account_id_fkey` FOREIGN KEY (`consumer_account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_poses` ADD CONSTRAINT `permission_poses_pos_id_fkey` FOREIGN KEY (`pos_id`) REFERENCES `poses`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_poses` ADD CONSTRAINT `permission_poses_permission_id_fkey` FOREIGN KEY (`permission_id`) REFERENCES `permission_consumers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_complexes` ADD CONSTRAINT `permission_complexes_complex_id_fkey` FOREIGN KEY (`complex_id`) REFERENCES `complexes`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_complexes` ADD CONSTRAINT `permission_complexes_permission_id_fkey` FOREIGN KEY (`permission_id`) REFERENCES `permission_consumers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_business_activities` ADD CONSTRAINT `permission_business_activities_business_id_fkey` FOREIGN KEY (`business_id`) REFERENCES `business_activities`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `permission_business_activities` ADD CONSTRAINT `permission_business_activities_permission_id_fkey` FOREIGN KEY (`permission_id`) REFERENCES `permission_consumers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `provider_accounts` ADD CONSTRAINT `provider_accounts_provider_id_fkey` FOREIGN KEY (`provider_id`) REFERENCES `providers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `provider_accounts` ADD CONSTRAINT `provider_accounts_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `customer_individuals` ADD CONSTRAINT `customer_individuals_customer_id_fkey` FOREIGN KEY (`customer_id`) REFERENCES `customers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `customer_individuals` ADD CONSTRAINT `customer_individuals_complex_id_fkey` FOREIGN KEY (`complex_id`) REFERENCES `complexes`(`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 CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `customer_legal` ADD CONSTRAINT `customer_legal_complex_id_fkey` FOREIGN KEY (`complex_id`) REFERENCES `complexes`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE `goods` ADD CONSTRAINT `goods_measure_unit_id_fkey` FOREIGN KEY (`measure_unit_id`) REFERENCES `measure_units`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `goods` ADD CONSTRAINT `goods_category_id_fkey` FOREIGN KEY (`category_id`) REFERENCES `good_categories`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `goods` ADD CONSTRAINT `goods_complex_id_fkey` FOREIGN KEY (`complex_id`) REFERENCES `complexes`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
ALTER TABLE `goods` ADD CONSTRAINT `goods_business_activity_id_fkey` FOREIGN KEY (`business_activity_id`) REFERENCES `business_activities`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `good_categories` ADD CONSTRAINT `good_categories_guild_id_fkey` FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -546,14 +819,26 @@ ALTER TABLE `good_categories` ADD CONSTRAINT `good_categories_guild_id_fkey` FOR
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `good_categories` ADD CONSTRAINT `good_categories_complex_id_fkey` FOREIGN KEY (`complex_id`) REFERENCES `complexes`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `customer_individuals` ADD CONSTRAINT `customer_individuals_customer_id_fkey` FOREIGN KEY (`customer_id`) REFERENCES `customers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `customer_individuals` ADD CONSTRAINT `customer_individuals_business_activity_id_fkey` FOREIGN KEY (`business_activity_id`) REFERENCES `business_activities`(`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 CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `customer_legal` ADD CONSTRAINT `customer_legal_business_activity_id_fkey` FOREIGN KEY (`business_activity_id`) REFERENCES `business_activities`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sales_invoices` ADD CONSTRAINT `sales_invoices_customer_id_fkey` FOREIGN KEY (`customer_id`) REFERENCES `customers`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sales_invoices` ADD CONSTRAINT `sales_invoices_pos_id_fkey` FOREIGN KEY (`pos_id`) REFERENCES `poses`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE `sales_invoices` ADD CONSTRAINT `sales_invoices_consumer_account_id_fkey` FOREIGN KEY (`consumer_account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sales_invoices` ADD CONSTRAINT `sales_invoices_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE `sales_invoices` ADD CONSTRAINT `sales_invoices_pos_id_fkey` FOREIGN KEY (`pos_id`) REFERENCES `poses`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sales_invoice_items` ADD CONSTRAINT `sales_invoice_items_invoice_id_fkey` FOREIGN KEY (`invoice_id`) REFERENCES `sales_invoices`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -564,8 +849,17 @@ ALTER TABLE `sales_invoice_items` ADD CONSTRAINT `sales_invoice_items_good_id_fk
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sales_invoice_items` ADD CONSTRAINT `sales_invoice_items_service_id_fkey` FOREIGN KEY (`service_id`) REFERENCES `services`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sale_invoice_fiscals` ADD CONSTRAINT `sale_invoice_fiscals_invoice_id_fkey` FOREIGN KEY (`invoice_id`) REFERENCES `sales_invoices`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sale_invoice_fiscal_attempts` ADD CONSTRAINT `sale_invoice_fiscal_attempts_fiscal_id_fkey` FOREIGN KEY (`fiscal_id`) REFERENCES `sale_invoice_fiscals`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sales_invoice_payments` ADD CONSTRAINT `sales_invoice_payments_invoice_id_fkey` FOREIGN KEY (`invoice_id`) REFERENCES `sales_invoices`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `sales_invoice_payment_terminal_info` ADD CONSTRAINT `sales_invoice_payment_terminal_info_payment_id_fkey` FOREIGN KEY (`payment_id`) REFERENCES `sales_invoice_payments`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `services` ADD CONSTRAINT `services_category_id_fkey` FOREIGN KEY (`category_id`) REFERENCES `service_categories`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -8,7 +8,7 @@ model AdminAccount {
|
||||
admin Admin @relation(fields: [admin_id], references: [id])
|
||||
|
||||
account_id String @unique
|
||||
account Account @relation(fields: [account_id], references: [id])
|
||||
account Account @relation(fields: [account_id], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("admin_accounts")
|
||||
}
|
||||
|
||||
@@ -10,6 +10,18 @@ model Account {
|
||||
partner_account PartnerAccount?
|
||||
consumer_account ConsumerAccount?
|
||||
|
||||
// admin_account_id String? @unique
|
||||
// admin_account AdminAccount? @relation(fields: [admin_account_id], references: [id], onDelete: Cascade)
|
||||
|
||||
// provider_account_id String? @unique
|
||||
// provider_account ProviderAccount? @relation(fields: [provider_account_id], references: [id], onDelete: Cascade)
|
||||
|
||||
// partner_account_id String? @unique
|
||||
// partner_account PartnerAccount? @relation(fields: [partner_account_id], references: [id], onDelete: Cascade)
|
||||
|
||||
// consumer_account_id String? @unique
|
||||
// consumer_account ConsumerAccount? @relation(fields: [consumer_account_id], references: [id], onDelete: Cascade)
|
||||
|
||||
// tokens Token[]
|
||||
// refresh_tokens RefreshToken[]
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ model PartnerAccount {
|
||||
partner Partner @relation(fields: [partner_id], references: [id])
|
||||
|
||||
account_id String @unique
|
||||
account Account @relation(fields: [account_id], references: [id])
|
||||
account Account @relation(fields: [account_id], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("partner_accounts")
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ model ProviderAccount {
|
||||
provider Provider @relation(fields: [provider_id], references: [id])
|
||||
|
||||
account_id String @unique
|
||||
account Account @relation(fields: [account_id], references: [id])
|
||||
account Account @relation(fields: [account_id], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("provider_accounts")
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ model Good {
|
||||
id String @id @default(ulid())
|
||||
name String @db.VarChar(255)
|
||||
is_default_guild_good Boolean @default(false)
|
||||
sku String @db.VarChar(100)
|
||||
unit_type UnitType
|
||||
pricing_model GoodPricingModel
|
||||
description String? @db.Text
|
||||
local_sku String? @unique() @db.VarChar(100)
|
||||
@@ -15,6 +13,12 @@ model Good {
|
||||
updated_at DateTime @updatedAt @db.Timestamp(0)
|
||||
deleted_at DateTime? @db.Timestamp(0)
|
||||
|
||||
sku_id String
|
||||
sku StockKeepingUnits @relation(fields: [sku_id], references: [id])
|
||||
|
||||
measure_unit_id String
|
||||
measure_unit MeasureUnits @relation(fields: [measure_unit_id], references: [id])
|
||||
|
||||
category_id String?
|
||||
category GoodCategory? @relation(fields: [category_id], references: [id])
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
model MeasureUnits {
|
||||
id String @id @default(ulid())
|
||||
code String @unique
|
||||
name String
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(0)
|
||||
|
||||
goods Good[]
|
||||
|
||||
@@map("measure_units")
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
model StockKeepingUnits {
|
||||
id String @id @default(ulid())
|
||||
code String @unique
|
||||
name String
|
||||
VAT Decimal @db.Decimal(5, 2)
|
||||
type SKUGuildType @default(GOLD)
|
||||
is_public Boolean @default(true)
|
||||
is_domestic Boolean @default(false)
|
||||
|
||||
created_at DateTime @default(now()) @db.Timestamp(0)
|
||||
updated_at DateTime @updatedAt() @db.Timestamp(0)
|
||||
|
||||
goods Good[]
|
||||
|
||||
@@index([code])
|
||||
@@map("stock_keeping_units")
|
||||
}
|
||||
@@ -36,7 +36,7 @@ model CustomerIndividual {
|
||||
}
|
||||
|
||||
model CustomerLegal {
|
||||
company_name String @db.VarChar(255)
|
||||
name String @db.VarChar(255)
|
||||
economic_code String @db.Char(10)
|
||||
registration_number String? @db.Char(20)
|
||||
postal_code String @db.Char(10)
|
||||
|
||||
@@ -165,4 +165,21 @@ enum FiscalResponseStatus {
|
||||
SUCCESS
|
||||
FAILURE
|
||||
NOT_SEND
|
||||
QUEUED
|
||||
}
|
||||
|
||||
enum FiscalRequestType {
|
||||
MAIN
|
||||
UPDATE
|
||||
REVOKE
|
||||
REMOVE
|
||||
}
|
||||
|
||||
enum FiscalInvoiceCustomerType {
|
||||
Unknown
|
||||
Known
|
||||
}
|
||||
|
||||
enum SKUGuildType {
|
||||
GOLD
|
||||
}
|
||||
|
||||
@@ -32,7 +32,10 @@ model SalesInvoice {
|
||||
model SalesInvoiceItem {
|
||||
id String @id @default(ulid())
|
||||
quantity Decimal @db.Decimal(10, 0)
|
||||
unit_type UnitType
|
||||
measure_unit_text String @db.VarChar(50)
|
||||
measure_unit_code String @db.VarChar(50)
|
||||
sku_code String @db.VarChar(50)
|
||||
sku_vat Decimal @default(0.00) @db.Decimal(15, 2)
|
||||
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)
|
||||
@@ -76,8 +79,9 @@ model SaleInvoiceFiscalAttempts {
|
||||
id String @id @default(ulid())
|
||||
|
||||
attempt_no Int
|
||||
status String @db.VarChar(50)
|
||||
status FiscalResponseStatus
|
||||
tax_id String? @unique @db.VarChar(191)
|
||||
type FiscalRequestType
|
||||
|
||||
request_payload Json?
|
||||
response_payload Json?
|
||||
|
||||
+293
-142
@@ -4,14 +4,14 @@ import {
|
||||
ConsumerType,
|
||||
GoodPricingModel,
|
||||
PartnerFiscalSwitchType,
|
||||
UnitType,
|
||||
} from '@/generated/prisma/enums'
|
||||
import { GoodCreateInput, GoodCreateManyInput } from '@/generated/prisma/models'
|
||||
import { GoodCreateManyInput } from '@/generated/prisma/models'
|
||||
import { prisma } from '../src/lib/prisma'
|
||||
|
||||
async function main() {
|
||||
const password = await PasswordUtil.hash('123456')
|
||||
const adminUser = await prisma.admin.upsert({
|
||||
await prisma.$transaction(async tx => {
|
||||
const adminUser = await tx.admin.upsert({
|
||||
where: {
|
||||
mobile_number: '09120258156',
|
||||
},
|
||||
@@ -36,10 +36,101 @@ async function main() {
|
||||
},
|
||||
})
|
||||
|
||||
const measureUnits = await tx.measureUnits.createMany({
|
||||
data: [
|
||||
{ code: '1', name: 'لنگه' },
|
||||
{ code: '2', name: 'ثوب' },
|
||||
{ code: '3', name: 'عدل' },
|
||||
{ code: '4', name: 'نیم دوجین' },
|
||||
{ code: '5', name: 'جعبه' },
|
||||
{ code: '6', name: 'قرقره' },
|
||||
{ code: '7', name: 'توپ' },
|
||||
{ code: '8', name: 'کیلوگرم' },
|
||||
{ code: '9', name: 'ست' },
|
||||
{ code: '10', name: 'بطری' },
|
||||
{ code: '11', name: 'دست' },
|
||||
{ code: '12', name: 'برگ' },
|
||||
{ code: '13', name: 'کارتن' },
|
||||
{ code: '14', name: 'سطل' },
|
||||
{ code: '15', name: 'عدد' },
|
||||
{ code: '16', name: 'ورق' },
|
||||
{ code: '17', name: 'بسته' },
|
||||
{ code: '18', name: 'شاخه' },
|
||||
{ code: '19', name: 'پاکت' },
|
||||
{ code: '20', name: 'قوطی' },
|
||||
{ code: '21', name: 'دستگاه' },
|
||||
{ code: '22', name: 'جلد' },
|
||||
{ code: '23', name: 'تخته' },
|
||||
{ code: '24', name: 'تیوب' },
|
||||
{ code: '25', name: 'رول' },
|
||||
{ code: '26', name: 'متر' },
|
||||
{ code: '27', name: 'طاقه' },
|
||||
{ code: '28', name: 'کلاف' },
|
||||
{ code: '29', name: 'جفت' },
|
||||
{ code: '30', name: 'کیسه' },
|
||||
{ code: '31', name: 'متر مربع' },
|
||||
{ code: '32', name: 'طغرا' },
|
||||
{ code: '33', name: 'پالت' },
|
||||
{ code: '34', name: 'بشکه' },
|
||||
{ code: '35', name: 'دوجین' },
|
||||
{ code: '36', name: 'گالن' },
|
||||
{ code: '37', name: '(رینگ)حلقه' },
|
||||
{ code: '38', name: 'فاقد بسته بندی' },
|
||||
{ code: '39', name: 'قراص' },
|
||||
{ code: '40', name: 'کارتن' },
|
||||
{ code: '41', name: 'قراصه' },
|
||||
{ code: '42', name: 'صفحه' },
|
||||
{ code: '43', name: 'لیتر' },
|
||||
{ code: '44', name: 'مخزن' },
|
||||
{ code: '45', name: 'ساشه' },
|
||||
{ code: '46', name: 'تانکر' },
|
||||
{ code: '47', name: 'کپسول' },
|
||||
{ code: '48', name: 'دبه' },
|
||||
{ code: '49', name: 'بندیل' },
|
||||
{ code: '50', name: 'سبد' },
|
||||
{ code: '51', name: '(رول)حلقه' },
|
||||
{ code: '52', name: 'تن' },
|
||||
{ code: '53', name: 'قالب' },
|
||||
{ code: '54', name: 'بانکه' },
|
||||
{ code: '55', name: 'شانه' },
|
||||
{ code: '56', name: 'سیلندر' },
|
||||
{ code: '57', name: 'متر مکعب' },
|
||||
{ code: '58', name: 'فوت مربع' },
|
||||
{ code: '59', name: 'حلب' },
|
||||
{ code: '60', name: 'شیت' },
|
||||
{ code: '61', name: 'چلیک' },
|
||||
{ code: '62', name: 'جام' },
|
||||
{ code: '63', name: 'گرم' },
|
||||
{ code: '64', name: 'نخ' },
|
||||
{ code: '65', name: 'شعله' },
|
||||
{ code: '66', name: 'قیراط' },
|
||||
{ code: '67', name: 'میلی لیتر' },
|
||||
{ code: '68', name: 'میلی متر' },
|
||||
{ code: '69', name: 'میلی گرم' },
|
||||
{ code: '70', name: 'ساعت' },
|
||||
{ code: '71', name: 'روز' },
|
||||
{ code: '72', name: 'تن کیلومتر' },
|
||||
{ code: '73', name: 'کیلووات ساعت' },
|
||||
{ code: '74', name: 'نفر' },
|
||||
{ code: '75', name: 'ثانیه' },
|
||||
{ code: '76', name: 'دقیقه' },
|
||||
{ code: '77', name: 'ماه' },
|
||||
{ code: '78', name: 'سال' },
|
||||
{ code: '79', name: 'قطعه' },
|
||||
{ code: '80', name: 'سانتی متر' },
|
||||
{ code: '81', name: 'سانتی متر مربع' },
|
||||
{ code: '82', name: 'فروند' },
|
||||
{ code: '83', name: 'واحد' },
|
||||
{ code: '84', name: 'لیوان' },
|
||||
{ code: '85', name: 'نوبت)`,' },
|
||||
],
|
||||
skipDuplicates: true,
|
||||
})
|
||||
|
||||
// ****************** GUILD Start ****************** //
|
||||
const guilds = await prisma.guild.findMany()
|
||||
let guilds = await tx.guild.findMany()
|
||||
if (!guilds.length) {
|
||||
await prisma.guild.createMany({
|
||||
await tx.guild.createMany({
|
||||
data: [
|
||||
{
|
||||
name: 'طلا',
|
||||
@@ -51,18 +142,19 @@ async function main() {
|
||||
},
|
||||
],
|
||||
})
|
||||
guilds = await tx.guild.findMany()
|
||||
}
|
||||
|
||||
// ****************** GUILD Good Categories Start ****************** //
|
||||
|
||||
const goldGuild = await prisma.guild.findFirst({
|
||||
const goldGuild = await tx.guild.findFirst({
|
||||
where: {
|
||||
name: 'طلا',
|
||||
code: 'Gold',
|
||||
},
|
||||
})
|
||||
|
||||
const goldGuildId = goldGuild?.id
|
||||
const goldGuildGoodCategories = await prisma.goodCategory.findMany({
|
||||
const goldGuildGoodCategories = await tx.goodCategory.findMany({
|
||||
where: {
|
||||
guild_id: goldGuildId,
|
||||
is_default_guild_good: true,
|
||||
@@ -76,40 +168,61 @@ async function main() {
|
||||
is_default_guild_good: true,
|
||||
})
|
||||
|
||||
await prisma.goodCategory.createMany({
|
||||
await tx.goodCategory.createMany({
|
||||
data: [
|
||||
categoryFactory('زیورآلات'),
|
||||
categoryFactory('طلا'),
|
||||
categoryFactory('سایر'),
|
||||
categoryFactory('سکه'),
|
||||
categoryFactory('شمش'),
|
||||
categoryFactory('شمش'),
|
||||
// categoryFactory('طلا'),
|
||||
// categoryFactory('سایر'),
|
||||
// categoryFactory('سکه'),
|
||||
// categoryFactory('شمش'),
|
||||
// categoryFactory('شمش'),
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
const measureUnit = await tx.measureUnits.findFirst({
|
||||
where: {
|
||||
code: '63',
|
||||
},
|
||||
})
|
||||
|
||||
if (measureUnit) {
|
||||
// ****************** GUILD Good Start ****************** //
|
||||
const goodFactory = (
|
||||
async function goodFactory(
|
||||
name: string,
|
||||
categoryId: string,
|
||||
pricingModel: GoodPricingModel,
|
||||
unitType: UnitType,
|
||||
): GoodCreateManyInput => ({
|
||||
sku_code: string,
|
||||
measure_unit_code: string,
|
||||
): Promise<GoodCreateManyInput | null> {
|
||||
const sku = await tx.stockKeepingUnits.findUnique({
|
||||
where: {
|
||||
code: sku_code,
|
||||
},
|
||||
})
|
||||
console.log(name)
|
||||
console.log(sku?.id)
|
||||
|
||||
if (sku) {
|
||||
return {
|
||||
name,
|
||||
category_id: categoryId,
|
||||
pricing_model: pricingModel,
|
||||
sku: '',
|
||||
unit_type: unitType,
|
||||
sku_id: sku.id,
|
||||
measure_unit_id: measureUnit!.id,
|
||||
is_default_guild_good: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
const zivarCategory = await prisma.goodCategory.findFirst({
|
||||
const zivarCategory = await tx.goodCategory.findFirst({
|
||||
where: {
|
||||
name: 'زیورآلات',
|
||||
},
|
||||
})
|
||||
if (zivarCategory) {
|
||||
const zivarGoods = await prisma.good.count({
|
||||
const zivarGoods = await tx.good.count({
|
||||
where: {
|
||||
category_id: zivarCategory?.id,
|
||||
},
|
||||
@@ -117,140 +230,177 @@ async function main() {
|
||||
if (!zivarGoods) {
|
||||
const goodItems: GoodCreateManyInput[] = []
|
||||
|
||||
goodItems.push(
|
||||
...[
|
||||
goodFactory(
|
||||
const preparedGoodItems = [
|
||||
await goodFactory(
|
||||
'آویز گردنبند طلا',
|
||||
zivarCategory.id,
|
||||
GoodPricingModel.GOLD,
|
||||
UnitType.GRAM,
|
||||
'2720000044696',
|
||||
'63',
|
||||
),
|
||||
goodFactory('النگو', zivarCategory.id, GoodPricingModel.GOLD, UnitType.GRAM),
|
||||
goodFactory('انگشتر', zivarCategory.id, GoodPricingModel.GOLD, UnitType.GRAM),
|
||||
goodFactory('دستبند', zivarCategory.id, GoodPricingModel.GOLD, UnitType.GRAM),
|
||||
goodFactory('زنجیر', zivarCategory.id, GoodPricingModel.GOLD, UnitType.GRAM),
|
||||
goodFactory('سرویس', zivarCategory.id, GoodPricingModel.GOLD, UnitType.GRAM),
|
||||
goodFactory('گوشواره', zivarCategory.id, GoodPricingModel.GOLD, UnitType.GRAM),
|
||||
],
|
||||
)
|
||||
|
||||
await prisma.good.createMany({ data: goodItems })
|
||||
}
|
||||
}
|
||||
|
||||
const goldCategory = await prisma.goodCategory.findFirst({
|
||||
where: {
|
||||
name: 'طلا',
|
||||
},
|
||||
})
|
||||
if (goldCategory) {
|
||||
const goldGoods = await prisma.good.count({
|
||||
where: {
|
||||
category_id: goldCategory?.id,
|
||||
},
|
||||
})
|
||||
if (!goldGoods) {
|
||||
const goodItems: GoodCreateInput[] = []
|
||||
goodItems.push(
|
||||
...[
|
||||
goodFactory(
|
||||
'طلای آب شده',
|
||||
goldCategory.id,
|
||||
await goodFactory(
|
||||
'النگو',
|
||||
zivarCategory.id,
|
||||
GoodPricingModel.GOLD,
|
||||
UnitType.GRAM,
|
||||
'2720000044665',
|
||||
'63',
|
||||
),
|
||||
goodFactory(
|
||||
'طلای شکسته',
|
||||
goldCategory.id,
|
||||
await goodFactory(
|
||||
'انگشتر',
|
||||
zivarCategory.id,
|
||||
GoodPricingModel.GOLD,
|
||||
UnitType.GRAM,
|
||||
'2720000044672',
|
||||
'63',
|
||||
),
|
||||
goodFactory(
|
||||
'طلای مستعمل',
|
||||
goldCategory.id,
|
||||
await goodFactory(
|
||||
'دستبند',
|
||||
zivarCategory.id,
|
||||
GoodPricingModel.GOLD,
|
||||
UnitType.GRAM,
|
||||
'2720000044689',
|
||||
'63',
|
||||
),
|
||||
],
|
||||
)
|
||||
await prisma.good.createMany({ data: goodItems })
|
||||
await goodFactory(
|
||||
'زنجیر',
|
||||
zivarCategory.id,
|
||||
GoodPricingModel.GOLD,
|
||||
'2720000044702',
|
||||
'63',
|
||||
),
|
||||
await goodFactory(
|
||||
'سرویس',
|
||||
zivarCategory.id,
|
||||
GoodPricingModel.GOLD,
|
||||
'2720000044733',
|
||||
'63',
|
||||
),
|
||||
await goodFactory(
|
||||
'گوشواره',
|
||||
zivarCategory.id,
|
||||
GoodPricingModel.GOLD,
|
||||
'2720000044726',
|
||||
'63',
|
||||
),
|
||||
].filter((item): item is GoodCreateManyInput => item !== null)
|
||||
goodItems.push(...preparedGoodItems)
|
||||
|
||||
await tx.good.createMany({ data: goodItems })
|
||||
}
|
||||
}
|
||||
|
||||
const coinCategory = await prisma.goodCategory.findFirst({
|
||||
where: {
|
||||
name: 'سکه',
|
||||
},
|
||||
})
|
||||
if (coinCategory) {
|
||||
const coinGoods = await prisma.good.count({
|
||||
where: {
|
||||
category_id: coinCategory?.id,
|
||||
},
|
||||
})
|
||||
if (!coinGoods) {
|
||||
const goodItems: GoodCreateInput[] = []
|
||||
goodItems.push(
|
||||
...[
|
||||
goodFactory(
|
||||
'مسکوکات خارجی',
|
||||
coinCategory.id,
|
||||
GoodPricingModel.STANDARD,
|
||||
UnitType.COUNT,
|
||||
),
|
||||
goodFactory(
|
||||
'مسکوکات داخلی (پارسیان)',
|
||||
coinCategory.id,
|
||||
GoodPricingModel.STANDARD,
|
||||
UnitType.COUNT,
|
||||
),
|
||||
goodFactory(
|
||||
'تمام بهار آزادی (طرح جدید)',
|
||||
coinCategory.id,
|
||||
GoodPricingModel.STANDARD,
|
||||
UnitType.COUNT,
|
||||
),
|
||||
goodFactory(
|
||||
'تمام بهار آزادی (طرح قدیم)',
|
||||
coinCategory.id,
|
||||
GoodPricingModel.STANDARD,
|
||||
UnitType.COUNT,
|
||||
),
|
||||
],
|
||||
)
|
||||
await prisma.good.createMany({ data: goodItems })
|
||||
}
|
||||
}
|
||||
// const goldCategory = await tx.goodCategory.findFirst({
|
||||
// where: {
|
||||
// name: 'طلا',
|
||||
// },
|
||||
// })
|
||||
// if (goldCategory) {
|
||||
// const goldGoods = await tx.good.count({
|
||||
// where: {
|
||||
// category_id: goldCategory?.id,
|
||||
// },
|
||||
// })
|
||||
// if (!goldGoods) {
|
||||
// const goodItems: GoodCreateInput[] = []
|
||||
// goodItems.push(
|
||||
// ...[
|
||||
// goodFactory(
|
||||
// 'طلای آب شده',
|
||||
// goldCategory.id,
|
||||
// GoodPricingModel.GOLD,
|
||||
// UnitType.GRAM,
|
||||
// ),
|
||||
// goodFactory(
|
||||
// 'طلای شکسته',
|
||||
// goldCategory.id,
|
||||
// GoodPricingModel.GOLD,
|
||||
// UnitType.GRAM,
|
||||
// ),
|
||||
// goodFactory(
|
||||
// 'طلای مستعمل',
|
||||
// goldCategory.id,
|
||||
// GoodPricingModel.GOLD,
|
||||
// UnitType.GRAM,
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
// await tx.good.createMany({ data: goodItems })
|
||||
// }
|
||||
// }
|
||||
|
||||
const shemshCategory = await prisma.goodCategory.findFirst({
|
||||
where: {
|
||||
name: 'شمش',
|
||||
},
|
||||
})
|
||||
// const coinCategory = await tx.goodCategory.findFirst({
|
||||
// where: {
|
||||
// name: 'سکه',
|
||||
// },
|
||||
// })
|
||||
// if (coinCategory) {
|
||||
// const coinGoods = await tx.good.count({
|
||||
// where: {
|
||||
// category_id: coinCategory?.id,
|
||||
// },
|
||||
// })
|
||||
// if (!coinGoods) {
|
||||
// const goodItems: GoodCreateInput[] = []
|
||||
// goodItems.push(
|
||||
// ...[
|
||||
// goodFactory(
|
||||
// 'مسکوکات خارجی',
|
||||
// coinCategory.id,
|
||||
// GoodPricingModel.STANDARD,
|
||||
// UnitType.COUNT,
|
||||
// ),
|
||||
// goodFactory(
|
||||
// 'مسکوکات داخلی (پارسیان)',
|
||||
// coinCategory.id,
|
||||
// GoodPricingModel.STANDARD,
|
||||
// UnitType.COUNT,
|
||||
// ),
|
||||
// goodFactory(
|
||||
// 'تمام بهار آزادی (طرح جدید)',
|
||||
// coinCategory.id,
|
||||
// GoodPricingModel.STANDARD,
|
||||
// UnitType.COUNT,
|
||||
// ),
|
||||
// goodFactory(
|
||||
// 'تمام بهار آزادی (طرح قدیم)',
|
||||
// coinCategory.id,
|
||||
// GoodPricingModel.STANDARD,
|
||||
// UnitType.COUNT,
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
// await tx.good.createMany({ data: goodItems })
|
||||
// }
|
||||
// }
|
||||
|
||||
if (shemshCategory) {
|
||||
const shemshGoods = await prisma.good.count({
|
||||
where: {
|
||||
category_id: shemshCategory?.id,
|
||||
},
|
||||
})
|
||||
if (!shemshGoods) {
|
||||
await prisma.good.create({
|
||||
data: goodFactory(
|
||||
'شمش استاندارد',
|
||||
shemshCategory.id,
|
||||
GoodPricingModel.GOLD,
|
||||
UnitType.GRAM,
|
||||
),
|
||||
})
|
||||
}
|
||||
// const shemshCategory = await tx.goodCategory.findFirst({
|
||||
// where: {
|
||||
// name: 'شمش',
|
||||
// },
|
||||
// })
|
||||
|
||||
// if (shemshCategory) {
|
||||
// const shemshGoods = await tx.good.count({
|
||||
// where: {
|
||||
// category_id: shemshCategory?.id,
|
||||
// },
|
||||
// })
|
||||
// if (!shemshGoods) {
|
||||
// await tx.good.create({
|
||||
// data: goodFactory(
|
||||
// 'شمش استاندارد',
|
||||
// shemshCategory.id,
|
||||
// GoodPricingModel.GOLD,
|
||||
// UnitType.GRAM,
|
||||
// ),
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// ****************** partner Start ****************** //
|
||||
let partner = await prisma.partner.findFirst()
|
||||
let license = await prisma.license.findFirst()
|
||||
let partner = await tx.partner.findFirst()
|
||||
let license = await tx.license.findFirst()
|
||||
if (!partner) {
|
||||
partner = await prisma.partner.create({
|
||||
partner = await tx.partner.create({
|
||||
data: {
|
||||
name: 'تیس',
|
||||
code: 'TIS',
|
||||
@@ -273,7 +423,7 @@ async function main() {
|
||||
})
|
||||
}
|
||||
if (partner && !license) {
|
||||
await prisma.$transaction(async tx => {
|
||||
await tx.$transaction(async tx => {
|
||||
const startOfToday = new Date()
|
||||
startOfToday.setHours(0, 0, 0, 0)
|
||||
|
||||
@@ -317,7 +467,7 @@ async function main() {
|
||||
}
|
||||
|
||||
// ****************** BA Start ****************** //
|
||||
const ba = await prisma.businessActivity.count()
|
||||
const ba = await tx.businessActivity.count()
|
||||
|
||||
if (!ba && license) {
|
||||
const startOfToday = new Date()
|
||||
@@ -332,7 +482,7 @@ async function main() {
|
||||
|
||||
startOfToday.setFullYear(expYear)
|
||||
|
||||
await prisma.businessActivity.create({
|
||||
await tx.businessActivity.create({
|
||||
data: {
|
||||
name: 'طلا فروشی',
|
||||
economic_code: '0111111111',
|
||||
@@ -422,9 +572,9 @@ async function main() {
|
||||
// ****************** BA Start ****************** //
|
||||
|
||||
// ****************** provider Start ****************** //
|
||||
const provider = await prisma.provider.count()
|
||||
const provider = await tx.provider.count()
|
||||
if (!provider) {
|
||||
await prisma.provider.create({
|
||||
await tx.provider.create({
|
||||
data: {
|
||||
name: 'توسن',
|
||||
code: 'Tosan',
|
||||
@@ -445,6 +595,7 @@ async function main() {
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { prisma } from '../src/lib/prisma'
|
||||
|
||||
type CsvRow = {
|
||||
ID?: string
|
||||
DescriptionOfID?: string
|
||||
Vat?: string
|
||||
Type?: string
|
||||
}
|
||||
|
||||
function parseCsvLine(line: string): string[] {
|
||||
const result: string[] = []
|
||||
let current = ''
|
||||
let inQuotes = false
|
||||
|
||||
for (let index = 0; index < line.length; index++) {
|
||||
const char = line[index]
|
||||
|
||||
if (char === '"') {
|
||||
if (inQuotes && line[index + 1] === '"') {
|
||||
current += '"'
|
||||
index++
|
||||
} else {
|
||||
inQuotes = !inQuotes
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if (char === ',' && !inQuotes) {
|
||||
result.push(current)
|
||||
current = ''
|
||||
continue
|
||||
}
|
||||
|
||||
current += char
|
||||
}
|
||||
|
||||
result.push(current)
|
||||
return result.map(value => value.trim())
|
||||
}
|
||||
|
||||
function parseCsv(content: string): CsvRow[] {
|
||||
const lines = content
|
||||
.split(/\r?\n/)
|
||||
.map(line => line.trim())
|
||||
.filter(Boolean)
|
||||
|
||||
if (!lines.length) return []
|
||||
|
||||
const headers = parseCsvLine(lines[0])
|
||||
return lines.slice(1).map(line => {
|
||||
const cols = parseCsvLine(line)
|
||||
const row: Record<string, string> = {}
|
||||
for (let index = 0; index < headers.length; index++) {
|
||||
row[headers[index]] = cols[index] || ''
|
||||
}
|
||||
return row
|
||||
})
|
||||
}
|
||||
|
||||
function toBooleanFlags(typeValue: string) {
|
||||
const normalized = typeValue || ''
|
||||
const isPublic = normalized.includes('شناسه عمومی')
|
||||
const isImported = normalized.includes('وارداتی')
|
||||
const isDomestic = !isImported
|
||||
|
||||
return { isPublic, isDomestic }
|
||||
}
|
||||
|
||||
function parseVat(vatValue: string) {
|
||||
const parsed = Number(vatValue || '0')
|
||||
if (!Number.isFinite(parsed)) return 0
|
||||
return parsed
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const defaultPath =
|
||||
'/Users/ahasani/Desktop/product_good_2026-05-01T11-35-57_part_1_28812448-0dd9-411c-99e1-334c28d781fe.csv'
|
||||
const csvPath = process.argv[2] || defaultPath
|
||||
const absolutePath = path.resolve(csvPath)
|
||||
|
||||
if (!fs.existsSync(absolutePath)) {
|
||||
throw new Error(`CSV file not found: ${absolutePath}`)
|
||||
}
|
||||
|
||||
const raw = fs.readFileSync(absolutePath, 'utf8').replace(/^\uFEFF/, '')
|
||||
const rows = parseCsv(raw)
|
||||
|
||||
let upserted = 0
|
||||
let skipped = 0
|
||||
|
||||
for (const row of rows) {
|
||||
const code = (row.ID || '').trim()
|
||||
const name = (row.DescriptionOfID || '').trim()
|
||||
const vat = parseVat((row.Vat || '').trim())
|
||||
const type = (row.Type || '').trim()
|
||||
const { isPublic, isDomestic } = toBooleanFlags(type)
|
||||
|
||||
if (!code || !name) {
|
||||
skipped++
|
||||
continue
|
||||
}
|
||||
|
||||
await prisma.stockKeepingUnits.upsert({
|
||||
where: { code },
|
||||
create: {
|
||||
code,
|
||||
name,
|
||||
VAT: vat,
|
||||
type: 'GOLD',
|
||||
is_public: isPublic,
|
||||
is_domestic: isDomestic,
|
||||
},
|
||||
update: {
|
||||
name,
|
||||
VAT: vat,
|
||||
type: 'GOLD',
|
||||
is_public: isPublic,
|
||||
is_domestic: isDomestic,
|
||||
},
|
||||
})
|
||||
upserted++
|
||||
}
|
||||
|
||||
console.log(
|
||||
JSON.stringify(
|
||||
{
|
||||
csvPath: absolutePath,
|
||||
totalRows: rows.length,
|
||||
upserted,
|
||||
skipped,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
main()
|
||||
.catch(error => {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect()
|
||||
})
|
||||
@@ -1,3 +1,5 @@
|
||||
import { FiscalResponseStatus } from '@/generated/prisma/enums'
|
||||
|
||||
export default {
|
||||
PaymentMethodType: {
|
||||
TERMINAL: 'ترمینال',
|
||||
@@ -12,7 +14,6 @@ export default {
|
||||
COUNT: 'تعداد',
|
||||
GRAM: 'گرم',
|
||||
KILOGRAM: 'کیلوگرم',
|
||||
KILO_GRAM: 'کیلوگرم',
|
||||
LITER: 'لیتر',
|
||||
MILLILITER: 'میلیلیتر',
|
||||
METER: 'متر',
|
||||
@@ -96,6 +97,10 @@ export default {
|
||||
MANAGER: 'مدیریت',
|
||||
OPERATOR: 'اپراتور',
|
||||
},
|
||||
ComplexRole: {
|
||||
MANAGER: 'مدیریت',
|
||||
OPERATOR: 'اپراتور',
|
||||
},
|
||||
ConsumerRole: {
|
||||
OWNER: 'مدیر اصلی',
|
||||
MANAGER: 'مدیریت',
|
||||
@@ -135,6 +140,20 @@ export default {
|
||||
SUCCESS: 'موفق',
|
||||
FAILURE: 'ناموفق',
|
||||
NOT_SEND: 'ارسال نشده',
|
||||
[FiscalResponseStatus.QUEUED]: 'در صف ارسال',
|
||||
},
|
||||
FiscalRequestType: {
|
||||
MAIN: 'اصلی',
|
||||
UPDATE: 'اصلاح',
|
||||
REVOKE: 'ابطال',
|
||||
REMOVE: 'حذف',
|
||||
},
|
||||
FiscalInvoiceCustomerType: {
|
||||
Unknown: 'ناشناس',
|
||||
Known: 'شناسایی شده',
|
||||
},
|
||||
SKUGuildType: {
|
||||
GOLD: 'طلا',
|
||||
},
|
||||
GoldKarat: {
|
||||
KARAT_18: '۱۸ عیار',
|
||||
|
||||
+16
-13
@@ -1,22 +1,25 @@
|
||||
export enum TokenType {
|
||||
ACCESS = 'ACCESS',
|
||||
REFRESH = 'REFRESH',
|
||||
}
|
||||
|
||||
export enum AccountType {
|
||||
PARTNER = 'PARTNER',
|
||||
BUSINESS = 'BUSINESS',
|
||||
ADMIN = 'ADMIN',
|
||||
PROVIDER = 'PROVIDER',
|
||||
POS = 'POS',
|
||||
}
|
||||
|
||||
export enum GoldKarat {
|
||||
KARAT_18 = '18',
|
||||
KARAT_21 = '21',
|
||||
KARAT_24 = '24',
|
||||
}
|
||||
|
||||
export enum FiscalRequestType {
|
||||
MAIN = 'MAIN',
|
||||
UPDATE = 'UPDATE',
|
||||
REVOKE = 'REVOKE',
|
||||
REMOVE = 'REMOVE',
|
||||
}
|
||||
|
||||
export enum FiscalInvoiceCustomerType {
|
||||
Unknown = 'Unknown',
|
||||
Known = 'Known',
|
||||
}
|
||||
|
||||
export enum SKUGuildType {
|
||||
GOLD = 'GOLD',
|
||||
}
|
||||
|
||||
export const UploadedFileTypes = {
|
||||
GOOD: 'good',
|
||||
SERVICE: 'service',
|
||||
|
||||
@@ -167,6 +167,26 @@ export type Complex = Prisma.ComplexModel
|
||||
*
|
||||
*/
|
||||
export type Pos = Prisma.PosModel
|
||||
/**
|
||||
* Model Good
|
||||
*
|
||||
*/
|
||||
export type Good = Prisma.GoodModel
|
||||
/**
|
||||
* Model GoodCategory
|
||||
*
|
||||
*/
|
||||
export type GoodCategory = Prisma.GoodCategoryModel
|
||||
/**
|
||||
* Model MeasureUnits
|
||||
*
|
||||
*/
|
||||
export type MeasureUnits = Prisma.MeasureUnitsModel
|
||||
/**
|
||||
* Model StockKeepingUnits
|
||||
*
|
||||
*/
|
||||
export type StockKeepingUnits = Prisma.StockKeepingUnitsModel
|
||||
/**
|
||||
* Model TriggerLog
|
||||
*
|
||||
@@ -187,16 +207,6 @@ export type CustomerIndividual = Prisma.CustomerIndividualModel
|
||||
*
|
||||
*/
|
||||
export type CustomerLegal = Prisma.CustomerLegalModel
|
||||
/**
|
||||
* Model Good
|
||||
*
|
||||
*/
|
||||
export type Good = Prisma.GoodModel
|
||||
/**
|
||||
* Model GoodCategory
|
||||
*
|
||||
*/
|
||||
export type GoodCategory = Prisma.GoodCategoryModel
|
||||
/**
|
||||
* Model Guild
|
||||
*
|
||||
|
||||
@@ -189,6 +189,26 @@ export type Complex = Prisma.ComplexModel
|
||||
*
|
||||
*/
|
||||
export type Pos = Prisma.PosModel
|
||||
/**
|
||||
* Model Good
|
||||
*
|
||||
*/
|
||||
export type Good = Prisma.GoodModel
|
||||
/**
|
||||
* Model GoodCategory
|
||||
*
|
||||
*/
|
||||
export type GoodCategory = Prisma.GoodCategoryModel
|
||||
/**
|
||||
* Model MeasureUnits
|
||||
*
|
||||
*/
|
||||
export type MeasureUnits = Prisma.MeasureUnitsModel
|
||||
/**
|
||||
* Model StockKeepingUnits
|
||||
*
|
||||
*/
|
||||
export type StockKeepingUnits = Prisma.StockKeepingUnitsModel
|
||||
/**
|
||||
* Model TriggerLog
|
||||
*
|
||||
@@ -209,16 +229,6 @@ export type CustomerIndividual = Prisma.CustomerIndividualModel
|
||||
*
|
||||
*/
|
||||
export type CustomerLegal = Prisma.CustomerLegalModel
|
||||
/**
|
||||
* Model Good
|
||||
*
|
||||
*/
|
||||
export type Good = Prisma.GoodModel
|
||||
/**
|
||||
* Model GoodCategory
|
||||
*
|
||||
*/
|
||||
export type GoodCategory = Prisma.GoodCategoryModel
|
||||
/**
|
||||
* Model Guild
|
||||
*
|
||||
|
||||
@@ -490,68 +490,6 @@ export type EnumPOSTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedEnumPOSTypeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type BoolNullableFilter<$PrismaModel = never> = {
|
||||
equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> | null
|
||||
not?: Prisma.NestedBoolNullableFilter<$PrismaModel> | boolean | 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 DateTimeNullableFilter<$PrismaModel = never> = {
|
||||
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
|
||||
in?: Date[] | string[] | null
|
||||
notIn?: Date[] | string[] | null
|
||||
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null
|
||||
}
|
||||
|
||||
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 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 DateTimeNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
|
||||
in?: Date[] | string[] | null
|
||||
notIn?: Date[] | string[] | null
|
||||
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedDateTimeNullableWithAggregatesFilter<$PrismaModel> | Date | string | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedDateTimeNullableFilter<$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 EnumGoodPricingModelFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.GoodPricingModel | Prisma.EnumGoodPricingModelFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.GoodPricingModel[]
|
||||
@@ -570,14 +508,15 @@ export type DecimalNullableFilter<$PrismaModel = never> = {
|
||||
not?: Prisma.NestedDecimalNullableFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
}
|
||||
|
||||
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 DateTimeNullableFilter<$PrismaModel = never> = {
|
||||
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
|
||||
in?: Date[] | string[] | null
|
||||
notIn?: Date[] | string[] | null
|
||||
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null
|
||||
}
|
||||
|
||||
export type EnumGoodPricingModelWithAggregatesFilter<$PrismaModel = never> = {
|
||||
@@ -606,6 +545,20 @@ export type DecimalNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type DateTimeNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
|
||||
in?: Date[] | string[] | null
|
||||
notIn?: Date[] | string[] | null
|
||||
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedDateTimeNullableWithAggregatesFilter<$PrismaModel> | Date | string | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type DecimalFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[]
|
||||
@@ -617,6 +570,13 @@ export type DecimalFilter<$PrismaModel = never> = {
|
||||
not?: Prisma.NestedDecimalFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
}
|
||||
|
||||
export type EnumSKUGuildTypeFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.SKUGuildType | Prisma.EnumSKUGuildTypeFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.SKUGuildType[]
|
||||
notIn?: $Enums.SKUGuildType[]
|
||||
not?: Prisma.NestedEnumSKUGuildTypeFilter<$PrismaModel> | $Enums.SKUGuildType
|
||||
}
|
||||
|
||||
export type DecimalWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[]
|
||||
@@ -633,6 +593,80 @@ export type DecimalWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedDecimalFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type EnumSKUGuildTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.SKUGuildType | Prisma.EnumSKUGuildTypeFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.SKUGuildType[]
|
||||
notIn?: $Enums.SKUGuildType[]
|
||||
not?: Prisma.NestedEnumSKUGuildTypeWithAggregatesFilter<$PrismaModel> | $Enums.SKUGuildType
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedEnumSKUGuildTypeFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedEnumSKUGuildTypeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type BoolNullableFilter<$PrismaModel = never> = {
|
||||
equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> | null
|
||||
not?: Prisma.NestedBoolNullableFilter<$PrismaModel> | boolean | 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 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 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 EnumFiscalResponseStatusFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.FiscalResponseStatus | Prisma.EnumFiscalResponseStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.FiscalResponseStatus[]
|
||||
notIn?: $Enums.FiscalResponseStatus[]
|
||||
not?: Prisma.NestedEnumFiscalResponseStatusFilter<$PrismaModel> | $Enums.FiscalResponseStatus
|
||||
}
|
||||
|
||||
export type EnumFiscalRequestTypeFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.FiscalRequestType | Prisma.EnumFiscalRequestTypeFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.FiscalRequestType[]
|
||||
notIn?: $Enums.FiscalRequestType[]
|
||||
not?: Prisma.NestedEnumFiscalRequestTypeFilter<$PrismaModel> | $Enums.FiscalRequestType
|
||||
}
|
||||
|
||||
export type EnumFiscalResponseStatusWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.FiscalResponseStatus | Prisma.EnumFiscalResponseStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.FiscalResponseStatus[]
|
||||
notIn?: $Enums.FiscalResponseStatus[]
|
||||
not?: Prisma.NestedEnumFiscalResponseStatusWithAggregatesFilter<$PrismaModel> | $Enums.FiscalResponseStatus
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedEnumFiscalResponseStatusFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedEnumFiscalResponseStatusFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type EnumFiscalRequestTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.FiscalRequestType | Prisma.EnumFiscalRequestTypeFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.FiscalRequestType[]
|
||||
notIn?: $Enums.FiscalRequestType[]
|
||||
not?: Prisma.NestedEnumFiscalRequestTypeWithAggregatesFilter<$PrismaModel> | $Enums.FiscalRequestType
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedEnumFiscalRequestTypeFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedEnumFiscalRequestTypeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type EnumPaymentMethodTypeFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.PaymentMethodType | Prisma.EnumPaymentMethodTypeFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.PaymentMethodType[]
|
||||
@@ -1116,68 +1150,6 @@ export type NestedEnumPOSTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedEnumPOSTypeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedBoolNullableFilter<$PrismaModel = never> = {
|
||||
equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> | null
|
||||
not?: Prisma.NestedBoolNullableFilter<$PrismaModel> | boolean | 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 NestedDateTimeNullableFilter<$PrismaModel = never> = {
|
||||
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
|
||||
in?: Date[] | string[] | null
|
||||
notIn?: Date[] | string[] | null
|
||||
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null
|
||||
}
|
||||
|
||||
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 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 NestedDateTimeNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
|
||||
in?: Date[] | string[] | null
|
||||
notIn?: Date[] | string[] | null
|
||||
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedDateTimeNullableWithAggregatesFilter<$PrismaModel> | Date | string | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
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 NestedEnumGoodPricingModelFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.GoodPricingModel | Prisma.EnumGoodPricingModelFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.GoodPricingModel[]
|
||||
@@ -1196,14 +1168,15 @@ export type NestedDecimalNullableFilter<$PrismaModel = never> = {
|
||||
not?: Prisma.NestedDecimalNullableFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
|
||||
}
|
||||
|
||||
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 NestedDateTimeNullableFilter<$PrismaModel = never> = {
|
||||
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
|
||||
in?: Date[] | string[] | null
|
||||
notIn?: Date[] | string[] | null
|
||||
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedDateTimeNullableFilter<$PrismaModel> | Date | string | null
|
||||
}
|
||||
|
||||
export type NestedEnumGoodPricingModelWithAggregatesFilter<$PrismaModel = never> = {
|
||||
@@ -1232,6 +1205,20 @@ export type NestedDecimalNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedDateTimeNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel> | null
|
||||
in?: Date[] | string[] | null
|
||||
notIn?: Date[] | string[] | null
|
||||
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
gte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedDateTimeNullableWithAggregatesFilter<$PrismaModel> | Date | string | null
|
||||
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedDateTimeNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedDecimalFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[]
|
||||
@@ -1243,6 +1230,13 @@ export type NestedDecimalFilter<$PrismaModel = never> = {
|
||||
not?: Prisma.NestedDecimalFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
}
|
||||
|
||||
export type NestedEnumSKUGuildTypeFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.SKUGuildType | Prisma.EnumSKUGuildTypeFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.SKUGuildType[]
|
||||
notIn?: $Enums.SKUGuildType[]
|
||||
not?: Prisma.NestedEnumSKUGuildTypeFilter<$PrismaModel> | $Enums.SKUGuildType
|
||||
}
|
||||
|
||||
export type NestedDecimalWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
|
||||
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[]
|
||||
@@ -1259,6 +1253,80 @@ export type NestedDecimalWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedDecimalFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedEnumSKUGuildTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.SKUGuildType | Prisma.EnumSKUGuildTypeFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.SKUGuildType[]
|
||||
notIn?: $Enums.SKUGuildType[]
|
||||
not?: Prisma.NestedEnumSKUGuildTypeWithAggregatesFilter<$PrismaModel> | $Enums.SKUGuildType
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedEnumSKUGuildTypeFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedEnumSKUGuildTypeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedBoolNullableFilter<$PrismaModel = never> = {
|
||||
equals?: boolean | Prisma.BooleanFieldRefInput<$PrismaModel> | null
|
||||
not?: Prisma.NestedBoolNullableFilter<$PrismaModel> | boolean | 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 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 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 NestedEnumFiscalResponseStatusFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.FiscalResponseStatus | Prisma.EnumFiscalResponseStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.FiscalResponseStatus[]
|
||||
notIn?: $Enums.FiscalResponseStatus[]
|
||||
not?: Prisma.NestedEnumFiscalResponseStatusFilter<$PrismaModel> | $Enums.FiscalResponseStatus
|
||||
}
|
||||
|
||||
export type NestedEnumFiscalRequestTypeFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.FiscalRequestType | Prisma.EnumFiscalRequestTypeFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.FiscalRequestType[]
|
||||
notIn?: $Enums.FiscalRequestType[]
|
||||
not?: Prisma.NestedEnumFiscalRequestTypeFilter<$PrismaModel> | $Enums.FiscalRequestType
|
||||
}
|
||||
|
||||
export type NestedEnumFiscalResponseStatusWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.FiscalResponseStatus | Prisma.EnumFiscalResponseStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.FiscalResponseStatus[]
|
||||
notIn?: $Enums.FiscalResponseStatus[]
|
||||
not?: Prisma.NestedEnumFiscalResponseStatusWithAggregatesFilter<$PrismaModel> | $Enums.FiscalResponseStatus
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedEnumFiscalResponseStatusFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedEnumFiscalResponseStatusFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedEnumFiscalRequestTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.FiscalRequestType | Prisma.EnumFiscalRequestTypeFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.FiscalRequestType[]
|
||||
notIn?: $Enums.FiscalRequestType[]
|
||||
not?: Prisma.NestedEnumFiscalRequestTypeWithAggregatesFilter<$PrismaModel> | $Enums.FiscalRequestType
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedEnumFiscalRequestTypeFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedEnumFiscalRequestTypeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedEnumPaymentMethodTypeFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.PaymentMethodType | Prisma.EnumPaymentMethodTypeFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.PaymentMethodType[]
|
||||
|
||||
@@ -259,7 +259,33 @@ export type PartnerFiscalSwitchType = (typeof PartnerFiscalSwitchType)[keyof typ
|
||||
export const FiscalResponseStatus = {
|
||||
SUCCESS: 'SUCCESS',
|
||||
FAILURE: 'FAILURE',
|
||||
NOT_SEND: 'NOT_SEND'
|
||||
NOT_SEND: 'NOT_SEND',
|
||||
QUEUED: 'QUEUED'
|
||||
} as const
|
||||
|
||||
export type FiscalResponseStatus = (typeof FiscalResponseStatus)[keyof typeof FiscalResponseStatus]
|
||||
|
||||
|
||||
export const FiscalRequestType = {
|
||||
MAIN: 'MAIN',
|
||||
UPDATE: 'UPDATE',
|
||||
REVOKE: 'REVOKE',
|
||||
REMOVE: 'REMOVE'
|
||||
} as const
|
||||
|
||||
export type FiscalRequestType = (typeof FiscalRequestType)[keyof typeof FiscalRequestType]
|
||||
|
||||
|
||||
export const FiscalInvoiceCustomerType = {
|
||||
Unknown: 'Unknown',
|
||||
Known: 'Known'
|
||||
} as const
|
||||
|
||||
export type FiscalInvoiceCustomerType = (typeof FiscalInvoiceCustomerType)[keyof typeof FiscalInvoiceCustomerType]
|
||||
|
||||
|
||||
export const SKUGuildType = {
|
||||
GOLD: 'GOLD'
|
||||
} as const
|
||||
|
||||
export type SKUGuildType = (typeof SKUGuildType)[keyof typeof SKUGuildType]
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -414,12 +414,14 @@ export const ModelName = {
|
||||
BusinessActivity: 'BusinessActivity',
|
||||
Complex: 'Complex',
|
||||
Pos: 'Pos',
|
||||
Good: 'Good',
|
||||
GoodCategory: 'GoodCategory',
|
||||
MeasureUnits: 'MeasureUnits',
|
||||
StockKeepingUnits: 'StockKeepingUnits',
|
||||
TriggerLog: 'TriggerLog',
|
||||
Customer: 'Customer',
|
||||
CustomerIndividual: 'CustomerIndividual',
|
||||
CustomerLegal: 'CustomerLegal',
|
||||
Good: 'Good',
|
||||
GoodCategory: 'GoodCategory',
|
||||
Guild: 'Guild',
|
||||
SalesInvoice: 'SalesInvoice',
|
||||
SalesInvoiceItem: 'SalesInvoiceItem',
|
||||
@@ -444,7 +446,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
omit: GlobalOmitOptions
|
||||
}
|
||||
meta: {
|
||||
modelProps: "adminAccount" | "admin" | "account" | "deviceBrand" | "device" | "licenseChargeTransaction" | "license" | "licenseActivation" | "licenseRenewChargeTransaction" | "licenseRenew" | "partnerAccountQuotaChargeTransaction" | "partnerAccountQuotaCredit" | "licenseAccountAllocation" | "partnerAccount" | "partner" | "permissionConsumer" | "permissionPos" | "permissionComplex" | "permissionBusiness" | "providerAccount" | "provider" | "consumerDevices" | "applicationReleasedInfo" | "consumerAccount" | "consumer" | "consumerIndividual" | "consumerLegal" | "businessActivity" | "complex" | "pos" | "triggerLog" | "customer" | "customerIndividual" | "customerLegal" | "good" | "goodCategory" | "guild" | "salesInvoice" | "salesInvoiceItem" | "saleInvoiceFiscals" | "saleInvoiceFiscalAttempts" | "salesInvoicePayment" | "salesInvoicePaymentTerminalInfo" | "service" | "serviceCategory"
|
||||
modelProps: "adminAccount" | "admin" | "account" | "deviceBrand" | "device" | "licenseChargeTransaction" | "license" | "licenseActivation" | "licenseRenewChargeTransaction" | "licenseRenew" | "partnerAccountQuotaChargeTransaction" | "partnerAccountQuotaCredit" | "licenseAccountAllocation" | "partnerAccount" | "partner" | "permissionConsumer" | "permissionPos" | "permissionComplex" | "permissionBusiness" | "providerAccount" | "provider" | "consumerDevices" | "applicationReleasedInfo" | "consumerAccount" | "consumer" | "consumerIndividual" | "consumerLegal" | "businessActivity" | "complex" | "pos" | "good" | "goodCategory" | "measureUnits" | "stockKeepingUnits" | "triggerLog" | "customer" | "customerIndividual" | "customerLegal" | "guild" | "salesInvoice" | "salesInvoiceItem" | "saleInvoiceFiscals" | "saleInvoiceFiscalAttempts" | "salesInvoicePayment" | "salesInvoicePaymentTerminalInfo" | "service" | "serviceCategory"
|
||||
txIsolationLevel: TransactionIsolationLevel
|
||||
}
|
||||
model: {
|
||||
@@ -2428,6 +2430,270 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
Good: {
|
||||
payload: Prisma.$GoodPayload<ExtArgs>
|
||||
fields: Prisma.GoodFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.GoodFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.GoodFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.GoodFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.GoodFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.GoodFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.GoodCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.GoodCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.GoodDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.GoodUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.GoodDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.GoodUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.GoodUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.GoodAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateGood>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.GoodGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.GoodGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.GoodCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.GoodCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
GoodCategory: {
|
||||
payload: Prisma.$GoodCategoryPayload<ExtArgs>
|
||||
fields: Prisma.GoodCategoryFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.GoodCategoryFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.GoodCategoryFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.GoodCategoryFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.GoodCategoryFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.GoodCategoryFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.GoodCategoryCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.GoodCategoryCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.GoodCategoryDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.GoodCategoryUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.GoodCategoryDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.GoodCategoryUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.GoodCategoryUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.GoodCategoryAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateGoodCategory>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.GoodCategoryGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.GoodCategoryGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.GoodCategoryCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.GoodCategoryCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
MeasureUnits: {
|
||||
payload: Prisma.$MeasureUnitsPayload<ExtArgs>
|
||||
fields: Prisma.MeasureUnitsFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.MeasureUnitsFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$MeasureUnitsPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.MeasureUnitsFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$MeasureUnitsPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.MeasureUnitsFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$MeasureUnitsPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.MeasureUnitsFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$MeasureUnitsPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.MeasureUnitsFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$MeasureUnitsPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.MeasureUnitsCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$MeasureUnitsPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.MeasureUnitsCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.MeasureUnitsDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$MeasureUnitsPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.MeasureUnitsUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$MeasureUnitsPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.MeasureUnitsDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.MeasureUnitsUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.MeasureUnitsUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$MeasureUnitsPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.MeasureUnitsAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateMeasureUnits>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.MeasureUnitsGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.MeasureUnitsGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.MeasureUnitsCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.MeasureUnitsCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
StockKeepingUnits: {
|
||||
payload: Prisma.$StockKeepingUnitsPayload<ExtArgs>
|
||||
fields: Prisma.StockKeepingUnitsFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.StockKeepingUnitsFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$StockKeepingUnitsPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.StockKeepingUnitsFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$StockKeepingUnitsPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.StockKeepingUnitsFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$StockKeepingUnitsPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.StockKeepingUnitsFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$StockKeepingUnitsPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.StockKeepingUnitsFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$StockKeepingUnitsPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.StockKeepingUnitsCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$StockKeepingUnitsPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.StockKeepingUnitsCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.StockKeepingUnitsDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$StockKeepingUnitsPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.StockKeepingUnitsUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$StockKeepingUnitsPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.StockKeepingUnitsDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.StockKeepingUnitsUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.StockKeepingUnitsUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$StockKeepingUnitsPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.StockKeepingUnitsAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateStockKeepingUnits>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.StockKeepingUnitsGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.StockKeepingUnitsGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.StockKeepingUnitsCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.StockKeepingUnitsCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
TriggerLog: {
|
||||
payload: Prisma.$TriggerLogPayload<ExtArgs>
|
||||
fields: Prisma.TriggerLogFieldRefs
|
||||
@@ -2692,138 +2958,6 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
Good: {
|
||||
payload: Prisma.$GoodPayload<ExtArgs>
|
||||
fields: Prisma.GoodFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.GoodFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.GoodFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.GoodFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.GoodFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.GoodFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.GoodCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.GoodCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.GoodDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.GoodUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.GoodDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.GoodUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.GoodUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.GoodAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateGood>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.GoodGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.GoodGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.GoodCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.GoodCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
GoodCategory: {
|
||||
payload: Prisma.$GoodCategoryPayload<ExtArgs>
|
||||
fields: Prisma.GoodCategoryFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.GoodCategoryFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.GoodCategoryFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.GoodCategoryFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.GoodCategoryFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.GoodCategoryFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.GoodCategoryCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.GoodCategoryCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.GoodCategoryDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.GoodCategoryUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.GoodCategoryDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.GoodCategoryUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.GoodCategoryUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$GoodCategoryPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.GoodCategoryAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateGoodCategory>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.GoodCategoryGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.GoodCategoryGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.GoodCategoryCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.GoodCategoryCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
Guild: {
|
||||
payload: Prisma.$GuildPayload<ExtArgs>
|
||||
fields: Prisma.GuildFieldRefs
|
||||
@@ -3833,6 +3967,70 @@ export const PosScalarFieldEnum = {
|
||||
export type PosScalarFieldEnum = (typeof PosScalarFieldEnum)[keyof typeof PosScalarFieldEnum]
|
||||
|
||||
|
||||
export const GoodScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
is_default_guild_good: 'is_default_guild_good',
|
||||
pricing_model: 'pricing_model',
|
||||
description: 'description',
|
||||
local_sku: 'local_sku',
|
||||
barcode: 'barcode',
|
||||
base_sale_price: 'base_sale_price',
|
||||
image_url: 'image_url',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
deleted_at: 'deleted_at',
|
||||
sku_id: 'sku_id',
|
||||
measure_unit_id: 'measure_unit_id',
|
||||
category_id: 'category_id',
|
||||
business_activity_id: 'business_activity_id'
|
||||
} as const
|
||||
|
||||
export type GoodScalarFieldEnum = (typeof GoodScalarFieldEnum)[keyof typeof GoodScalarFieldEnum]
|
||||
|
||||
|
||||
export const GoodCategoryScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
image_url: 'image_url',
|
||||
complex_id: 'complex_id',
|
||||
is_default_guild_good: 'is_default_guild_good',
|
||||
guild_id: 'guild_id',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
deleted_at: 'deleted_at'
|
||||
} as const
|
||||
|
||||
export type GoodCategoryScalarFieldEnum = (typeof GoodCategoryScalarFieldEnum)[keyof typeof GoodCategoryScalarFieldEnum]
|
||||
|
||||
|
||||
export const MeasureUnitsScalarFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
name: 'name',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at'
|
||||
} as const
|
||||
|
||||
export type MeasureUnitsScalarFieldEnum = (typeof MeasureUnitsScalarFieldEnum)[keyof typeof MeasureUnitsScalarFieldEnum]
|
||||
|
||||
|
||||
export const StockKeepingUnitsScalarFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
name: 'name',
|
||||
VAT: 'VAT',
|
||||
type: 'type',
|
||||
is_public: 'is_public',
|
||||
is_domestic: 'is_domestic',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at'
|
||||
} as const
|
||||
|
||||
export type StockKeepingUnitsScalarFieldEnum = (typeof StockKeepingUnitsScalarFieldEnum)[keyof typeof StockKeepingUnitsScalarFieldEnum]
|
||||
|
||||
|
||||
export const TriggerLogScalarFieldEnum = {
|
||||
id: 'id',
|
||||
message: 'message',
|
||||
@@ -3870,7 +4068,7 @@ export type CustomerIndividualScalarFieldEnum = (typeof CustomerIndividualScalar
|
||||
|
||||
|
||||
export const CustomerLegalScalarFieldEnum = {
|
||||
company_name: 'company_name',
|
||||
name: 'name',
|
||||
economic_code: 'economic_code',
|
||||
registration_number: 'registration_number',
|
||||
postal_code: 'postal_code',
|
||||
@@ -3881,44 +4079,6 @@ export const CustomerLegalScalarFieldEnum = {
|
||||
export type CustomerLegalScalarFieldEnum = (typeof CustomerLegalScalarFieldEnum)[keyof typeof CustomerLegalScalarFieldEnum]
|
||||
|
||||
|
||||
export const GoodScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
is_default_guild_good: 'is_default_guild_good',
|
||||
sku: 'sku',
|
||||
unit_type: 'unit_type',
|
||||
pricing_model: 'pricing_model',
|
||||
description: 'description',
|
||||
local_sku: 'local_sku',
|
||||
barcode: 'barcode',
|
||||
base_sale_price: 'base_sale_price',
|
||||
image_url: 'image_url',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
deleted_at: 'deleted_at',
|
||||
category_id: 'category_id',
|
||||
business_activity_id: 'business_activity_id'
|
||||
} as const
|
||||
|
||||
export type GoodScalarFieldEnum = (typeof GoodScalarFieldEnum)[keyof typeof GoodScalarFieldEnum]
|
||||
|
||||
|
||||
export const GoodCategoryScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
image_url: 'image_url',
|
||||
complex_id: 'complex_id',
|
||||
is_default_guild_good: 'is_default_guild_good',
|
||||
guild_id: 'guild_id',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
deleted_at: 'deleted_at'
|
||||
} as const
|
||||
|
||||
export type GoodCategoryScalarFieldEnum = (typeof GoodCategoryScalarFieldEnum)[keyof typeof GoodCategoryScalarFieldEnum]
|
||||
|
||||
|
||||
export const GuildScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
@@ -3951,7 +4111,10 @@ export type SalesInvoiceScalarFieldEnum = (typeof SalesInvoiceScalarFieldEnum)[k
|
||||
export const SalesInvoiceItemScalarFieldEnum = {
|
||||
id: 'id',
|
||||
quantity: 'quantity',
|
||||
unit_type: 'unit_type',
|
||||
measure_unit_text: 'measure_unit_text',
|
||||
measure_unit_code: 'measure_unit_code',
|
||||
sku_code: 'sku_code',
|
||||
sku_vat: 'sku_vat',
|
||||
unit_price: 'unit_price',
|
||||
total_amount: 'total_amount',
|
||||
created_at: 'created_at',
|
||||
@@ -3984,6 +4147,7 @@ export const SaleInvoiceFiscalAttemptsScalarFieldEnum = {
|
||||
attempt_no: 'attempt_no',
|
||||
status: 'status',
|
||||
tax_id: 'tax_id',
|
||||
type: 'type',
|
||||
request_payload: 'request_payload',
|
||||
response_payload: 'response_payload',
|
||||
error_message: 'error_message',
|
||||
@@ -4393,6 +4557,52 @@ export const PosOrderByRelevanceFieldEnum = {
|
||||
export type PosOrderByRelevanceFieldEnum = (typeof PosOrderByRelevanceFieldEnum)[keyof typeof PosOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const GoodOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
local_sku: 'local_sku',
|
||||
barcode: 'barcode',
|
||||
image_url: 'image_url',
|
||||
sku_id: 'sku_id',
|
||||
measure_unit_id: 'measure_unit_id',
|
||||
category_id: 'category_id',
|
||||
business_activity_id: 'business_activity_id'
|
||||
} as const
|
||||
|
||||
export type GoodOrderByRelevanceFieldEnum = (typeof GoodOrderByRelevanceFieldEnum)[keyof typeof GoodOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const GoodCategoryOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
image_url: 'image_url',
|
||||
complex_id: 'complex_id',
|
||||
guild_id: 'guild_id'
|
||||
} as const
|
||||
|
||||
export type GoodCategoryOrderByRelevanceFieldEnum = (typeof GoodCategoryOrderByRelevanceFieldEnum)[keyof typeof GoodCategoryOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const MeasureUnitsOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
name: 'name'
|
||||
} as const
|
||||
|
||||
export type MeasureUnitsOrderByRelevanceFieldEnum = (typeof MeasureUnitsOrderByRelevanceFieldEnum)[keyof typeof MeasureUnitsOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const StockKeepingUnitsOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
name: 'name'
|
||||
} as const
|
||||
|
||||
export type StockKeepingUnitsOrderByRelevanceFieldEnum = (typeof StockKeepingUnitsOrderByRelevanceFieldEnum)[keyof typeof StockKeepingUnitsOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const TriggerLogOrderByRelevanceFieldEnum = {
|
||||
message: 'message',
|
||||
name: 'name'
|
||||
@@ -4423,7 +4633,7 @@ export type CustomerIndividualOrderByRelevanceFieldEnum = (typeof CustomerIndivi
|
||||
|
||||
|
||||
export const CustomerLegalOrderByRelevanceFieldEnum = {
|
||||
company_name: 'company_name',
|
||||
name: 'name',
|
||||
economic_code: 'economic_code',
|
||||
registration_number: 'registration_number',
|
||||
postal_code: 'postal_code',
|
||||
@@ -4434,33 +4644,6 @@ export const CustomerLegalOrderByRelevanceFieldEnum = {
|
||||
export type CustomerLegalOrderByRelevanceFieldEnum = (typeof CustomerLegalOrderByRelevanceFieldEnum)[keyof typeof CustomerLegalOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const GoodOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
sku: 'sku',
|
||||
description: 'description',
|
||||
local_sku: 'local_sku',
|
||||
barcode: 'barcode',
|
||||
image_url: 'image_url',
|
||||
category_id: 'category_id',
|
||||
business_activity_id: 'business_activity_id'
|
||||
} as const
|
||||
|
||||
export type GoodOrderByRelevanceFieldEnum = (typeof GoodOrderByRelevanceFieldEnum)[keyof typeof GoodOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const GoodCategoryOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
image_url: 'image_url',
|
||||
complex_id: 'complex_id',
|
||||
guild_id: 'guild_id'
|
||||
} as const
|
||||
|
||||
export type GoodCategoryOrderByRelevanceFieldEnum = (typeof GoodCategoryOrderByRelevanceFieldEnum)[keyof typeof GoodCategoryOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const GuildOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
@@ -4484,6 +4667,9 @@ export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByR
|
||||
|
||||
export const SalesInvoiceItemOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
measure_unit_text: 'measure_unit_text',
|
||||
measure_unit_code: 'measure_unit_code',
|
||||
sku_code: 'sku_code',
|
||||
notes: 'notes',
|
||||
invoice_id: 'invoice_id',
|
||||
good_id: 'good_id',
|
||||
@@ -4503,7 +4689,6 @@ export type SaleInvoiceFiscalsOrderByRelevanceFieldEnum = (typeof SaleInvoiceFis
|
||||
|
||||
export const SaleInvoiceFiscalAttemptsOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
status: 'status',
|
||||
tax_id: 'tax_id',
|
||||
error_message: 'error_message',
|
||||
fiscal_id: 'fiscal_id'
|
||||
@@ -4727,20 +4912,6 @@ export type EnumPOSTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaMo
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'CustomerType'
|
||||
*/
|
||||
export type EnumCustomerTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'CustomerType'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'UnitType'
|
||||
*/
|
||||
export type EnumUnitTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'UnitType'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'GoodPricingModel'
|
||||
*/
|
||||
@@ -4755,6 +4926,34 @@ export type DecimalFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel,
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'SKUGuildType'
|
||||
*/
|
||||
export type EnumSKUGuildTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'SKUGuildType'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'CustomerType'
|
||||
*/
|
||||
export type EnumCustomerTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'CustomerType'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'FiscalResponseStatus'
|
||||
*/
|
||||
export type EnumFiscalResponseStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'FiscalResponseStatus'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'FiscalRequestType'
|
||||
*/
|
||||
export type EnumFiscalRequestTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'FiscalRequestType'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'PaymentMethodType'
|
||||
*/
|
||||
@@ -4893,12 +5092,14 @@ export type GlobalOmitConfig = {
|
||||
businessActivity?: Prisma.BusinessActivityOmit
|
||||
complex?: Prisma.ComplexOmit
|
||||
pos?: Prisma.PosOmit
|
||||
good?: Prisma.GoodOmit
|
||||
goodCategory?: Prisma.GoodCategoryOmit
|
||||
measureUnits?: Prisma.MeasureUnitsOmit
|
||||
stockKeepingUnits?: Prisma.StockKeepingUnitsOmit
|
||||
triggerLog?: Prisma.TriggerLogOmit
|
||||
customer?: Prisma.CustomerOmit
|
||||
customerIndividual?: Prisma.CustomerIndividualOmit
|
||||
customerLegal?: Prisma.CustomerLegalOmit
|
||||
good?: Prisma.GoodOmit
|
||||
goodCategory?: Prisma.GoodCategoryOmit
|
||||
guild?: Prisma.GuildOmit
|
||||
salesInvoice?: Prisma.SalesInvoiceOmit
|
||||
salesInvoiceItem?: Prisma.SalesInvoiceItemOmit
|
||||
|
||||
@@ -81,12 +81,14 @@ export const ModelName = {
|
||||
BusinessActivity: 'BusinessActivity',
|
||||
Complex: 'Complex',
|
||||
Pos: 'Pos',
|
||||
Good: 'Good',
|
||||
GoodCategory: 'GoodCategory',
|
||||
MeasureUnits: 'MeasureUnits',
|
||||
StockKeepingUnits: 'StockKeepingUnits',
|
||||
TriggerLog: 'TriggerLog',
|
||||
Customer: 'Customer',
|
||||
CustomerIndividual: 'CustomerIndividual',
|
||||
CustomerLegal: 'CustomerLegal',
|
||||
Good: 'Good',
|
||||
GoodCategory: 'GoodCategory',
|
||||
Guild: 'Guild',
|
||||
SalesInvoice: 'SalesInvoice',
|
||||
SalesInvoiceItem: 'SalesInvoiceItem',
|
||||
@@ -490,6 +492,70 @@ export const PosScalarFieldEnum = {
|
||||
export type PosScalarFieldEnum = (typeof PosScalarFieldEnum)[keyof typeof PosScalarFieldEnum]
|
||||
|
||||
|
||||
export const GoodScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
is_default_guild_good: 'is_default_guild_good',
|
||||
pricing_model: 'pricing_model',
|
||||
description: 'description',
|
||||
local_sku: 'local_sku',
|
||||
barcode: 'barcode',
|
||||
base_sale_price: 'base_sale_price',
|
||||
image_url: 'image_url',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
deleted_at: 'deleted_at',
|
||||
sku_id: 'sku_id',
|
||||
measure_unit_id: 'measure_unit_id',
|
||||
category_id: 'category_id',
|
||||
business_activity_id: 'business_activity_id'
|
||||
} as const
|
||||
|
||||
export type GoodScalarFieldEnum = (typeof GoodScalarFieldEnum)[keyof typeof GoodScalarFieldEnum]
|
||||
|
||||
|
||||
export const GoodCategoryScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
image_url: 'image_url',
|
||||
complex_id: 'complex_id',
|
||||
is_default_guild_good: 'is_default_guild_good',
|
||||
guild_id: 'guild_id',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
deleted_at: 'deleted_at'
|
||||
} as const
|
||||
|
||||
export type GoodCategoryScalarFieldEnum = (typeof GoodCategoryScalarFieldEnum)[keyof typeof GoodCategoryScalarFieldEnum]
|
||||
|
||||
|
||||
export const MeasureUnitsScalarFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
name: 'name',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at'
|
||||
} as const
|
||||
|
||||
export type MeasureUnitsScalarFieldEnum = (typeof MeasureUnitsScalarFieldEnum)[keyof typeof MeasureUnitsScalarFieldEnum]
|
||||
|
||||
|
||||
export const StockKeepingUnitsScalarFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
name: 'name',
|
||||
VAT: 'VAT',
|
||||
type: 'type',
|
||||
is_public: 'is_public',
|
||||
is_domestic: 'is_domestic',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at'
|
||||
} as const
|
||||
|
||||
export type StockKeepingUnitsScalarFieldEnum = (typeof StockKeepingUnitsScalarFieldEnum)[keyof typeof StockKeepingUnitsScalarFieldEnum]
|
||||
|
||||
|
||||
export const TriggerLogScalarFieldEnum = {
|
||||
id: 'id',
|
||||
message: 'message',
|
||||
@@ -527,7 +593,7 @@ export type CustomerIndividualScalarFieldEnum = (typeof CustomerIndividualScalar
|
||||
|
||||
|
||||
export const CustomerLegalScalarFieldEnum = {
|
||||
company_name: 'company_name',
|
||||
name: 'name',
|
||||
economic_code: 'economic_code',
|
||||
registration_number: 'registration_number',
|
||||
postal_code: 'postal_code',
|
||||
@@ -538,44 +604,6 @@ export const CustomerLegalScalarFieldEnum = {
|
||||
export type CustomerLegalScalarFieldEnum = (typeof CustomerLegalScalarFieldEnum)[keyof typeof CustomerLegalScalarFieldEnum]
|
||||
|
||||
|
||||
export const GoodScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
is_default_guild_good: 'is_default_guild_good',
|
||||
sku: 'sku',
|
||||
unit_type: 'unit_type',
|
||||
pricing_model: 'pricing_model',
|
||||
description: 'description',
|
||||
local_sku: 'local_sku',
|
||||
barcode: 'barcode',
|
||||
base_sale_price: 'base_sale_price',
|
||||
image_url: 'image_url',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
deleted_at: 'deleted_at',
|
||||
category_id: 'category_id',
|
||||
business_activity_id: 'business_activity_id'
|
||||
} as const
|
||||
|
||||
export type GoodScalarFieldEnum = (typeof GoodScalarFieldEnum)[keyof typeof GoodScalarFieldEnum]
|
||||
|
||||
|
||||
export const GoodCategoryScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
image_url: 'image_url',
|
||||
complex_id: 'complex_id',
|
||||
is_default_guild_good: 'is_default_guild_good',
|
||||
guild_id: 'guild_id',
|
||||
created_at: 'created_at',
|
||||
updated_at: 'updated_at',
|
||||
deleted_at: 'deleted_at'
|
||||
} as const
|
||||
|
||||
export type GoodCategoryScalarFieldEnum = (typeof GoodCategoryScalarFieldEnum)[keyof typeof GoodCategoryScalarFieldEnum]
|
||||
|
||||
|
||||
export const GuildScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
@@ -608,7 +636,10 @@ export type SalesInvoiceScalarFieldEnum = (typeof SalesInvoiceScalarFieldEnum)[k
|
||||
export const SalesInvoiceItemScalarFieldEnum = {
|
||||
id: 'id',
|
||||
quantity: 'quantity',
|
||||
unit_type: 'unit_type',
|
||||
measure_unit_text: 'measure_unit_text',
|
||||
measure_unit_code: 'measure_unit_code',
|
||||
sku_code: 'sku_code',
|
||||
sku_vat: 'sku_vat',
|
||||
unit_price: 'unit_price',
|
||||
total_amount: 'total_amount',
|
||||
created_at: 'created_at',
|
||||
@@ -641,6 +672,7 @@ export const SaleInvoiceFiscalAttemptsScalarFieldEnum = {
|
||||
attempt_no: 'attempt_no',
|
||||
status: 'status',
|
||||
tax_id: 'tax_id',
|
||||
type: 'type',
|
||||
request_payload: 'request_payload',
|
||||
response_payload: 'response_payload',
|
||||
error_message: 'error_message',
|
||||
@@ -1050,6 +1082,52 @@ export const PosOrderByRelevanceFieldEnum = {
|
||||
export type PosOrderByRelevanceFieldEnum = (typeof PosOrderByRelevanceFieldEnum)[keyof typeof PosOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const GoodOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
local_sku: 'local_sku',
|
||||
barcode: 'barcode',
|
||||
image_url: 'image_url',
|
||||
sku_id: 'sku_id',
|
||||
measure_unit_id: 'measure_unit_id',
|
||||
category_id: 'category_id',
|
||||
business_activity_id: 'business_activity_id'
|
||||
} as const
|
||||
|
||||
export type GoodOrderByRelevanceFieldEnum = (typeof GoodOrderByRelevanceFieldEnum)[keyof typeof GoodOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const GoodCategoryOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
image_url: 'image_url',
|
||||
complex_id: 'complex_id',
|
||||
guild_id: 'guild_id'
|
||||
} as const
|
||||
|
||||
export type GoodCategoryOrderByRelevanceFieldEnum = (typeof GoodCategoryOrderByRelevanceFieldEnum)[keyof typeof GoodCategoryOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const MeasureUnitsOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
name: 'name'
|
||||
} as const
|
||||
|
||||
export type MeasureUnitsOrderByRelevanceFieldEnum = (typeof MeasureUnitsOrderByRelevanceFieldEnum)[keyof typeof MeasureUnitsOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const StockKeepingUnitsOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
name: 'name'
|
||||
} as const
|
||||
|
||||
export type StockKeepingUnitsOrderByRelevanceFieldEnum = (typeof StockKeepingUnitsOrderByRelevanceFieldEnum)[keyof typeof StockKeepingUnitsOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const TriggerLogOrderByRelevanceFieldEnum = {
|
||||
message: 'message',
|
||||
name: 'name'
|
||||
@@ -1080,7 +1158,7 @@ export type CustomerIndividualOrderByRelevanceFieldEnum = (typeof CustomerIndivi
|
||||
|
||||
|
||||
export const CustomerLegalOrderByRelevanceFieldEnum = {
|
||||
company_name: 'company_name',
|
||||
name: 'name',
|
||||
economic_code: 'economic_code',
|
||||
registration_number: 'registration_number',
|
||||
postal_code: 'postal_code',
|
||||
@@ -1091,33 +1169,6 @@ export const CustomerLegalOrderByRelevanceFieldEnum = {
|
||||
export type CustomerLegalOrderByRelevanceFieldEnum = (typeof CustomerLegalOrderByRelevanceFieldEnum)[keyof typeof CustomerLegalOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const GoodOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
sku: 'sku',
|
||||
description: 'description',
|
||||
local_sku: 'local_sku',
|
||||
barcode: 'barcode',
|
||||
image_url: 'image_url',
|
||||
category_id: 'category_id',
|
||||
business_activity_id: 'business_activity_id'
|
||||
} as const
|
||||
|
||||
export type GoodOrderByRelevanceFieldEnum = (typeof GoodOrderByRelevanceFieldEnum)[keyof typeof GoodOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const GoodCategoryOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
image_url: 'image_url',
|
||||
complex_id: 'complex_id',
|
||||
guild_id: 'guild_id'
|
||||
} as const
|
||||
|
||||
export type GoodCategoryOrderByRelevanceFieldEnum = (typeof GoodCategoryOrderByRelevanceFieldEnum)[keyof typeof GoodCategoryOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const GuildOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
@@ -1141,6 +1192,9 @@ export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByR
|
||||
|
||||
export const SalesInvoiceItemOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
measure_unit_text: 'measure_unit_text',
|
||||
measure_unit_code: 'measure_unit_code',
|
||||
sku_code: 'sku_code',
|
||||
notes: 'notes',
|
||||
invoice_id: 'invoice_id',
|
||||
good_id: 'good_id',
|
||||
@@ -1160,7 +1214,6 @@ export type SaleInvoiceFiscalsOrderByRelevanceFieldEnum = (typeof SaleInvoiceFis
|
||||
|
||||
export const SaleInvoiceFiscalAttemptsOrderByRelevanceFieldEnum = {
|
||||
id: 'id',
|
||||
status: 'status',
|
||||
tax_id: 'tax_id',
|
||||
error_message: 'error_message',
|
||||
fiscal_id: 'fiscal_id'
|
||||
|
||||
@@ -38,12 +38,14 @@ export type * from './models/ConsumerLegal.js'
|
||||
export type * from './models/BusinessActivity.js'
|
||||
export type * from './models/Complex.js'
|
||||
export type * from './models/Pos.js'
|
||||
export type * from './models/Good.js'
|
||||
export type * from './models/GoodCategory.js'
|
||||
export type * from './models/MeasureUnits.js'
|
||||
export type * from './models/StockKeepingUnits.js'
|
||||
export type * from './models/TriggerLog.js'
|
||||
export type * from './models/Customer.js'
|
||||
export type * from './models/CustomerIndividual.js'
|
||||
export type * from './models/CustomerLegal.js'
|
||||
export type * from './models/Good.js'
|
||||
export type * from './models/GoodCategory.js'
|
||||
export type * from './models/Guild.js'
|
||||
export type * from './models/SalesInvoice.js'
|
||||
export type * from './models/SalesInvoiceItem.js'
|
||||
|
||||
@@ -556,6 +556,22 @@ export type BusinessActivityUpdateOneRequiredWithoutComplexesNestedInput = {
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.BusinessActivityUpdateToOneWithWhereWithoutComplexesInput, Prisma.BusinessActivityUpdateWithoutComplexesInput>, Prisma.BusinessActivityUncheckedUpdateWithoutComplexesInput>
|
||||
}
|
||||
|
||||
export type BusinessActivityCreateNestedOneWithoutGoodsInput = {
|
||||
create?: Prisma.XOR<Prisma.BusinessActivityCreateWithoutGoodsInput, Prisma.BusinessActivityUncheckedCreateWithoutGoodsInput>
|
||||
connectOrCreate?: Prisma.BusinessActivityCreateOrConnectWithoutGoodsInput
|
||||
connect?: Prisma.BusinessActivityWhereUniqueInput
|
||||
}
|
||||
|
||||
export type BusinessActivityUpdateOneWithoutGoodsNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.BusinessActivityCreateWithoutGoodsInput, Prisma.BusinessActivityUncheckedCreateWithoutGoodsInput>
|
||||
connectOrCreate?: Prisma.BusinessActivityCreateOrConnectWithoutGoodsInput
|
||||
upsert?: Prisma.BusinessActivityUpsertWithoutGoodsInput
|
||||
disconnect?: Prisma.BusinessActivityWhereInput | boolean
|
||||
delete?: Prisma.BusinessActivityWhereInput | boolean
|
||||
connect?: Prisma.BusinessActivityWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.BusinessActivityUpdateToOneWithWhereWithoutGoodsInput, Prisma.BusinessActivityUpdateWithoutGoodsInput>, Prisma.BusinessActivityUncheckedUpdateWithoutGoodsInput>
|
||||
}
|
||||
|
||||
export type BusinessActivityCreateNestedOneWithoutCustomer_individualsInput = {
|
||||
create?: Prisma.XOR<Prisma.BusinessActivityCreateWithoutCustomer_individualsInput, Prisma.BusinessActivityUncheckedCreateWithoutCustomer_individualsInput>
|
||||
connectOrCreate?: Prisma.BusinessActivityCreateOrConnectWithoutCustomer_individualsInput
|
||||
@@ -584,22 +600,6 @@ export type BusinessActivityUpdateOneRequiredWithoutCustomer_legalsNestedInput =
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.BusinessActivityUpdateToOneWithWhereWithoutCustomer_legalsInput, Prisma.BusinessActivityUpdateWithoutCustomer_legalsInput>, Prisma.BusinessActivityUncheckedUpdateWithoutCustomer_legalsInput>
|
||||
}
|
||||
|
||||
export type BusinessActivityCreateNestedOneWithoutGoodsInput = {
|
||||
create?: Prisma.XOR<Prisma.BusinessActivityCreateWithoutGoodsInput, Prisma.BusinessActivityUncheckedCreateWithoutGoodsInput>
|
||||
connectOrCreate?: Prisma.BusinessActivityCreateOrConnectWithoutGoodsInput
|
||||
connect?: Prisma.BusinessActivityWhereUniqueInput
|
||||
}
|
||||
|
||||
export type BusinessActivityUpdateOneWithoutGoodsNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.BusinessActivityCreateWithoutGoodsInput, Prisma.BusinessActivityUncheckedCreateWithoutGoodsInput>
|
||||
connectOrCreate?: Prisma.BusinessActivityCreateOrConnectWithoutGoodsInput
|
||||
upsert?: Prisma.BusinessActivityUpsertWithoutGoodsInput
|
||||
disconnect?: Prisma.BusinessActivityWhereInput | boolean
|
||||
delete?: Prisma.BusinessActivityWhereInput | boolean
|
||||
connect?: Prisma.BusinessActivityWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.BusinessActivityUpdateToOneWithWhereWithoutGoodsInput, Prisma.BusinessActivityUpdateWithoutGoodsInput>, Prisma.BusinessActivityUncheckedUpdateWithoutGoodsInput>
|
||||
}
|
||||
|
||||
export type BusinessActivityCreateNestedManyWithoutGuildInput = {
|
||||
create?: Prisma.XOR<Prisma.BusinessActivityCreateWithoutGuildInput, Prisma.BusinessActivityUncheckedCreateWithoutGuildInput> | Prisma.BusinessActivityCreateWithoutGuildInput[] | Prisma.BusinessActivityUncheckedCreateWithoutGuildInput[]
|
||||
connectOrCreate?: Prisma.BusinessActivityCreateOrConnectWithoutGuildInput | Prisma.BusinessActivityCreateOrConnectWithoutGuildInput[]
|
||||
@@ -969,6 +969,90 @@ export type BusinessActivityUncheckedUpdateWithoutComplexesInput = {
|
||||
customer_legals?: Prisma.CustomerLegalUncheckedUpdateManyWithoutBusiness_activityNestedInput
|
||||
}
|
||||
|
||||
export type BusinessActivityCreateWithoutGoodsInput = {
|
||||
id?: string
|
||||
economic_code: string
|
||||
name: string
|
||||
fiscal_id: string
|
||||
partner_token: string
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
guild: Prisma.GuildCreateNestedOneWithoutBusiness_activitiesInput
|
||||
consumer: Prisma.ConsumerCreateNestedOneWithoutBusiness_activitiesInput
|
||||
license_activation?: Prisma.LicenseActivationCreateNestedOneWithoutBusiness_activityInput
|
||||
complexes?: Prisma.ComplexCreateNestedManyWithoutBusiness_activityInput
|
||||
permission_businesses?: Prisma.PermissionBusinessCreateNestedManyWithoutBusinessInput
|
||||
customer_individuals?: Prisma.CustomerIndividualCreateNestedManyWithoutBusiness_activityInput
|
||||
customer_legals?: Prisma.CustomerLegalCreateNestedManyWithoutBusiness_activityInput
|
||||
}
|
||||
|
||||
export type BusinessActivityUncheckedCreateWithoutGoodsInput = {
|
||||
id?: string
|
||||
economic_code: string
|
||||
name: string
|
||||
fiscal_id: string
|
||||
partner_token: string
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
guild_id: string
|
||||
consumer_id: string
|
||||
license_activation?: Prisma.LicenseActivationUncheckedCreateNestedOneWithoutBusiness_activityInput
|
||||
complexes?: Prisma.ComplexUncheckedCreateNestedManyWithoutBusiness_activityInput
|
||||
permission_businesses?: Prisma.PermissionBusinessUncheckedCreateNestedManyWithoutBusinessInput
|
||||
customer_individuals?: Prisma.CustomerIndividualUncheckedCreateNestedManyWithoutBusiness_activityInput
|
||||
customer_legals?: Prisma.CustomerLegalUncheckedCreateNestedManyWithoutBusiness_activityInput
|
||||
}
|
||||
|
||||
export type BusinessActivityCreateOrConnectWithoutGoodsInput = {
|
||||
where: Prisma.BusinessActivityWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.BusinessActivityCreateWithoutGoodsInput, Prisma.BusinessActivityUncheckedCreateWithoutGoodsInput>
|
||||
}
|
||||
|
||||
export type BusinessActivityUpsertWithoutGoodsInput = {
|
||||
update: Prisma.XOR<Prisma.BusinessActivityUpdateWithoutGoodsInput, Prisma.BusinessActivityUncheckedUpdateWithoutGoodsInput>
|
||||
create: Prisma.XOR<Prisma.BusinessActivityCreateWithoutGoodsInput, Prisma.BusinessActivityUncheckedCreateWithoutGoodsInput>
|
||||
where?: Prisma.BusinessActivityWhereInput
|
||||
}
|
||||
|
||||
export type BusinessActivityUpdateToOneWithWhereWithoutGoodsInput = {
|
||||
where?: Prisma.BusinessActivityWhereInput
|
||||
data: Prisma.XOR<Prisma.BusinessActivityUpdateWithoutGoodsInput, Prisma.BusinessActivityUncheckedUpdateWithoutGoodsInput>
|
||||
}
|
||||
|
||||
export type BusinessActivityUpdateWithoutGoodsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
fiscal_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
partner_token?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
guild?: Prisma.GuildUpdateOneRequiredWithoutBusiness_activitiesNestedInput
|
||||
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutBusiness_activitiesNestedInput
|
||||
license_activation?: Prisma.LicenseActivationUpdateOneWithoutBusiness_activityNestedInput
|
||||
complexes?: Prisma.ComplexUpdateManyWithoutBusiness_activityNestedInput
|
||||
permission_businesses?: Prisma.PermissionBusinessUpdateManyWithoutBusinessNestedInput
|
||||
customer_individuals?: Prisma.CustomerIndividualUpdateManyWithoutBusiness_activityNestedInput
|
||||
customer_legals?: Prisma.CustomerLegalUpdateManyWithoutBusiness_activityNestedInput
|
||||
}
|
||||
|
||||
export type BusinessActivityUncheckedUpdateWithoutGoodsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
fiscal_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
partner_token?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
guild_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
license_activation?: Prisma.LicenseActivationUncheckedUpdateOneWithoutBusiness_activityNestedInput
|
||||
complexes?: Prisma.ComplexUncheckedUpdateManyWithoutBusiness_activityNestedInput
|
||||
permission_businesses?: Prisma.PermissionBusinessUncheckedUpdateManyWithoutBusinessNestedInput
|
||||
customer_individuals?: Prisma.CustomerIndividualUncheckedUpdateManyWithoutBusiness_activityNestedInput
|
||||
customer_legals?: Prisma.CustomerLegalUncheckedUpdateManyWithoutBusiness_activityNestedInput
|
||||
}
|
||||
|
||||
export type BusinessActivityCreateWithoutCustomer_individualsInput = {
|
||||
id?: string
|
||||
economic_code: string
|
||||
@@ -1137,90 +1221,6 @@ export type BusinessActivityUncheckedUpdateWithoutCustomer_legalsInput = {
|
||||
customer_individuals?: Prisma.CustomerIndividualUncheckedUpdateManyWithoutBusiness_activityNestedInput
|
||||
}
|
||||
|
||||
export type BusinessActivityCreateWithoutGoodsInput = {
|
||||
id?: string
|
||||
economic_code: string
|
||||
name: string
|
||||
fiscal_id: string
|
||||
partner_token: string
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
guild: Prisma.GuildCreateNestedOneWithoutBusiness_activitiesInput
|
||||
consumer: Prisma.ConsumerCreateNestedOneWithoutBusiness_activitiesInput
|
||||
license_activation?: Prisma.LicenseActivationCreateNestedOneWithoutBusiness_activityInput
|
||||
complexes?: Prisma.ComplexCreateNestedManyWithoutBusiness_activityInput
|
||||
permission_businesses?: Prisma.PermissionBusinessCreateNestedManyWithoutBusinessInput
|
||||
customer_individuals?: Prisma.CustomerIndividualCreateNestedManyWithoutBusiness_activityInput
|
||||
customer_legals?: Prisma.CustomerLegalCreateNestedManyWithoutBusiness_activityInput
|
||||
}
|
||||
|
||||
export type BusinessActivityUncheckedCreateWithoutGoodsInput = {
|
||||
id?: string
|
||||
economic_code: string
|
||||
name: string
|
||||
fiscal_id: string
|
||||
partner_token: string
|
||||
created_at?: Date | string
|
||||
updated_at?: Date | string
|
||||
guild_id: string
|
||||
consumer_id: string
|
||||
license_activation?: Prisma.LicenseActivationUncheckedCreateNestedOneWithoutBusiness_activityInput
|
||||
complexes?: Prisma.ComplexUncheckedCreateNestedManyWithoutBusiness_activityInput
|
||||
permission_businesses?: Prisma.PermissionBusinessUncheckedCreateNestedManyWithoutBusinessInput
|
||||
customer_individuals?: Prisma.CustomerIndividualUncheckedCreateNestedManyWithoutBusiness_activityInput
|
||||
customer_legals?: Prisma.CustomerLegalUncheckedCreateNestedManyWithoutBusiness_activityInput
|
||||
}
|
||||
|
||||
export type BusinessActivityCreateOrConnectWithoutGoodsInput = {
|
||||
where: Prisma.BusinessActivityWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.BusinessActivityCreateWithoutGoodsInput, Prisma.BusinessActivityUncheckedCreateWithoutGoodsInput>
|
||||
}
|
||||
|
||||
export type BusinessActivityUpsertWithoutGoodsInput = {
|
||||
update: Prisma.XOR<Prisma.BusinessActivityUpdateWithoutGoodsInput, Prisma.BusinessActivityUncheckedUpdateWithoutGoodsInput>
|
||||
create: Prisma.XOR<Prisma.BusinessActivityCreateWithoutGoodsInput, Prisma.BusinessActivityUncheckedCreateWithoutGoodsInput>
|
||||
where?: Prisma.BusinessActivityWhereInput
|
||||
}
|
||||
|
||||
export type BusinessActivityUpdateToOneWithWhereWithoutGoodsInput = {
|
||||
where?: Prisma.BusinessActivityWhereInput
|
||||
data: Prisma.XOR<Prisma.BusinessActivityUpdateWithoutGoodsInput, Prisma.BusinessActivityUncheckedUpdateWithoutGoodsInput>
|
||||
}
|
||||
|
||||
export type BusinessActivityUpdateWithoutGoodsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
fiscal_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
partner_token?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
guild?: Prisma.GuildUpdateOneRequiredWithoutBusiness_activitiesNestedInput
|
||||
consumer?: Prisma.ConsumerUpdateOneRequiredWithoutBusiness_activitiesNestedInput
|
||||
license_activation?: Prisma.LicenseActivationUpdateOneWithoutBusiness_activityNestedInput
|
||||
complexes?: Prisma.ComplexUpdateManyWithoutBusiness_activityNestedInput
|
||||
permission_businesses?: Prisma.PermissionBusinessUpdateManyWithoutBusinessNestedInput
|
||||
customer_individuals?: Prisma.CustomerIndividualUpdateManyWithoutBusiness_activityNestedInput
|
||||
customer_legals?: Prisma.CustomerLegalUpdateManyWithoutBusiness_activityNestedInput
|
||||
}
|
||||
|
||||
export type BusinessActivityUncheckedUpdateWithoutGoodsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
fiscal_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
partner_token?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
created_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updated_at?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
guild_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
consumer_id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
license_activation?: Prisma.LicenseActivationUncheckedUpdateOneWithoutBusiness_activityNestedInput
|
||||
complexes?: Prisma.ComplexUncheckedUpdateManyWithoutBusiness_activityNestedInput
|
||||
permission_businesses?: Prisma.PermissionBusinessUncheckedUpdateManyWithoutBusinessNestedInput
|
||||
customer_individuals?: Prisma.CustomerIndividualUncheckedUpdateManyWithoutBusiness_activityNestedInput
|
||||
customer_legals?: Prisma.CustomerLegalUncheckedUpdateManyWithoutBusiness_activityNestedInput
|
||||
}
|
||||
|
||||
export type BusinessActivityCreateWithoutGuildInput = {
|
||||
id?: string
|
||||
economic_code: string
|
||||
|
||||
@@ -373,10 +373,6 @@ export type EnumCustomerTypeFieldUpdateOperationsInput = {
|
||||
set?: $Enums.CustomerType
|
||||
}
|
||||
|
||||
export type NullableDateTimeFieldUpdateOperationsInput = {
|
||||
set?: Date | string | null
|
||||
}
|
||||
|
||||
export type CustomerCreateNestedOneWithoutIndividualInput = {
|
||||
create?: Prisma.XOR<Prisma.CustomerCreateWithoutIndividualInput, Prisma.CustomerUncheckedCreateWithoutIndividualInput>
|
||||
connectOrCreate?: Prisma.CustomerCreateOrConnectWithoutIndividualInput
|
||||
|
||||
@@ -25,7 +25,7 @@ export type AggregateCustomerLegal = {
|
||||
}
|
||||
|
||||
export type CustomerLegalMinAggregateOutputType = {
|
||||
company_name: string | null
|
||||
name: string | null
|
||||
economic_code: string | null
|
||||
registration_number: string | null
|
||||
postal_code: string | null
|
||||
@@ -34,7 +34,7 @@ export type CustomerLegalMinAggregateOutputType = {
|
||||
}
|
||||
|
||||
export type CustomerLegalMaxAggregateOutputType = {
|
||||
company_name: string | null
|
||||
name: string | null
|
||||
economic_code: string | null
|
||||
registration_number: string | null
|
||||
postal_code: string | null
|
||||
@@ -43,7 +43,7 @@ export type CustomerLegalMaxAggregateOutputType = {
|
||||
}
|
||||
|
||||
export type CustomerLegalCountAggregateOutputType = {
|
||||
company_name: number
|
||||
name: number
|
||||
economic_code: number
|
||||
registration_number: number
|
||||
postal_code: number
|
||||
@@ -54,7 +54,7 @@ export type CustomerLegalCountAggregateOutputType = {
|
||||
|
||||
|
||||
export type CustomerLegalMinAggregateInputType = {
|
||||
company_name?: true
|
||||
name?: true
|
||||
economic_code?: true
|
||||
registration_number?: true
|
||||
postal_code?: true
|
||||
@@ -63,7 +63,7 @@ export type CustomerLegalMinAggregateInputType = {
|
||||
}
|
||||
|
||||
export type CustomerLegalMaxAggregateInputType = {
|
||||
company_name?: true
|
||||
name?: true
|
||||
economic_code?: true
|
||||
registration_number?: true
|
||||
postal_code?: true
|
||||
@@ -72,7 +72,7 @@ export type CustomerLegalMaxAggregateInputType = {
|
||||
}
|
||||
|
||||
export type CustomerLegalCountAggregateInputType = {
|
||||
company_name?: true
|
||||
name?: true
|
||||
economic_code?: true
|
||||
registration_number?: true
|
||||
postal_code?: true
|
||||
@@ -154,7 +154,7 @@ export type CustomerLegalGroupByArgs<ExtArgs extends runtime.Types.Extensions.In
|
||||
}
|
||||
|
||||
export type CustomerLegalGroupByOutputType = {
|
||||
company_name: string
|
||||
name: string
|
||||
economic_code: string
|
||||
registration_number: string | null
|
||||
postal_code: string
|
||||
@@ -184,7 +184,7 @@ export type CustomerLegalWhereInput = {
|
||||
AND?: Prisma.CustomerLegalWhereInput | Prisma.CustomerLegalWhereInput[]
|
||||
OR?: Prisma.CustomerLegalWhereInput[]
|
||||
NOT?: Prisma.CustomerLegalWhereInput | Prisma.CustomerLegalWhereInput[]
|
||||
company_name?: Prisma.StringFilter<"CustomerLegal"> | string
|
||||
name?: Prisma.StringFilter<"CustomerLegal"> | string
|
||||
economic_code?: Prisma.StringFilter<"CustomerLegal"> | string
|
||||
registration_number?: Prisma.StringNullableFilter<"CustomerLegal"> | string | null
|
||||
postal_code?: Prisma.StringFilter<"CustomerLegal"> | string
|
||||
@@ -195,7 +195,7 @@ export type CustomerLegalWhereInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalOrderByWithRelationInput = {
|
||||
company_name?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
economic_code?: Prisma.SortOrder
|
||||
registration_number?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
postal_code?: Prisma.SortOrder
|
||||
@@ -212,7 +212,7 @@ export type CustomerLegalWhereUniqueInput = Prisma.AtLeast<{
|
||||
AND?: Prisma.CustomerLegalWhereInput | Prisma.CustomerLegalWhereInput[]
|
||||
OR?: Prisma.CustomerLegalWhereInput[]
|
||||
NOT?: Prisma.CustomerLegalWhereInput | Prisma.CustomerLegalWhereInput[]
|
||||
company_name?: Prisma.StringFilter<"CustomerLegal"> | string
|
||||
name?: Prisma.StringFilter<"CustomerLegal"> | string
|
||||
economic_code?: Prisma.StringFilter<"CustomerLegal"> | string
|
||||
registration_number?: Prisma.StringNullableFilter<"CustomerLegal"> | string | null
|
||||
postal_code?: Prisma.StringFilter<"CustomerLegal"> | string
|
||||
@@ -222,7 +222,7 @@ export type CustomerLegalWhereUniqueInput = Prisma.AtLeast<{
|
||||
}, "customer_id" | "business_activity_id_economic_code">
|
||||
|
||||
export type CustomerLegalOrderByWithAggregationInput = {
|
||||
company_name?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
economic_code?: Prisma.SortOrder
|
||||
registration_number?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
postal_code?: Prisma.SortOrder
|
||||
@@ -237,7 +237,7 @@ export type CustomerLegalScalarWhereWithAggregatesInput = {
|
||||
AND?: Prisma.CustomerLegalScalarWhereWithAggregatesInput | Prisma.CustomerLegalScalarWhereWithAggregatesInput[]
|
||||
OR?: Prisma.CustomerLegalScalarWhereWithAggregatesInput[]
|
||||
NOT?: Prisma.CustomerLegalScalarWhereWithAggregatesInput | Prisma.CustomerLegalScalarWhereWithAggregatesInput[]
|
||||
company_name?: Prisma.StringWithAggregatesFilter<"CustomerLegal"> | string
|
||||
name?: Prisma.StringWithAggregatesFilter<"CustomerLegal"> | string
|
||||
economic_code?: Prisma.StringWithAggregatesFilter<"CustomerLegal"> | string
|
||||
registration_number?: Prisma.StringNullableWithAggregatesFilter<"CustomerLegal"> | string | null
|
||||
postal_code?: Prisma.StringWithAggregatesFilter<"CustomerLegal"> | string
|
||||
@@ -246,7 +246,7 @@ export type CustomerLegalScalarWhereWithAggregatesInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalCreateInput = {
|
||||
company_name: string
|
||||
name: string
|
||||
economic_code: string
|
||||
registration_number?: string | null
|
||||
postal_code: string
|
||||
@@ -255,7 +255,7 @@ export type CustomerLegalCreateInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalUncheckedCreateInput = {
|
||||
company_name: string
|
||||
name: string
|
||||
economic_code: string
|
||||
registration_number?: string | null
|
||||
postal_code: string
|
||||
@@ -264,7 +264,7 @@ export type CustomerLegalUncheckedCreateInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalUpdateInput = {
|
||||
company_name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
registration_number?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
postal_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -273,7 +273,7 @@ export type CustomerLegalUpdateInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalUncheckedUpdateInput = {
|
||||
company_name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
registration_number?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
postal_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -282,7 +282,7 @@ export type CustomerLegalUncheckedUpdateInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalCreateManyInput = {
|
||||
company_name: string
|
||||
name: string
|
||||
economic_code: string
|
||||
registration_number?: string | null
|
||||
postal_code: string
|
||||
@@ -291,14 +291,14 @@ export type CustomerLegalCreateManyInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalUpdateManyMutationInput = {
|
||||
company_name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
registration_number?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
postal_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
}
|
||||
|
||||
export type CustomerLegalUncheckedUpdateManyInput = {
|
||||
company_name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
registration_number?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
postal_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -333,7 +333,7 @@ export type CustomerLegalBusiness_activity_idEconomic_codeCompoundUniqueInput =
|
||||
}
|
||||
|
||||
export type CustomerLegalCountOrderByAggregateInput = {
|
||||
company_name?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
economic_code?: Prisma.SortOrder
|
||||
registration_number?: Prisma.SortOrder
|
||||
postal_code?: Prisma.SortOrder
|
||||
@@ -342,7 +342,7 @@ export type CustomerLegalCountOrderByAggregateInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalMaxOrderByAggregateInput = {
|
||||
company_name?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
economic_code?: Prisma.SortOrder
|
||||
registration_number?: Prisma.SortOrder
|
||||
postal_code?: Prisma.SortOrder
|
||||
@@ -351,7 +351,7 @@ export type CustomerLegalMaxOrderByAggregateInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalMinOrderByAggregateInput = {
|
||||
company_name?: Prisma.SortOrder
|
||||
name?: Prisma.SortOrder
|
||||
economic_code?: Prisma.SortOrder
|
||||
registration_number?: Prisma.SortOrder
|
||||
postal_code?: Prisma.SortOrder
|
||||
@@ -434,7 +434,7 @@ export type CustomerLegalUncheckedUpdateOneWithoutCustomerNestedInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalCreateWithoutBusiness_activityInput = {
|
||||
company_name: string
|
||||
name: string
|
||||
economic_code: string
|
||||
registration_number?: string | null
|
||||
postal_code: string
|
||||
@@ -442,7 +442,7 @@ export type CustomerLegalCreateWithoutBusiness_activityInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalUncheckedCreateWithoutBusiness_activityInput = {
|
||||
company_name: string
|
||||
name: string
|
||||
economic_code: string
|
||||
registration_number?: string | null
|
||||
postal_code: string
|
||||
@@ -479,7 +479,7 @@ export type CustomerLegalScalarWhereInput = {
|
||||
AND?: Prisma.CustomerLegalScalarWhereInput | Prisma.CustomerLegalScalarWhereInput[]
|
||||
OR?: Prisma.CustomerLegalScalarWhereInput[]
|
||||
NOT?: Prisma.CustomerLegalScalarWhereInput | Prisma.CustomerLegalScalarWhereInput[]
|
||||
company_name?: Prisma.StringFilter<"CustomerLegal"> | string
|
||||
name?: Prisma.StringFilter<"CustomerLegal"> | string
|
||||
economic_code?: Prisma.StringFilter<"CustomerLegal"> | string
|
||||
registration_number?: Prisma.StringNullableFilter<"CustomerLegal"> | string | null
|
||||
postal_code?: Prisma.StringFilter<"CustomerLegal"> | string
|
||||
@@ -488,7 +488,7 @@ export type CustomerLegalScalarWhereInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalCreateWithoutCustomerInput = {
|
||||
company_name: string
|
||||
name: string
|
||||
economic_code: string
|
||||
registration_number?: string | null
|
||||
postal_code: string
|
||||
@@ -496,7 +496,7 @@ export type CustomerLegalCreateWithoutCustomerInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalUncheckedCreateWithoutCustomerInput = {
|
||||
company_name: string
|
||||
name: string
|
||||
economic_code: string
|
||||
registration_number?: string | null
|
||||
postal_code: string
|
||||
@@ -520,7 +520,7 @@ export type CustomerLegalUpdateToOneWithWhereWithoutCustomerInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalUpdateWithoutCustomerInput = {
|
||||
company_name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
registration_number?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
postal_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -528,7 +528,7 @@ export type CustomerLegalUpdateWithoutCustomerInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalUncheckedUpdateWithoutCustomerInput = {
|
||||
company_name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
registration_number?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
postal_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -536,7 +536,7 @@ export type CustomerLegalUncheckedUpdateWithoutCustomerInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalCreateManyBusiness_activityInput = {
|
||||
company_name: string
|
||||
name: string
|
||||
economic_code: string
|
||||
registration_number?: string | null
|
||||
postal_code: string
|
||||
@@ -544,7 +544,7 @@ export type CustomerLegalCreateManyBusiness_activityInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalUpdateWithoutBusiness_activityInput = {
|
||||
company_name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
registration_number?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
postal_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -552,7 +552,7 @@ export type CustomerLegalUpdateWithoutBusiness_activityInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalUncheckedUpdateWithoutBusiness_activityInput = {
|
||||
company_name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
registration_number?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
postal_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -560,7 +560,7 @@ export type CustomerLegalUncheckedUpdateWithoutBusiness_activityInput = {
|
||||
}
|
||||
|
||||
export type CustomerLegalUncheckedUpdateManyWithoutBusiness_activityInput = {
|
||||
company_name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
economic_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
registration_number?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
postal_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
@@ -570,7 +570,7 @@ export type CustomerLegalUncheckedUpdateManyWithoutBusiness_activityInput = {
|
||||
|
||||
|
||||
export type CustomerLegalSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
company_name?: boolean
|
||||
name?: boolean
|
||||
economic_code?: boolean
|
||||
registration_number?: boolean
|
||||
postal_code?: boolean
|
||||
@@ -583,7 +583,7 @@ export type CustomerLegalSelect<ExtArgs extends runtime.Types.Extensions.Interna
|
||||
|
||||
|
||||
export type CustomerLegalSelectScalar = {
|
||||
company_name?: boolean
|
||||
name?: boolean
|
||||
economic_code?: boolean
|
||||
registration_number?: boolean
|
||||
postal_code?: boolean
|
||||
@@ -591,7 +591,7 @@ export type CustomerLegalSelectScalar = {
|
||||
business_activity_id?: boolean
|
||||
}
|
||||
|
||||
export type CustomerLegalOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"company_name" | "economic_code" | "registration_number" | "postal_code" | "customer_id" | "business_activity_id", ExtArgs["result"]["customerLegal"]>
|
||||
export type CustomerLegalOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"name" | "economic_code" | "registration_number" | "postal_code" | "customer_id" | "business_activity_id", ExtArgs["result"]["customerLegal"]>
|
||||
export type CustomerLegalInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
customer?: boolean | Prisma.CustomerDefaultArgs<ExtArgs>
|
||||
business_activity?: boolean | Prisma.BusinessActivityDefaultArgs<ExtArgs>
|
||||
@@ -604,7 +604,7 @@ export type $CustomerLegalPayload<ExtArgs extends runtime.Types.Extensions.Inter
|
||||
business_activity: Prisma.$BusinessActivityPayload<ExtArgs>
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
company_name: string
|
||||
name: string
|
||||
economic_code: string
|
||||
registration_number: string | null
|
||||
postal_code: string
|
||||
@@ -693,8 +693,8 @@ export interface CustomerLegalDelegate<ExtArgs extends runtime.Types.Extensions.
|
||||
* // Get first 10 CustomerLegals
|
||||
* const customerLegals = await prisma.customerLegal.findMany({ take: 10 })
|
||||
*
|
||||
* // Only select the `company_name`
|
||||
* const customerLegalWithCompany_nameOnly = await prisma.customerLegal.findMany({ select: { company_name: true } })
|
||||
* // Only select the `name`
|
||||
* const customerLegalWithNameOnly = await prisma.customerLegal.findMany({ select: { name: true } })
|
||||
*
|
||||
*/
|
||||
findMany<T extends CustomerLegalFindManyArgs>(args?: Prisma.SelectSubset<T, CustomerLegalFindManyArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$CustomerLegalPayload<ExtArgs>, T, "findMany", GlobalOmitOptions>>
|
||||
@@ -981,7 +981,7 @@ export interface Prisma__CustomerLegalClient<T, Null = never, ExtArgs extends ru
|
||||
* Fields of the CustomerLegal model
|
||||
*/
|
||||
export interface CustomerLegalFieldRefs {
|
||||
readonly company_name: Prisma.FieldRef<"CustomerLegal", 'String'>
|
||||
readonly 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'>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -37,8 +37,9 @@ export type SaleInvoiceFiscalAttemptsSumAggregateOutputType = {
|
||||
export type SaleInvoiceFiscalAttemptsMinAggregateOutputType = {
|
||||
id: string | null
|
||||
attempt_no: number | null
|
||||
status: string | null
|
||||
status: $Enums.FiscalResponseStatus | null
|
||||
tax_id: string | null
|
||||
type: $Enums.FiscalRequestType | null
|
||||
error_message: string | null
|
||||
sent_at: Date | null
|
||||
received_at: Date | null
|
||||
@@ -49,8 +50,9 @@ export type SaleInvoiceFiscalAttemptsMinAggregateOutputType = {
|
||||
export type SaleInvoiceFiscalAttemptsMaxAggregateOutputType = {
|
||||
id: string | null
|
||||
attempt_no: number | null
|
||||
status: string | null
|
||||
status: $Enums.FiscalResponseStatus | null
|
||||
tax_id: string | null
|
||||
type: $Enums.FiscalRequestType | null
|
||||
error_message: string | null
|
||||
sent_at: Date | null
|
||||
received_at: Date | null
|
||||
@@ -63,6 +65,7 @@ export type SaleInvoiceFiscalAttemptsCountAggregateOutputType = {
|
||||
attempt_no: number
|
||||
status: number
|
||||
tax_id: number
|
||||
type: number
|
||||
request_payload: number
|
||||
response_payload: number
|
||||
error_message: number
|
||||
@@ -87,6 +90,7 @@ export type SaleInvoiceFiscalAttemptsMinAggregateInputType = {
|
||||
attempt_no?: true
|
||||
status?: true
|
||||
tax_id?: true
|
||||
type?: true
|
||||
error_message?: true
|
||||
sent_at?: true
|
||||
received_at?: true
|
||||
@@ -99,6 +103,7 @@ export type SaleInvoiceFiscalAttemptsMaxAggregateInputType = {
|
||||
attempt_no?: true
|
||||
status?: true
|
||||
tax_id?: true
|
||||
type?: true
|
||||
error_message?: true
|
||||
sent_at?: true
|
||||
received_at?: true
|
||||
@@ -111,6 +116,7 @@ export type SaleInvoiceFiscalAttemptsCountAggregateInputType = {
|
||||
attempt_no?: true
|
||||
status?: true
|
||||
tax_id?: true
|
||||
type?: true
|
||||
request_payload?: true
|
||||
response_payload?: true
|
||||
error_message?: true
|
||||
@@ -210,8 +216,9 @@ export type SaleInvoiceFiscalAttemptsGroupByArgs<ExtArgs extends runtime.Types.E
|
||||
export type SaleInvoiceFiscalAttemptsGroupByOutputType = {
|
||||
id: string
|
||||
attempt_no: number
|
||||
status: string
|
||||
status: $Enums.FiscalResponseStatus
|
||||
tax_id: string | null
|
||||
type: $Enums.FiscalRequestType
|
||||
request_payload: runtime.JsonValue | null
|
||||
response_payload: runtime.JsonValue | null
|
||||
error_message: string | null
|
||||
@@ -247,8 +254,9 @@ export type SaleInvoiceFiscalAttemptsWhereInput = {
|
||||
NOT?: Prisma.SaleInvoiceFiscalAttemptsWhereInput | Prisma.SaleInvoiceFiscalAttemptsWhereInput[]
|
||||
id?: Prisma.StringFilter<"SaleInvoiceFiscalAttempts"> | string
|
||||
attempt_no?: Prisma.IntFilter<"SaleInvoiceFiscalAttempts"> | number
|
||||
status?: Prisma.StringFilter<"SaleInvoiceFiscalAttempts"> | string
|
||||
status?: Prisma.EnumFiscalResponseStatusFilter<"SaleInvoiceFiscalAttempts"> | $Enums.FiscalResponseStatus
|
||||
tax_id?: Prisma.StringNullableFilter<"SaleInvoiceFiscalAttempts"> | string | null
|
||||
type?: Prisma.EnumFiscalRequestTypeFilter<"SaleInvoiceFiscalAttempts"> | $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.JsonNullableFilter<"SaleInvoiceFiscalAttempts">
|
||||
response_payload?: Prisma.JsonNullableFilter<"SaleInvoiceFiscalAttempts">
|
||||
error_message?: Prisma.StringNullableFilter<"SaleInvoiceFiscalAttempts"> | string | null
|
||||
@@ -264,6 +272,7 @@ export type SaleInvoiceFiscalAttemptsOrderByWithRelationInput = {
|
||||
attempt_no?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
tax_id?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
request_payload?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
response_payload?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
error_message?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
@@ -283,7 +292,8 @@ export type SaleInvoiceFiscalAttemptsWhereUniqueInput = Prisma.AtLeast<{
|
||||
OR?: Prisma.SaleInvoiceFiscalAttemptsWhereInput[]
|
||||
NOT?: Prisma.SaleInvoiceFiscalAttemptsWhereInput | Prisma.SaleInvoiceFiscalAttemptsWhereInput[]
|
||||
attempt_no?: Prisma.IntFilter<"SaleInvoiceFiscalAttempts"> | number
|
||||
status?: Prisma.StringFilter<"SaleInvoiceFiscalAttempts"> | string
|
||||
status?: Prisma.EnumFiscalResponseStatusFilter<"SaleInvoiceFiscalAttempts"> | $Enums.FiscalResponseStatus
|
||||
type?: Prisma.EnumFiscalRequestTypeFilter<"SaleInvoiceFiscalAttempts"> | $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.JsonNullableFilter<"SaleInvoiceFiscalAttempts">
|
||||
response_payload?: Prisma.JsonNullableFilter<"SaleInvoiceFiscalAttempts">
|
||||
error_message?: Prisma.StringNullableFilter<"SaleInvoiceFiscalAttempts"> | string | null
|
||||
@@ -299,6 +309,7 @@ export type SaleInvoiceFiscalAttemptsOrderByWithAggregationInput = {
|
||||
attempt_no?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
tax_id?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
request_payload?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
response_payload?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
error_message?: Prisma.SortOrderInput | Prisma.SortOrder
|
||||
@@ -319,8 +330,9 @@ export type SaleInvoiceFiscalAttemptsScalarWhereWithAggregatesInput = {
|
||||
NOT?: Prisma.SaleInvoiceFiscalAttemptsScalarWhereWithAggregatesInput | Prisma.SaleInvoiceFiscalAttemptsScalarWhereWithAggregatesInput[]
|
||||
id?: Prisma.StringWithAggregatesFilter<"SaleInvoiceFiscalAttempts"> | string
|
||||
attempt_no?: Prisma.IntWithAggregatesFilter<"SaleInvoiceFiscalAttempts"> | number
|
||||
status?: Prisma.StringWithAggregatesFilter<"SaleInvoiceFiscalAttempts"> | string
|
||||
status?: Prisma.EnumFiscalResponseStatusWithAggregatesFilter<"SaleInvoiceFiscalAttempts"> | $Enums.FiscalResponseStatus
|
||||
tax_id?: Prisma.StringNullableWithAggregatesFilter<"SaleInvoiceFiscalAttempts"> | string | null
|
||||
type?: Prisma.EnumFiscalRequestTypeWithAggregatesFilter<"SaleInvoiceFiscalAttempts"> | $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.JsonNullableWithAggregatesFilter<"SaleInvoiceFiscalAttempts">
|
||||
response_payload?: Prisma.JsonNullableWithAggregatesFilter<"SaleInvoiceFiscalAttempts">
|
||||
error_message?: Prisma.StringNullableWithAggregatesFilter<"SaleInvoiceFiscalAttempts"> | string | null
|
||||
@@ -333,8 +345,9 @@ export type SaleInvoiceFiscalAttemptsScalarWhereWithAggregatesInput = {
|
||||
export type SaleInvoiceFiscalAttemptsCreateInput = {
|
||||
id?: string
|
||||
attempt_no: number
|
||||
status: string
|
||||
status: $Enums.FiscalResponseStatus
|
||||
tax_id?: string | null
|
||||
type: $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: string | null
|
||||
@@ -347,8 +360,9 @@ export type SaleInvoiceFiscalAttemptsCreateInput = {
|
||||
export type SaleInvoiceFiscalAttemptsUncheckedCreateInput = {
|
||||
id?: string
|
||||
attempt_no: number
|
||||
status: string
|
||||
status: $Enums.FiscalResponseStatus
|
||||
tax_id?: string | null
|
||||
type: $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: string | null
|
||||
@@ -361,8 +375,9 @@ export type SaleInvoiceFiscalAttemptsUncheckedCreateInput = {
|
||||
export type SaleInvoiceFiscalAttemptsUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
attempt_no?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
status?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumFiscalResponseStatusFieldUpdateOperationsInput | $Enums.FiscalResponseStatus
|
||||
tax_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumFiscalRequestTypeFieldUpdateOperationsInput | $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -375,8 +390,9 @@ export type SaleInvoiceFiscalAttemptsUpdateInput = {
|
||||
export type SaleInvoiceFiscalAttemptsUncheckedUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
attempt_no?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
status?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumFiscalResponseStatusFieldUpdateOperationsInput | $Enums.FiscalResponseStatus
|
||||
tax_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumFiscalRequestTypeFieldUpdateOperationsInput | $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -389,8 +405,9 @@ export type SaleInvoiceFiscalAttemptsUncheckedUpdateInput = {
|
||||
export type SaleInvoiceFiscalAttemptsCreateManyInput = {
|
||||
id?: string
|
||||
attempt_no: number
|
||||
status: string
|
||||
status: $Enums.FiscalResponseStatus
|
||||
tax_id?: string | null
|
||||
type: $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: string | null
|
||||
@@ -403,8 +420,9 @@ export type SaleInvoiceFiscalAttemptsCreateManyInput = {
|
||||
export type SaleInvoiceFiscalAttemptsUpdateManyMutationInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
attempt_no?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
status?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumFiscalResponseStatusFieldUpdateOperationsInput | $Enums.FiscalResponseStatus
|
||||
tax_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumFiscalRequestTypeFieldUpdateOperationsInput | $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -416,8 +434,9 @@ export type SaleInvoiceFiscalAttemptsUpdateManyMutationInput = {
|
||||
export type SaleInvoiceFiscalAttemptsUncheckedUpdateManyInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
attempt_no?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
status?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumFiscalResponseStatusFieldUpdateOperationsInput | $Enums.FiscalResponseStatus
|
||||
tax_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumFiscalRequestTypeFieldUpdateOperationsInput | $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -453,6 +472,7 @@ export type SaleInvoiceFiscalAttemptsCountOrderByAggregateInput = {
|
||||
attempt_no?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
tax_id?: Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
request_payload?: Prisma.SortOrder
|
||||
response_payload?: Prisma.SortOrder
|
||||
error_message?: Prisma.SortOrder
|
||||
@@ -471,6 +491,7 @@ export type SaleInvoiceFiscalAttemptsMaxOrderByAggregateInput = {
|
||||
attempt_no?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
tax_id?: Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
error_message?: Prisma.SortOrder
|
||||
sent_at?: Prisma.SortOrder
|
||||
received_at?: Prisma.SortOrder
|
||||
@@ -483,6 +504,7 @@ export type SaleInvoiceFiscalAttemptsMinOrderByAggregateInput = {
|
||||
attempt_no?: Prisma.SortOrder
|
||||
status?: Prisma.SortOrder
|
||||
tax_id?: Prisma.SortOrder
|
||||
type?: Prisma.SortOrder
|
||||
error_message?: Prisma.SortOrder
|
||||
sent_at?: Prisma.SortOrder
|
||||
received_at?: Prisma.SortOrder
|
||||
@@ -536,11 +558,20 @@ export type SaleInvoiceFiscalAttemptsUncheckedUpdateManyWithoutFiscalNestedInput
|
||||
deleteMany?: Prisma.SaleInvoiceFiscalAttemptsScalarWhereInput | Prisma.SaleInvoiceFiscalAttemptsScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type EnumFiscalResponseStatusFieldUpdateOperationsInput = {
|
||||
set?: $Enums.FiscalResponseStatus
|
||||
}
|
||||
|
||||
export type EnumFiscalRequestTypeFieldUpdateOperationsInput = {
|
||||
set?: $Enums.FiscalRequestType
|
||||
}
|
||||
|
||||
export type SaleInvoiceFiscalAttemptsCreateWithoutFiscalInput = {
|
||||
id?: string
|
||||
attempt_no: number
|
||||
status: string
|
||||
status: $Enums.FiscalResponseStatus
|
||||
tax_id?: string | null
|
||||
type: $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: string | null
|
||||
@@ -552,8 +583,9 @@ export type SaleInvoiceFiscalAttemptsCreateWithoutFiscalInput = {
|
||||
export type SaleInvoiceFiscalAttemptsUncheckedCreateWithoutFiscalInput = {
|
||||
id?: string
|
||||
attempt_no: number
|
||||
status: string
|
||||
status: $Enums.FiscalResponseStatus
|
||||
tax_id?: string | null
|
||||
type: $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: string | null
|
||||
@@ -594,8 +626,9 @@ export type SaleInvoiceFiscalAttemptsScalarWhereInput = {
|
||||
NOT?: Prisma.SaleInvoiceFiscalAttemptsScalarWhereInput | Prisma.SaleInvoiceFiscalAttemptsScalarWhereInput[]
|
||||
id?: Prisma.StringFilter<"SaleInvoiceFiscalAttempts"> | string
|
||||
attempt_no?: Prisma.IntFilter<"SaleInvoiceFiscalAttempts"> | number
|
||||
status?: Prisma.StringFilter<"SaleInvoiceFiscalAttempts"> | string
|
||||
status?: Prisma.EnumFiscalResponseStatusFilter<"SaleInvoiceFiscalAttempts"> | $Enums.FiscalResponseStatus
|
||||
tax_id?: Prisma.StringNullableFilter<"SaleInvoiceFiscalAttempts"> | string | null
|
||||
type?: Prisma.EnumFiscalRequestTypeFilter<"SaleInvoiceFiscalAttempts"> | $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.JsonNullableFilter<"SaleInvoiceFiscalAttempts">
|
||||
response_payload?: Prisma.JsonNullableFilter<"SaleInvoiceFiscalAttempts">
|
||||
error_message?: Prisma.StringNullableFilter<"SaleInvoiceFiscalAttempts"> | string | null
|
||||
@@ -608,8 +641,9 @@ export type SaleInvoiceFiscalAttemptsScalarWhereInput = {
|
||||
export type SaleInvoiceFiscalAttemptsCreateManyFiscalInput = {
|
||||
id?: string
|
||||
attempt_no: number
|
||||
status: string
|
||||
status: $Enums.FiscalResponseStatus
|
||||
tax_id?: string | null
|
||||
type: $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: string | null
|
||||
@@ -621,8 +655,9 @@ export type SaleInvoiceFiscalAttemptsCreateManyFiscalInput = {
|
||||
export type SaleInvoiceFiscalAttemptsUpdateWithoutFiscalInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
attempt_no?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
status?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumFiscalResponseStatusFieldUpdateOperationsInput | $Enums.FiscalResponseStatus
|
||||
tax_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumFiscalRequestTypeFieldUpdateOperationsInput | $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -634,8 +669,9 @@ export type SaleInvoiceFiscalAttemptsUpdateWithoutFiscalInput = {
|
||||
export type SaleInvoiceFiscalAttemptsUncheckedUpdateWithoutFiscalInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
attempt_no?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
status?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumFiscalResponseStatusFieldUpdateOperationsInput | $Enums.FiscalResponseStatus
|
||||
tax_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumFiscalRequestTypeFieldUpdateOperationsInput | $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -647,8 +683,9 @@ export type SaleInvoiceFiscalAttemptsUncheckedUpdateWithoutFiscalInput = {
|
||||
export type SaleInvoiceFiscalAttemptsUncheckedUpdateManyWithoutFiscalInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
attempt_no?: Prisma.IntFieldUpdateOperationsInput | number
|
||||
status?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
status?: Prisma.EnumFiscalResponseStatusFieldUpdateOperationsInput | $Enums.FiscalResponseStatus
|
||||
tax_id?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
type?: Prisma.EnumFiscalRequestTypeFieldUpdateOperationsInput | $Enums.FiscalRequestType
|
||||
request_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
response_payload?: Prisma.NullableJsonNullValueInput | runtime.InputJsonValue
|
||||
error_message?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -664,6 +701,7 @@ export type SaleInvoiceFiscalAttemptsSelect<ExtArgs extends runtime.Types.Extens
|
||||
attempt_no?: boolean
|
||||
status?: boolean
|
||||
tax_id?: boolean
|
||||
type?: boolean
|
||||
request_payload?: boolean
|
||||
response_payload?: boolean
|
||||
error_message?: boolean
|
||||
@@ -681,6 +719,7 @@ export type SaleInvoiceFiscalAttemptsSelectScalar = {
|
||||
attempt_no?: boolean
|
||||
status?: boolean
|
||||
tax_id?: boolean
|
||||
type?: boolean
|
||||
request_payload?: boolean
|
||||
response_payload?: boolean
|
||||
error_message?: boolean
|
||||
@@ -690,7 +729,7 @@ export type SaleInvoiceFiscalAttemptsSelectScalar = {
|
||||
fiscal_id?: boolean
|
||||
}
|
||||
|
||||
export type SaleInvoiceFiscalAttemptsOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "attempt_no" | "status" | "tax_id" | "request_payload" | "response_payload" | "error_message" | "sent_at" | "received_at" | "created_at" | "fiscal_id", ExtArgs["result"]["saleInvoiceFiscalAttempts"]>
|
||||
export type SaleInvoiceFiscalAttemptsOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "attempt_no" | "status" | "tax_id" | "type" | "request_payload" | "response_payload" | "error_message" | "sent_at" | "received_at" | "created_at" | "fiscal_id", ExtArgs["result"]["saleInvoiceFiscalAttempts"]>
|
||||
export type SaleInvoiceFiscalAttemptsInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
fiscal?: boolean | Prisma.SaleInvoiceFiscalsDefaultArgs<ExtArgs>
|
||||
}
|
||||
@@ -703,8 +742,9 @@ export type $SaleInvoiceFiscalAttemptsPayload<ExtArgs extends runtime.Types.Exte
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
attempt_no: number
|
||||
status: string
|
||||
status: $Enums.FiscalResponseStatus
|
||||
tax_id: string | null
|
||||
type: $Enums.FiscalRequestType
|
||||
request_payload: runtime.JsonValue | null
|
||||
response_payload: runtime.JsonValue | null
|
||||
error_message: string | null
|
||||
@@ -1084,8 +1124,9 @@ export interface Prisma__SaleInvoiceFiscalAttemptsClient<T, Null = never, ExtArg
|
||||
export interface SaleInvoiceFiscalAttemptsFieldRefs {
|
||||
readonly id: Prisma.FieldRef<"SaleInvoiceFiscalAttempts", 'String'>
|
||||
readonly attempt_no: Prisma.FieldRef<"SaleInvoiceFiscalAttempts", 'Int'>
|
||||
readonly status: Prisma.FieldRef<"SaleInvoiceFiscalAttempts", 'String'>
|
||||
readonly status: Prisma.FieldRef<"SaleInvoiceFiscalAttempts", 'FiscalResponseStatus'>
|
||||
readonly tax_id: Prisma.FieldRef<"SaleInvoiceFiscalAttempts", 'String'>
|
||||
readonly type: Prisma.FieldRef<"SaleInvoiceFiscalAttempts", 'FiscalRequestType'>
|
||||
readonly request_payload: Prisma.FieldRef<"SaleInvoiceFiscalAttempts", 'Json'>
|
||||
readonly response_payload: Prisma.FieldRef<"SaleInvoiceFiscalAttempts", 'Json'>
|
||||
readonly error_message: Prisma.FieldRef<"SaleInvoiceFiscalAttempts", 'String'>
|
||||
|
||||
@@ -684,14 +684,6 @@ export type SalesInvoiceUncheckedUpdateManyWithoutCustomerNestedInput = {
|
||||
deleteMany?: Prisma.SalesInvoiceScalarWhereInput | Prisma.SalesInvoiceScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type DecimalFieldUpdateOperationsInput = {
|
||||
set?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
increment?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
decrement?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
multiply?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
divide?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
}
|
||||
|
||||
export type SalesInvoiceCreateNestedOneWithoutItemsInput = {
|
||||
create?: Prisma.XOR<Prisma.SalesInvoiceCreateWithoutItemsInput, Prisma.SalesInvoiceUncheckedCreateWithoutItemsInput>
|
||||
connectOrCreate?: Prisma.SalesInvoiceCreateOrConnectWithoutItemsInput
|
||||
|
||||
@@ -28,6 +28,7 @@ export type AggregateSalesInvoiceItem = {
|
||||
|
||||
export type SalesInvoiceItemAvgAggregateOutputType = {
|
||||
quantity: runtime.Decimal | null
|
||||
sku_vat: runtime.Decimal | null
|
||||
unit_price: runtime.Decimal | null
|
||||
total_amount: runtime.Decimal | null
|
||||
discount: runtime.Decimal | null
|
||||
@@ -35,6 +36,7 @@ export type SalesInvoiceItemAvgAggregateOutputType = {
|
||||
|
||||
export type SalesInvoiceItemSumAggregateOutputType = {
|
||||
quantity: runtime.Decimal | null
|
||||
sku_vat: runtime.Decimal | null
|
||||
unit_price: runtime.Decimal | null
|
||||
total_amount: runtime.Decimal | null
|
||||
discount: runtime.Decimal | null
|
||||
@@ -43,7 +45,10 @@ export type SalesInvoiceItemSumAggregateOutputType = {
|
||||
export type SalesInvoiceItemMinAggregateOutputType = {
|
||||
id: string | null
|
||||
quantity: runtime.Decimal | null
|
||||
unit_type: $Enums.UnitType | null
|
||||
measure_unit_text: string | null
|
||||
measure_unit_code: string | null
|
||||
sku_code: string | null
|
||||
sku_vat: runtime.Decimal | null
|
||||
unit_price: runtime.Decimal | null
|
||||
total_amount: runtime.Decimal | null
|
||||
created_at: Date | null
|
||||
@@ -57,7 +62,10 @@ export type SalesInvoiceItemMinAggregateOutputType = {
|
||||
export type SalesInvoiceItemMaxAggregateOutputType = {
|
||||
id: string | null
|
||||
quantity: runtime.Decimal | null
|
||||
unit_type: $Enums.UnitType | null
|
||||
measure_unit_text: string | null
|
||||
measure_unit_code: string | null
|
||||
sku_code: string | null
|
||||
sku_vat: runtime.Decimal | null
|
||||
unit_price: runtime.Decimal | null
|
||||
total_amount: runtime.Decimal | null
|
||||
created_at: Date | null
|
||||
@@ -71,7 +79,10 @@ export type SalesInvoiceItemMaxAggregateOutputType = {
|
||||
export type SalesInvoiceItemCountAggregateOutputType = {
|
||||
id: number
|
||||
quantity: number
|
||||
unit_type: number
|
||||
measure_unit_text: number
|
||||
measure_unit_code: number
|
||||
sku_code: number
|
||||
sku_vat: number
|
||||
unit_price: number
|
||||
total_amount: number
|
||||
created_at: number
|
||||
@@ -88,6 +99,7 @@ export type SalesInvoiceItemCountAggregateOutputType = {
|
||||
|
||||
export type SalesInvoiceItemAvgAggregateInputType = {
|
||||
quantity?: true
|
||||
sku_vat?: true
|
||||
unit_price?: true
|
||||
total_amount?: true
|
||||
discount?: true
|
||||
@@ -95,6 +107,7 @@ export type SalesInvoiceItemAvgAggregateInputType = {
|
||||
|
||||
export type SalesInvoiceItemSumAggregateInputType = {
|
||||
quantity?: true
|
||||
sku_vat?: true
|
||||
unit_price?: true
|
||||
total_amount?: true
|
||||
discount?: true
|
||||
@@ -103,7 +116,10 @@ export type SalesInvoiceItemSumAggregateInputType = {
|
||||
export type SalesInvoiceItemMinAggregateInputType = {
|
||||
id?: true
|
||||
quantity?: true
|
||||
unit_type?: true
|
||||
measure_unit_text?: true
|
||||
measure_unit_code?: true
|
||||
sku_code?: true
|
||||
sku_vat?: true
|
||||
unit_price?: true
|
||||
total_amount?: true
|
||||
created_at?: true
|
||||
@@ -117,7 +133,10 @@ export type SalesInvoiceItemMinAggregateInputType = {
|
||||
export type SalesInvoiceItemMaxAggregateInputType = {
|
||||
id?: true
|
||||
quantity?: true
|
||||
unit_type?: true
|
||||
measure_unit_text?: true
|
||||
measure_unit_code?: true
|
||||
sku_code?: true
|
||||
sku_vat?: true
|
||||
unit_price?: true
|
||||
total_amount?: true
|
||||
created_at?: true
|
||||
@@ -131,7 +150,10 @@ export type SalesInvoiceItemMaxAggregateInputType = {
|
||||
export type SalesInvoiceItemCountAggregateInputType = {
|
||||
id?: true
|
||||
quantity?: true
|
||||
unit_type?: true
|
||||
measure_unit_text?: true
|
||||
measure_unit_code?: true
|
||||
sku_code?: true
|
||||
sku_vat?: true
|
||||
unit_price?: true
|
||||
total_amount?: true
|
||||
created_at?: true
|
||||
@@ -234,7 +256,10 @@ export type SalesInvoiceItemGroupByArgs<ExtArgs extends runtime.Types.Extensions
|
||||
export type SalesInvoiceItemGroupByOutputType = {
|
||||
id: string
|
||||
quantity: runtime.Decimal
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat: runtime.Decimal
|
||||
unit_price: runtime.Decimal
|
||||
total_amount: runtime.Decimal
|
||||
created_at: Date
|
||||
@@ -273,7 +298,10 @@ export type SalesInvoiceItemWhereInput = {
|
||||
NOT?: Prisma.SalesInvoiceItemWhereInput | Prisma.SalesInvoiceItemWhereInput[]
|
||||
id?: Prisma.StringFilter<"SalesInvoiceItem"> | string
|
||||
quantity?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFilter<"SalesInvoiceItem"> | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFilter<"SalesInvoiceItem"> | string
|
||||
measure_unit_code?: Prisma.StringFilter<"SalesInvoiceItem"> | string
|
||||
sku_code?: Prisma.StringFilter<"SalesInvoiceItem"> | string
|
||||
sku_vat?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -292,7 +320,10 @@ export type SalesInvoiceItemWhereInput = {
|
||||
export type SalesInvoiceItemOrderByWithRelationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
quantity?: Prisma.SortOrder
|
||||
unit_type?: Prisma.SortOrder
|
||||
measure_unit_text?: Prisma.SortOrder
|
||||
measure_unit_code?: Prisma.SortOrder
|
||||
sku_code?: Prisma.SortOrder
|
||||
sku_vat?: Prisma.SortOrder
|
||||
unit_price?: Prisma.SortOrder
|
||||
total_amount?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
@@ -315,7 +346,10 @@ export type SalesInvoiceItemWhereUniqueInput = Prisma.AtLeast<{
|
||||
OR?: Prisma.SalesInvoiceItemWhereInput[]
|
||||
NOT?: Prisma.SalesInvoiceItemWhereInput | Prisma.SalesInvoiceItemWhereInput[]
|
||||
quantity?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFilter<"SalesInvoiceItem"> | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFilter<"SalesInvoiceItem"> | string
|
||||
measure_unit_code?: Prisma.StringFilter<"SalesInvoiceItem"> | string
|
||||
sku_code?: Prisma.StringFilter<"SalesInvoiceItem"> | string
|
||||
sku_vat?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -334,7 +368,10 @@ export type SalesInvoiceItemWhereUniqueInput = Prisma.AtLeast<{
|
||||
export type SalesInvoiceItemOrderByWithAggregationInput = {
|
||||
id?: Prisma.SortOrder
|
||||
quantity?: Prisma.SortOrder
|
||||
unit_type?: Prisma.SortOrder
|
||||
measure_unit_text?: Prisma.SortOrder
|
||||
measure_unit_code?: Prisma.SortOrder
|
||||
sku_code?: Prisma.SortOrder
|
||||
sku_vat?: Prisma.SortOrder
|
||||
unit_price?: Prisma.SortOrder
|
||||
total_amount?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
@@ -358,7 +395,10 @@ export type SalesInvoiceItemScalarWhereWithAggregatesInput = {
|
||||
NOT?: Prisma.SalesInvoiceItemScalarWhereWithAggregatesInput | Prisma.SalesInvoiceItemScalarWhereWithAggregatesInput[]
|
||||
id?: Prisma.StringWithAggregatesFilter<"SalesInvoiceItem"> | string
|
||||
quantity?: Prisma.DecimalWithAggregatesFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeWithAggregatesFilter<"SalesInvoiceItem"> | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringWithAggregatesFilter<"SalesInvoiceItem"> | string
|
||||
measure_unit_code?: Prisma.StringWithAggregatesFilter<"SalesInvoiceItem"> | string
|
||||
sku_code?: Prisma.StringWithAggregatesFilter<"SalesInvoiceItem"> | string
|
||||
sku_vat?: Prisma.DecimalWithAggregatesFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -374,7 +414,10 @@ export type SalesInvoiceItemScalarWhereWithAggregatesInput = {
|
||||
export type SalesInvoiceItemCreateInput = {
|
||||
id?: string
|
||||
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
created_at?: Date | string
|
||||
@@ -390,7 +433,10 @@ export type SalesInvoiceItemCreateInput = {
|
||||
export type SalesInvoiceItemUncheckedCreateInput = {
|
||||
id?: string
|
||||
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
created_at?: Date | string
|
||||
@@ -406,7 +452,10 @@ export type SalesInvoiceItemUncheckedCreateInput = {
|
||||
export type SalesInvoiceItemUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -422,7 +471,10 @@ export type SalesInvoiceItemUpdateInput = {
|
||||
export type SalesInvoiceItemUncheckedUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -438,7 +490,10 @@ export type SalesInvoiceItemUncheckedUpdateInput = {
|
||||
export type SalesInvoiceItemCreateManyInput = {
|
||||
id?: string
|
||||
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
created_at?: Date | string
|
||||
@@ -454,7 +509,10 @@ export type SalesInvoiceItemCreateManyInput = {
|
||||
export type SalesInvoiceItemUpdateManyMutationInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -467,7 +525,10 @@ export type SalesInvoiceItemUpdateManyMutationInput = {
|
||||
export type SalesInvoiceItemUncheckedUpdateManyInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -499,7 +560,10 @@ export type SalesInvoiceItemOrderByRelevanceInput = {
|
||||
export type SalesInvoiceItemCountOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
quantity?: Prisma.SortOrder
|
||||
unit_type?: Prisma.SortOrder
|
||||
measure_unit_text?: Prisma.SortOrder
|
||||
measure_unit_code?: Prisma.SortOrder
|
||||
sku_code?: Prisma.SortOrder
|
||||
sku_vat?: Prisma.SortOrder
|
||||
unit_price?: Prisma.SortOrder
|
||||
total_amount?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
@@ -514,6 +578,7 @@ export type SalesInvoiceItemCountOrderByAggregateInput = {
|
||||
|
||||
export type SalesInvoiceItemAvgOrderByAggregateInput = {
|
||||
quantity?: Prisma.SortOrder
|
||||
sku_vat?: Prisma.SortOrder
|
||||
unit_price?: Prisma.SortOrder
|
||||
total_amount?: Prisma.SortOrder
|
||||
discount?: Prisma.SortOrder
|
||||
@@ -522,7 +587,10 @@ export type SalesInvoiceItemAvgOrderByAggregateInput = {
|
||||
export type SalesInvoiceItemMaxOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
quantity?: Prisma.SortOrder
|
||||
unit_type?: Prisma.SortOrder
|
||||
measure_unit_text?: Prisma.SortOrder
|
||||
measure_unit_code?: Prisma.SortOrder
|
||||
sku_code?: Prisma.SortOrder
|
||||
sku_vat?: Prisma.SortOrder
|
||||
unit_price?: Prisma.SortOrder
|
||||
total_amount?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
@@ -536,7 +604,10 @@ export type SalesInvoiceItemMaxOrderByAggregateInput = {
|
||||
export type SalesInvoiceItemMinOrderByAggregateInput = {
|
||||
id?: Prisma.SortOrder
|
||||
quantity?: Prisma.SortOrder
|
||||
unit_type?: Prisma.SortOrder
|
||||
measure_unit_text?: Prisma.SortOrder
|
||||
measure_unit_code?: Prisma.SortOrder
|
||||
sku_code?: Prisma.SortOrder
|
||||
sku_vat?: Prisma.SortOrder
|
||||
unit_price?: Prisma.SortOrder
|
||||
total_amount?: Prisma.SortOrder
|
||||
created_at?: Prisma.SortOrder
|
||||
@@ -549,6 +620,7 @@ export type SalesInvoiceItemMinOrderByAggregateInput = {
|
||||
|
||||
export type SalesInvoiceItemSumOrderByAggregateInput = {
|
||||
quantity?: Prisma.SortOrder
|
||||
sku_vat?: Prisma.SortOrder
|
||||
unit_price?: Prisma.SortOrder
|
||||
total_amount?: Prisma.SortOrder
|
||||
discount?: Prisma.SortOrder
|
||||
@@ -683,7 +755,10 @@ export type SalesInvoiceItemUncheckedUpdateManyWithoutServiceNestedInput = {
|
||||
export type SalesInvoiceItemCreateWithoutGoodInput = {
|
||||
id?: string
|
||||
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
created_at?: Date | string
|
||||
@@ -698,7 +773,10 @@ export type SalesInvoiceItemCreateWithoutGoodInput = {
|
||||
export type SalesInvoiceItemUncheckedCreateWithoutGoodInput = {
|
||||
id?: string
|
||||
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
created_at?: Date | string
|
||||
@@ -742,7 +820,10 @@ export type SalesInvoiceItemScalarWhereInput = {
|
||||
NOT?: Prisma.SalesInvoiceItemScalarWhereInput | Prisma.SalesInvoiceItemScalarWhereInput[]
|
||||
id?: Prisma.StringFilter<"SalesInvoiceItem"> | string
|
||||
quantity?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFilter<"SalesInvoiceItem"> | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFilter<"SalesInvoiceItem"> | string
|
||||
measure_unit_code?: Prisma.StringFilter<"SalesInvoiceItem"> | string
|
||||
sku_code?: Prisma.StringFilter<"SalesInvoiceItem"> | string
|
||||
sku_vat?: Prisma.DecimalFilter<"SalesInvoiceItem"> | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -758,7 +839,10 @@ export type SalesInvoiceItemScalarWhereInput = {
|
||||
export type SalesInvoiceItemCreateWithoutInvoiceInput = {
|
||||
id?: string
|
||||
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
created_at?: Date | string
|
||||
@@ -773,7 +857,10 @@ export type SalesInvoiceItemCreateWithoutInvoiceInput = {
|
||||
export type SalesInvoiceItemUncheckedCreateWithoutInvoiceInput = {
|
||||
id?: string
|
||||
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
created_at?: Date | string
|
||||
@@ -814,7 +901,10 @@ export type SalesInvoiceItemUpdateManyWithWhereWithoutInvoiceInput = {
|
||||
export type SalesInvoiceItemCreateWithoutServiceInput = {
|
||||
id?: string
|
||||
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
created_at?: Date | string
|
||||
@@ -829,7 +919,10 @@ export type SalesInvoiceItemCreateWithoutServiceInput = {
|
||||
export type SalesInvoiceItemUncheckedCreateWithoutServiceInput = {
|
||||
id?: string
|
||||
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
created_at?: Date | string
|
||||
@@ -870,7 +963,10 @@ export type SalesInvoiceItemUpdateManyWithWhereWithoutServiceInput = {
|
||||
export type SalesInvoiceItemCreateManyGoodInput = {
|
||||
id?: string
|
||||
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
created_at?: Date | string
|
||||
@@ -885,7 +981,10 @@ export type SalesInvoiceItemCreateManyGoodInput = {
|
||||
export type SalesInvoiceItemUpdateWithoutGoodInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -900,7 +999,10 @@ export type SalesInvoiceItemUpdateWithoutGoodInput = {
|
||||
export type SalesInvoiceItemUncheckedUpdateWithoutGoodInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -915,7 +1017,10 @@ export type SalesInvoiceItemUncheckedUpdateWithoutGoodInput = {
|
||||
export type SalesInvoiceItemUncheckedUpdateManyWithoutGoodInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -930,7 +1035,10 @@ export type SalesInvoiceItemUncheckedUpdateManyWithoutGoodInput = {
|
||||
export type SalesInvoiceItemCreateManyInvoiceInput = {
|
||||
id?: string
|
||||
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
created_at?: Date | string
|
||||
@@ -945,7 +1053,10 @@ export type SalesInvoiceItemCreateManyInvoiceInput = {
|
||||
export type SalesInvoiceItemUpdateWithoutInvoiceInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -960,7 +1071,10 @@ export type SalesInvoiceItemUpdateWithoutInvoiceInput = {
|
||||
export type SalesInvoiceItemUncheckedUpdateWithoutInvoiceInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -975,7 +1089,10 @@ export type SalesInvoiceItemUncheckedUpdateWithoutInvoiceInput = {
|
||||
export type SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -990,7 +1107,10 @@ export type SalesInvoiceItemUncheckedUpdateManyWithoutInvoiceInput = {
|
||||
export type SalesInvoiceItemCreateManyServiceInput = {
|
||||
id?: string
|
||||
quantity: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_price?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
total_amount?: runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
created_at?: Date | string
|
||||
@@ -1005,7 +1125,10 @@ export type SalesInvoiceItemCreateManyServiceInput = {
|
||||
export type SalesInvoiceItemUpdateWithoutServiceInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -1020,7 +1143,10 @@ export type SalesInvoiceItemUpdateWithoutServiceInput = {
|
||||
export type SalesInvoiceItemUncheckedUpdateWithoutServiceInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -1035,7 +1161,10 @@ export type SalesInvoiceItemUncheckedUpdateWithoutServiceInput = {
|
||||
export type SalesInvoiceItemUncheckedUpdateManyWithoutServiceInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
quantity?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
unit_type?: Prisma.EnumUnitTypeFieldUpdateOperationsInput | $Enums.UnitType
|
||||
measure_unit_text?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
measure_unit_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_code?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
sku_vat?: Prisma.DecimalFieldUpdateOperationsInput | runtime.Decimal | runtime.DecimalJsLike | number | string
|
||||
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
|
||||
@@ -1052,7 +1181,10 @@ export type SalesInvoiceItemUncheckedUpdateManyWithoutServiceInput = {
|
||||
export type SalesInvoiceItemSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
quantity?: boolean
|
||||
unit_type?: boolean
|
||||
measure_unit_text?: boolean
|
||||
measure_unit_code?: boolean
|
||||
sku_code?: boolean
|
||||
sku_vat?: boolean
|
||||
unit_price?: boolean
|
||||
total_amount?: boolean
|
||||
created_at?: boolean
|
||||
@@ -1073,7 +1205,10 @@ export type SalesInvoiceItemSelect<ExtArgs extends runtime.Types.Extensions.Inte
|
||||
export type SalesInvoiceItemSelectScalar = {
|
||||
id?: boolean
|
||||
quantity?: boolean
|
||||
unit_type?: boolean
|
||||
measure_unit_text?: boolean
|
||||
measure_unit_code?: boolean
|
||||
sku_code?: boolean
|
||||
sku_vat?: boolean
|
||||
unit_price?: boolean
|
||||
total_amount?: boolean
|
||||
created_at?: boolean
|
||||
@@ -1086,7 +1221,7 @@ export type SalesInvoiceItemSelectScalar = {
|
||||
service_id?: boolean
|
||||
}
|
||||
|
||||
export type SalesInvoiceItemOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "quantity" | "unit_type" | "unit_price" | "total_amount" | "created_at" | "discount" | "notes" | "payload" | "good_snapshot" | "invoice_id" | "good_id" | "service_id", ExtArgs["result"]["salesInvoiceItem"]>
|
||||
export type SalesInvoiceItemOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "quantity" | "measure_unit_text" | "measure_unit_code" | "sku_code" | "sku_vat" | "unit_price" | "total_amount" | "created_at" | "discount" | "notes" | "payload" | "good_snapshot" | "invoice_id" | "good_id" | "service_id", ExtArgs["result"]["salesInvoiceItem"]>
|
||||
export type SalesInvoiceItemInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
invoice?: boolean | Prisma.SalesInvoiceDefaultArgs<ExtArgs>
|
||||
good?: boolean | Prisma.SalesInvoiceItem$goodArgs<ExtArgs>
|
||||
@@ -1103,7 +1238,10 @@ export type $SalesInvoiceItemPayload<ExtArgs extends runtime.Types.Extensions.In
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
quantity: runtime.Decimal
|
||||
unit_type: $Enums.UnitType
|
||||
measure_unit_text: string
|
||||
measure_unit_code: string
|
||||
sku_code: string
|
||||
sku_vat: runtime.Decimal
|
||||
unit_price: runtime.Decimal
|
||||
total_amount: runtime.Decimal
|
||||
created_at: Date
|
||||
@@ -1488,7 +1626,10 @@ export interface Prisma__SalesInvoiceItemClient<T, Null = never, ExtArgs extends
|
||||
export interface SalesInvoiceItemFieldRefs {
|
||||
readonly id: Prisma.FieldRef<"SalesInvoiceItem", 'String'>
|
||||
readonly quantity: Prisma.FieldRef<"SalesInvoiceItem", 'Decimal'>
|
||||
readonly unit_type: Prisma.FieldRef<"SalesInvoiceItem", 'UnitType'>
|
||||
readonly measure_unit_text: Prisma.FieldRef<"SalesInvoiceItem", 'String'>
|
||||
readonly measure_unit_code: Prisma.FieldRef<"SalesInvoiceItem", 'String'>
|
||||
readonly sku_code: Prisma.FieldRef<"SalesInvoiceItem", 'String'>
|
||||
readonly sku_vat: Prisma.FieldRef<"SalesInvoiceItem", 'Decimal'>
|
||||
readonly unit_price: Prisma.FieldRef<"SalesInvoiceItem", 'Decimal'>
|
||||
readonly total_amount: Prisma.FieldRef<"SalesInvoiceItem", 'Decimal'>
|
||||
readonly created_at: Prisma.FieldRef<"SalesInvoiceItem", 'DateTime'>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ import { AdminGuildsModule } from './guilds/guilds.module'
|
||||
import { AdminLicensesModule } from './licenses/licenses.module'
|
||||
import { AdminPartnersModule } from './partners/partners.module'
|
||||
import { AdminProvidersModule } from './providers/providers.module'
|
||||
import { AdminStockKeepingUnitsModule } from './stock-keeping-units/stock-keeping-units.module'
|
||||
import { AdminTranslateModule } from './translate/translate.module'
|
||||
import { AdminUserAccountsModule } from './users/accounts/accounts.module'
|
||||
import { AdminUsersModule } from './users/users.module'
|
||||
@@ -25,6 +26,7 @@ import { AdminUsersModule } from './users/users.module'
|
||||
AdminGuildsModule,
|
||||
AdminDeviceBrandsModule,
|
||||
AdminDevicesModule,
|
||||
AdminStockKeepingUnitsModule,
|
||||
AdminLicensesModule,
|
||||
AdminConsumersModule,
|
||||
],
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import { GoodPricingModel, UnitType } from '@/generated/prisma/enums'
|
||||
import { GoodPricingModel } from '@/generated/prisma/enums'
|
||||
import { ApiProperty, PartialType } from '@nestjs/swagger'
|
||||
import { IsEnum, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
export class CreateGuildGoodDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
@ApiProperty()
|
||||
name: string
|
||||
|
||||
@IsString()
|
||||
@ApiProperty()
|
||||
sku: string
|
||||
|
||||
@IsString()
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
sku_id: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
category_id: string
|
||||
|
||||
@IsEnum(UnitType)
|
||||
@ApiProperty({ required: true, enum: UnitType })
|
||||
unit_type: UnitType
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
measure_unit_id: string
|
||||
|
||||
@IsEnum(GoodPricingModel)
|
||||
@ApiProperty({ required: true, enum: GoodPricingModel })
|
||||
|
||||
@@ -17,10 +17,20 @@ export class GoodsService {
|
||||
id: true,
|
||||
name: true,
|
||||
pricing_model: true,
|
||||
unit_type: true,
|
||||
image_url: true,
|
||||
sku: true,
|
||||
description: true,
|
||||
sku: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
measure_unit: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
category: {
|
||||
select: {
|
||||
id: true,
|
||||
@@ -62,7 +72,7 @@ export class GoodsService {
|
||||
}
|
||||
|
||||
async create(data: CreateGuildGoodDto, file: Express.Multer.File) {
|
||||
const { category_id, ...rest } = data
|
||||
const { category_id, measure_unit_id, sku_id, ...rest } = data
|
||||
|
||||
const good = await this.prisma.$transaction(async tx => {
|
||||
let image_url = ''
|
||||
@@ -79,6 +89,16 @@ export class GoodsService {
|
||||
...rest,
|
||||
is_default_guild_good: true,
|
||||
image_url,
|
||||
sku: {
|
||||
connect: {
|
||||
id: sku_id,
|
||||
},
|
||||
},
|
||||
measure_unit: {
|
||||
connect: {
|
||||
id: measure_unit_id,
|
||||
},
|
||||
},
|
||||
category: {
|
||||
connect: {
|
||||
id: category_id,
|
||||
@@ -93,7 +113,7 @@ export class GoodsService {
|
||||
}
|
||||
|
||||
async update(id: string, data: UpdateGuildGoodDto, file: Express.Multer.File) {
|
||||
const { category_id, ...rest } = data
|
||||
const { category_id, measure_unit_id, sku_id, ...rest } = data
|
||||
|
||||
const good = await this.prisma.$transaction(async tx => {
|
||||
let image_url = ''
|
||||
@@ -120,6 +140,16 @@ export class GoodsService {
|
||||
...rest,
|
||||
is_default_guild_good: true,
|
||||
image_url,
|
||||
sku: {
|
||||
connect: {
|
||||
id: sku_id,
|
||||
},
|
||||
},
|
||||
measure_unit: {
|
||||
connect: {
|
||||
id: measure_unit_id,
|
||||
},
|
||||
},
|
||||
category: {
|
||||
connect: {
|
||||
id: category_id,
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { SKUGuildType } from '@/generated/prisma/enums'
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsBoolean, IsEnum, IsNumber, IsString, Min } from 'class-validator'
|
||||
|
||||
export class CreateStockKeepingUnitDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
code: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@ApiProperty()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
VAT: number
|
||||
|
||||
@ApiPropertyOptional({ enum: SKUGuildType, default: SKUGuildType.GOLD })
|
||||
@IsEnum(SKUGuildType)
|
||||
type: SKUGuildType = SKUGuildType.GOLD
|
||||
|
||||
@ApiPropertyOptional({ default: true })
|
||||
@IsBoolean()
|
||||
is_public: boolean = true
|
||||
|
||||
@ApiPropertyOptional({ default: true })
|
||||
@IsBoolean()
|
||||
is_domestic: boolean = true
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { StockKeepingUnitsService } from '../stock-keeping-units.service'
|
||||
|
||||
export type StockKeepingUnitsServiceCreateResponseDto = Awaited<
|
||||
ReturnType<StockKeepingUnitsService['create']>
|
||||
>
|
||||
export type StockKeepingUnitsServiceFindAllResponseDto = Awaited<
|
||||
ReturnType<StockKeepingUnitsService['findAll']>
|
||||
>
|
||||
export type StockKeepingUnitsServiceUpdateResponseDto = Awaited<
|
||||
ReturnType<StockKeepingUnitsService['update']>
|
||||
>
|
||||
@@ -0,0 +1,4 @@
|
||||
import { PartialType } from '@nestjs/swagger'
|
||||
import { CreateStockKeepingUnitDto } from './create-stock-keeping-unit.dto'
|
||||
|
||||
export class UpdateStockKeepingUnitDto extends PartialType(CreateStockKeepingUnitDto) {}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
|
||||
import { ApiTags } from '@nestjs/swagger'
|
||||
import type {
|
||||
StockKeepingUnitsServiceCreateResponseDto,
|
||||
StockKeepingUnitsServiceFindAllResponseDto,
|
||||
StockKeepingUnitsServiceUpdateResponseDto,
|
||||
} from './dto/stock-keeping-units-response.dto'
|
||||
import { CreateStockKeepingUnitDto } from './dto/create-stock-keeping-unit.dto'
|
||||
import { UpdateStockKeepingUnitDto } from './dto/update-stock-keeping-unit.dto'
|
||||
import { StockKeepingUnitsService } from './stock-keeping-units.service'
|
||||
|
||||
@ApiTags('AdminStockKeepingUnits')
|
||||
@Controller('admin/stock-keeping-units')
|
||||
export class StockKeepingUnitsController {
|
||||
constructor(private readonly service: StockKeepingUnitsService) {}
|
||||
|
||||
@Get()
|
||||
async findAll(): Promise<StockKeepingUnitsServiceFindAllResponseDto> {
|
||||
return this.service.findAll()
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(
|
||||
@Body() data: CreateStockKeepingUnitDto,
|
||||
): Promise<StockKeepingUnitsServiceCreateResponseDto> {
|
||||
return this.service.create(data)
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
async update(
|
||||
@Param('id') id: string,
|
||||
@Body() data: UpdateStockKeepingUnitDto,
|
||||
): Promise<StockKeepingUnitsServiceUpdateResponseDto> {
|
||||
return this.service.update(id, data)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { PrismaModule } from '@/prisma/prisma.module'
|
||||
import { Module } from '@nestjs/common'
|
||||
import { StockKeepingUnitsController } from './stock-keeping-units.controller'
|
||||
import { StockKeepingUnitsService } from './stock-keeping-units.service'
|
||||
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
controllers: [StockKeepingUnitsController],
|
||||
providers: [StockKeepingUnitsService],
|
||||
})
|
||||
export class AdminStockKeepingUnitsModule {}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import { CreateStockKeepingUnitDto } from './dto/create-stock-keeping-unit.dto'
|
||||
import { UpdateStockKeepingUnitDto } from './dto/update-stock-keeping-unit.dto'
|
||||
|
||||
@Injectable()
|
||||
export class StockKeepingUnitsService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
async findAll() {
|
||||
const items = await this.prisma.stockKeepingUnits.findMany({
|
||||
orderBy: { created_at: 'desc' },
|
||||
})
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
async create(data: CreateStockKeepingUnitDto) {
|
||||
const item = await this.prisma.stockKeepingUnits.create({ data })
|
||||
return ResponseMapper.create(item)
|
||||
}
|
||||
|
||||
async update(id: string, data: UpdateStockKeepingUnitDto) {
|
||||
const item = await this.prisma.stockKeepingUnits.update({
|
||||
where: { id },
|
||||
data,
|
||||
})
|
||||
return ResponseMapper.update(item)
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,15 @@ import { PublicWithToken } from '@/common/decorators/withToken.decorator'
|
||||
import { Controller, Get, Param } from '@nestjs/common'
|
||||
import { ApiTags } from '@nestjs/swagger'
|
||||
import { CatalogsService } from './catalog.service'
|
||||
import type { CatalogsServiceGetDeviceBrandsResponseDto, CatalogsServiceGetDevicesResponseDto, CatalogsServiceGetGuildGoodCategoriesResponseDto, CatalogsServiceGetGuildsResponseDto, CatalogsServiceGetProvidersResponseDto } from './dto/catalog-response.dto'
|
||||
import type {
|
||||
CatalogsServiceGetDeviceBrandsResponseDto,
|
||||
CatalogsServiceGetDevicesResponseDto,
|
||||
CatalogsServiceGetGuildGoodCategoriesResponseDto,
|
||||
CatalogsServiceGetGuildsResponseDto,
|
||||
CatalogsServiceGetMeasurementsResponseDto,
|
||||
CatalogsServiceGetProvidersResponseDto,
|
||||
CatalogsServiceGetSKUResponseDto,
|
||||
} from './dto/catalog-response.dto'
|
||||
|
||||
@ApiTags('Catalog')
|
||||
@Controller('catalog')
|
||||
@@ -33,9 +41,27 @@ export class CatalogsController {
|
||||
return this.catalogService.getDeviceBrands()
|
||||
}
|
||||
|
||||
@Get('sku')
|
||||
@PublicWithToken()
|
||||
async getSKU(
|
||||
@Param('search') search: string,
|
||||
): Promise<CatalogsServiceGetSKUResponseDto> {
|
||||
return this.catalogService.getSKU(search)
|
||||
}
|
||||
|
||||
@Get('measure_units')
|
||||
@PublicWithToken()
|
||||
async getMeasurements(
|
||||
@Param('search') search: string,
|
||||
): Promise<CatalogsServiceGetMeasurementsResponseDto> {
|
||||
return this.catalogService.getMeasurements()
|
||||
}
|
||||
|
||||
@Get('guilds/:guildId/good_categories')
|
||||
@PublicWithToken()
|
||||
async getGuildGoodCategories(@Param('guildId') guild_id: string): Promise<CatalogsServiceGetGuildGoodCategoriesResponseDto> {
|
||||
async getGuildGoodCategories(
|
||||
@Param('guildId') guild_id: string,
|
||||
): Promise<CatalogsServiceGetGuildGoodCategoriesResponseDto> {
|
||||
return this.catalogService.getGuildGoodCategories(guild_id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,35 @@ export class CatalogsService {
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
async getMeasurements() {
|
||||
const items = await this.prisma.measureUnits.findMany({
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
code: true,
|
||||
},
|
||||
})
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
async getSKU(search: string) {
|
||||
const items = await this.prisma.stockKeepingUnits.findMany({
|
||||
// where: {
|
||||
// OR: [{ code: { contains: search } }, { name: { contains: search } }],
|
||||
// },
|
||||
select: {
|
||||
id: true,
|
||||
code: true,
|
||||
name: true,
|
||||
is_domestic: true,
|
||||
is_public: true,
|
||||
VAT: true,
|
||||
},
|
||||
take: 100,
|
||||
})
|
||||
return ResponseMapper.list(items)
|
||||
}
|
||||
|
||||
async getGuildGoodCategories(guild_id: string) {
|
||||
const items = await this.prisma.goodCategory.findMany({
|
||||
where: {
|
||||
|
||||
@@ -1,7 +1,23 @@
|
||||
import type { CatalogsService } from '../catalog.service'
|
||||
|
||||
export type CatalogsServiceGetDeviceBrandsResponseDto = Awaited<ReturnType<CatalogsService['getDeviceBrands']>>
|
||||
export type CatalogsServiceGetDevicesResponseDto = Awaited<ReturnType<CatalogsService['getDevices']>>
|
||||
export type CatalogsServiceGetGuildGoodCategoriesResponseDto = Awaited<ReturnType<CatalogsService['getGuildGoodCategories']>>
|
||||
export type CatalogsServiceGetGuildsResponseDto = Awaited<ReturnType<CatalogsService['getGuilds']>>
|
||||
export type CatalogsServiceGetProvidersResponseDto = Awaited<ReturnType<CatalogsService['getProviders']>>
|
||||
export type CatalogsServiceGetDeviceBrandsResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getDeviceBrands']>
|
||||
>
|
||||
export type CatalogsServiceGetDevicesResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getDevices']>
|
||||
>
|
||||
export type CatalogsServiceGetGuildGoodCategoriesResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getGuildGoodCategories']>
|
||||
>
|
||||
export type CatalogsServiceGetGuildsResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getGuilds']>
|
||||
>
|
||||
export type CatalogsServiceGetProvidersResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getProviders']>
|
||||
>
|
||||
export type CatalogsServiceGetSKUResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getSKU']>
|
||||
>
|
||||
export type CatalogsServiceGetMeasurementsResponseDto = Awaited<
|
||||
ReturnType<CatalogsService['getMeasurements']>
|
||||
>
|
||||
|
||||
+15
-3
@@ -35,7 +35,9 @@ export class SalesInvoicesService {
|
||||
|
||||
items: {
|
||||
select: {
|
||||
unit_type: true,
|
||||
measure_unit_code: true,
|
||||
measure_unit_text: true,
|
||||
sku_code: true,
|
||||
discount: true,
|
||||
notes: true,
|
||||
quantity: true,
|
||||
@@ -46,11 +48,21 @@ export class SalesInvoicesService {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
sku: true,
|
||||
sku: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
barcode: true,
|
||||
local_sku: true,
|
||||
pricing_model: true,
|
||||
unit_type: true,
|
||||
measure_unit: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
category: {
|
||||
select: {
|
||||
id: true,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GoodPricingModel, UnitType } from '@/generated/prisma/enums'
|
||||
import { GoodPricingModel } from '@/generated/prisma/enums'
|
||||
import { ApiProperty, PartialType } from '@nestjs/swagger'
|
||||
import { IsEnum, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
@@ -9,15 +9,15 @@ export class CreateGoodDto {
|
||||
|
||||
@IsString()
|
||||
@ApiProperty({ required: true })
|
||||
sku: string
|
||||
sku_id: string
|
||||
|
||||
@IsString()
|
||||
@ApiProperty({ required: true })
|
||||
category_id: string
|
||||
|
||||
@IsEnum(UnitType)
|
||||
@ApiProperty({ required: true, enum: UnitType })
|
||||
unit_type: UnitType
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
measure_unit_id: string
|
||||
|
||||
@IsEnum(GoodPricingModel)
|
||||
@ApiProperty({ required: true, enum: GoodPricingModel })
|
||||
|
||||
@@ -12,11 +12,21 @@ export class ConsumerBusinessActivityGoodsService {
|
||||
id: true,
|
||||
name: true,
|
||||
barcode: true,
|
||||
sku: true,
|
||||
local_sku: true,
|
||||
pricing_model: true,
|
||||
unit_type: true,
|
||||
image_url: true,
|
||||
sku: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
measure_unit: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
category: {
|
||||
select: {
|
||||
id: true,
|
||||
@@ -55,7 +65,7 @@ export class ConsumerBusinessActivityGoodsService {
|
||||
}
|
||||
|
||||
async create(business_activity_id: string, data: CreateGoodDto) {
|
||||
const { category_id, ...rest } = data
|
||||
const { category_id, sku_id, measure_unit_id, ...rest } = data
|
||||
|
||||
const good = await this.prisma.good.create({
|
||||
data: {
|
||||
@@ -70,6 +80,16 @@ export class ConsumerBusinessActivityGoodsService {
|
||||
id: category_id,
|
||||
},
|
||||
},
|
||||
sku: {
|
||||
connect: {
|
||||
id: sku_id,
|
||||
},
|
||||
},
|
||||
measure_unit: {
|
||||
connect: {
|
||||
id: measure_unit_id,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
return ResponseMapper.create(good)
|
||||
@@ -81,7 +101,7 @@ export class ConsumerBusinessActivityGoodsService {
|
||||
id: string,
|
||||
data: UpdateGoodDto,
|
||||
) {
|
||||
const { category_id, ...rest } = data
|
||||
const { category_id, sku_id, measure_unit_id, ...rest } = data
|
||||
const good = await this.prisma.good.update({
|
||||
where: {
|
||||
business_activity: {
|
||||
@@ -101,6 +121,16 @@ export class ConsumerBusinessActivityGoodsService {
|
||||
id: category_id,
|
||||
},
|
||||
},
|
||||
sku: {
|
||||
connect: {
|
||||
id: sku_id,
|
||||
},
|
||||
},
|
||||
measure_unit: {
|
||||
connect: {
|
||||
id: measure_unit_id,
|
||||
},
|
||||
},
|
||||
...rest,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -27,7 +27,7 @@ export class consumerCustomersService {
|
||||
},
|
||||
legal: {
|
||||
select: {
|
||||
company_name: true,
|
||||
name: true,
|
||||
registration_number: true,
|
||||
postal_code: true,
|
||||
economic_code: true,
|
||||
|
||||
@@ -132,7 +132,12 @@ export class CustomerSaleInvoicesService {
|
||||
id: true,
|
||||
name: true,
|
||||
pricing_model: true,
|
||||
unit_type: true,
|
||||
measure_unit: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
category: {
|
||||
select: {
|
||||
id: true,
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
import {
|
||||
CustomerType,
|
||||
FiscalInvoiceCustomerType,
|
||||
FiscalRequestType,
|
||||
PartnerFiscalSwitchType,
|
||||
} from '@/generated/prisma/enums'
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import { Type } from 'class-transformer'
|
||||
import {
|
||||
@@ -17,7 +23,67 @@ export enum TaxSendStatus {
|
||||
PENDING = 'PENDING',
|
||||
}
|
||||
|
||||
export class CustomerLegalInfoDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
economic_code: string
|
||||
}
|
||||
|
||||
export class CustomerIndividualInfoDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
first_name: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
last_name: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
national_id: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
mobile_number: string
|
||||
}
|
||||
|
||||
export class CustomerInfoDto {
|
||||
@ApiProperty({ required: true, enum: CustomerType })
|
||||
@IsEnum(CustomerType)
|
||||
type: CustomerType
|
||||
|
||||
@ApiProperty({})
|
||||
@Type(() => CustomerLegalInfoDto)
|
||||
@ValidateNested({ each: true })
|
||||
legal_info?: CustomerLegalInfoDto
|
||||
|
||||
@ApiProperty({})
|
||||
@Type(() => CustomerIndividualInfoDto)
|
||||
@ValidateNested({ each: true })
|
||||
individual_info?: CustomerIndividualInfoDto
|
||||
}
|
||||
export class TaxSwitchSendItemPayloadDto {
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
sku: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
sku_vat: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
discount: string
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
@IsNumber()
|
||||
unit_price: number
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
invoice_item_id: string
|
||||
@@ -26,17 +92,13 @@ export class TaxSwitchSendItemPayloadDto {
|
||||
@IsNumber()
|
||||
quantity: number
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
unit_price: number
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
total_amount: number
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
unit_type: string
|
||||
measure_unit: string
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@@ -52,41 +114,48 @@ export class TaxSwitchSendItemPayloadDto {
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
payload?: unknown
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
good_snapshot?: unknown
|
||||
}
|
||||
|
||||
export class TaxSwitchSendPayloadDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
invoice_id: string
|
||||
@ApiProperty({ required: true, enum: FiscalRequestType })
|
||||
@IsEnum(FiscalRequestType)
|
||||
type: FiscalRequestType
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
invoice_code: string
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
invoice_date: string | null
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
total_amount: number
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
provider_code?: string | null
|
||||
@ApiProperty({ required: true, enum: FiscalInvoiceCustomerType })
|
||||
@IsEnum(FiscalInvoiceCustomerType)
|
||||
customer_type: FiscalInvoiceCustomerType
|
||||
|
||||
@ApiProperty({ type: [TaxSwitchSendItemPayloadDto] })
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => TaxSwitchSendItemPayloadDto)
|
||||
items: TaxSwitchSendItemPayloadDto[]
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@Type(() => CustomerInfoDto)
|
||||
@ValidateNested({ each: true })
|
||||
customer?: CustomerInfoDto
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
invoice_code: string
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
invoice_date: Date
|
||||
|
||||
@ApiProperty({ required: true, nullable: true })
|
||||
@IsString()
|
||||
invoice_id: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
total_amount: number
|
||||
|
||||
@ApiProperty({ required: true, enum: PartnerFiscalSwitchType })
|
||||
@IsEnum(PartnerFiscalSwitchType)
|
||||
provider_code: PartnerFiscalSwitchType
|
||||
}
|
||||
|
||||
export class TaxSwitchSendItemResultDto {
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { Injectable, NotFoundException } from '@nestjs/common'
|
||||
import { Prisma } from 'generated/prisma/client'
|
||||
import {
|
||||
FiscalInvoiceCustomerType,
|
||||
FiscalRequestType,
|
||||
Prisma,
|
||||
} from 'generated/prisma/client'
|
||||
import {
|
||||
TaxSendStatus,
|
||||
TaxSwitchGetResultDto,
|
||||
@@ -137,7 +141,7 @@ export class SalesInvoiceFiscalService {
|
||||
invoiceId: string,
|
||||
posId: string,
|
||||
): Promise<TaxSwitchSendPayloadDto> {
|
||||
const invoice = await this.prisma.salesInvoice.findFirst({
|
||||
const invoice = await this.prisma.salesInvoice.findUnique({
|
||||
where: {
|
||||
id: invoiceId,
|
||||
pos_id: posId,
|
||||
@@ -153,7 +157,10 @@ export class SalesInvoiceFiscalService {
|
||||
quantity: true,
|
||||
unit_price: true,
|
||||
total_amount: true,
|
||||
unit_type: true,
|
||||
measure_unit_code: true,
|
||||
measure_unit_text: true,
|
||||
sku_code: true,
|
||||
sku_vat: true,
|
||||
good_id: true,
|
||||
service_id: true,
|
||||
payload: true,
|
||||
@@ -162,9 +169,55 @@ export class SalesInvoiceFiscalService {
|
||||
},
|
||||
pos: {
|
||||
select: {
|
||||
provider: {
|
||||
complex: {
|
||||
select: {
|
||||
code: true,
|
||||
business_activity: {
|
||||
select: {
|
||||
fiscal_id: true,
|
||||
economic_code: true,
|
||||
consumer: {
|
||||
select: {
|
||||
legal: {
|
||||
select: {
|
||||
partner: {
|
||||
select: {
|
||||
fiscal_switch_type: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
individual: {
|
||||
select: {
|
||||
partner: {
|
||||
select: {
|
||||
fiscal_switch_type: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
customer: {
|
||||
select: {
|
||||
type: true,
|
||||
individual: {
|
||||
select: {
|
||||
first_name: true,
|
||||
last_name: true,
|
||||
national_id: true,
|
||||
mobile_number: true,
|
||||
},
|
||||
},
|
||||
legal: {
|
||||
select: {
|
||||
name: true,
|
||||
economic_code: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -176,18 +229,36 @@ export class SalesInvoiceFiscalService {
|
||||
throw new NotFoundException('فاکتور مورد نظر یافت نشد.')
|
||||
}
|
||||
|
||||
const { partner } = (invoice.pos.complex.business_activity.consumer.legal ||
|
||||
invoice.pos.complex.business_activity.consumer.individual)!
|
||||
|
||||
return {
|
||||
invoice_id: invoice.id,
|
||||
invoice_code: invoice.code,
|
||||
invoice_date: invoice.invoice_date ? invoice.invoice_date.toISOString() : null,
|
||||
invoice_date: invoice.invoice_date,
|
||||
total_amount: Number(invoice.total_amount),
|
||||
provider_code: invoice.pos.provider?.code || null,
|
||||
// provider_code: invoice.pos.provider?.code || null,
|
||||
type: FiscalRequestType.MAIN,
|
||||
provider_code: partner.fiscal_switch_type!,
|
||||
customer_type: invoice.customer?.type
|
||||
? FiscalInvoiceCustomerType.Known
|
||||
: FiscalInvoiceCustomerType.Unknown,
|
||||
customer: invoice.customer?.type
|
||||
? {
|
||||
type: invoice.customer.type,
|
||||
legal_info: invoice.customer.legal ?? undefined,
|
||||
individual_info: invoice.customer.individual ?? undefined,
|
||||
}
|
||||
: undefined,
|
||||
items: invoice.items.map(item => ({
|
||||
invoice_item_id: item.id,
|
||||
quantity: Number(item.quantity),
|
||||
unit_price: Number(item.unit_price),
|
||||
total_amount: Number(item.total_amount),
|
||||
unit_type: item.unit_type,
|
||||
measure_unit: item.measure_unit_code,
|
||||
sku: item.sku_code,
|
||||
sku_vat: String(item.sku_vat),
|
||||
discount: String((item.payload as Record<string, any>)?.discount || '0'),
|
||||
good_id: item.good_id,
|
||||
service_id: item.service_id,
|
||||
payload: item.payload,
|
||||
|
||||
+147
-18
@@ -1,3 +1,8 @@
|
||||
import {
|
||||
CustomerType,
|
||||
FiscalInvoiceCustomerType,
|
||||
FiscalRequestType,
|
||||
} from '@/generated/prisma/enums'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import {
|
||||
ITaxSwitchAdapter,
|
||||
@@ -7,36 +12,74 @@ import {
|
||||
TaxSwitchSendItemResultDto,
|
||||
TaxSwitchSendPayloadDto,
|
||||
} from '../../dto/tax-switch.dto'
|
||||
import {
|
||||
NamaTaxGetResponseDto,
|
||||
NamaTaxRequestDto,
|
||||
NamaTaxSendItemResponseDto,
|
||||
} from './nama-fiscal-switch.dto'
|
||||
|
||||
@Injectable()
|
||||
export class NamaTaxSwitchAdapter implements ITaxSwitchAdapter {
|
||||
readonly code = 'NAMA'
|
||||
private readonly sandboxBaseUrl =
|
||||
process.env.NAMA_FISCAL_SANDBOX_URL || 'https://sandbox-api.nama.ir'
|
||||
private readonly productionBaseUrl =
|
||||
process.env.NAMA_FISCAL_PRODUCTION_URL || 'https://api.nama.ir'
|
||||
|
||||
private readonly sendPath = '/api/v1/fiscal/invoices/single-send'
|
||||
private readonly sendBulkPath = '/api/v1/invoices'
|
||||
private readonly checkStatus = '/api/v1/invoices/check-by-uuids'
|
||||
private readonly checkBulkStatus = '/api/v1/invoices/check-by-uuids'
|
||||
private readonly getPath = '/api/v1/fiscal/invoices/'
|
||||
|
||||
private get baseUrl() {
|
||||
return process.env.NODE_ENV === 'production'
|
||||
? this.productionBaseUrl
|
||||
: this.sandboxBaseUrl
|
||||
}
|
||||
|
||||
private buildSendUrl() {
|
||||
return `${this.baseUrl}${this.sendPath}`
|
||||
}
|
||||
|
||||
private buildGetUrl(taxId: string) {
|
||||
return `${this.baseUrl}${this.getPath}/${taxId}`
|
||||
}
|
||||
|
||||
async send(payload: TaxSwitchSendPayloadDto): Promise<TaxSwitchSendItemResultDto[]> {
|
||||
const mappedRequest = this.mapToNamaRequestDto(payload)
|
||||
|
||||
return payload.items.map((item, index) => {
|
||||
const sentAt = new Date()
|
||||
const receivedAt = new Date(sentAt.getTime() + 50)
|
||||
const externalRequest = {
|
||||
invoiceCode: payload.invoice_code,
|
||||
itemId: item.invoice_item_id,
|
||||
quantity: item.quantity,
|
||||
unitPrice: item.unit_price,
|
||||
totalAmount: item.total_amount,
|
||||
}
|
||||
|
||||
const externalResponse = {
|
||||
const providerResponse: NamaTaxSendItemResponseDto = {
|
||||
invoice_item_id: item.invoice_item_id,
|
||||
status: TaxSendStatus.SENT,
|
||||
tax_id: `TAX-${payload.invoice_code}-${index + 1}`,
|
||||
request_payload: {
|
||||
url: this.buildSendUrl(),
|
||||
body: mappedRequest,
|
||||
},
|
||||
response_payload: {
|
||||
provider: this.code,
|
||||
env: process.env.NODE_ENV || 'development',
|
||||
endpoint: this.buildSendUrl(),
|
||||
status: 'ACCEPTED',
|
||||
trackingCode: `TAX-${payload.invoice_code}-${index + 1}`,
|
||||
},
|
||||
sent_at: sentAt.toISOString(),
|
||||
received_at: receivedAt.toISOString(),
|
||||
}
|
||||
|
||||
return {
|
||||
invoice_item_id: item.invoice_item_id,
|
||||
status: TaxSendStatus.SENT,
|
||||
tax_id: externalResponse.trackingCode,
|
||||
request_payload: externalRequest,
|
||||
response_payload: externalResponse,
|
||||
sent_at: sentAt.toISOString(),
|
||||
received_at: receivedAt.toISOString(),
|
||||
invoice_item_id: providerResponse.invoice_item_id,
|
||||
status: providerResponse.status,
|
||||
tax_id: providerResponse.tax_id,
|
||||
request_payload: providerResponse.request_payload,
|
||||
response_payload: providerResponse.response_payload,
|
||||
error_message: providerResponse.error_message,
|
||||
sent_at: providerResponse.sent_at,
|
||||
received_at: providerResponse.received_at,
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -56,14 +99,100 @@ export class NamaTaxSwitchAdapter implements ITaxSwitchAdapter {
|
||||
}
|
||||
|
||||
async get(taxId: string): Promise<TaxSwitchGetResultDto> {
|
||||
return {
|
||||
const providerResponse: NamaTaxGetResponseDto = {
|
||||
tax_id: taxId,
|
||||
status: TaxSendStatus.SENT,
|
||||
response_payload: {
|
||||
provider: this.code,
|
||||
env: process.env.NODE_ENV || 'development',
|
||||
endpoint: this.buildGetUrl(taxId),
|
||||
status: 'CONFIRMED',
|
||||
trackingCode: taxId,
|
||||
tracking_code: taxId,
|
||||
},
|
||||
received_at: new Date().toISOString(),
|
||||
}
|
||||
|
||||
return {
|
||||
tax_id: providerResponse.tax_id,
|
||||
status: providerResponse.status,
|
||||
response_payload: providerResponse.response_payload,
|
||||
received_at: providerResponse.received_at,
|
||||
}
|
||||
}
|
||||
|
||||
private mapToNamaRequestDto(payload: TaxSwitchSendPayloadDto): NamaTaxRequestDto {
|
||||
return {
|
||||
uuid: payload.invoice_id,
|
||||
economic_code: '',
|
||||
fiscal_id: '',
|
||||
payment: [],
|
||||
header: {
|
||||
ins: this.mapFiscalRequestType(payload.type),
|
||||
inp: '2',
|
||||
inty: this.mapFiscalInvoiceCustomerType(payload.customer_type),
|
||||
// unique_tax_code: payload.invoice_code,
|
||||
inno: payload.invoice_code,
|
||||
tins: '',
|
||||
indatim: payload.invoice_date.getTime() + '',
|
||||
name:
|
||||
`${payload.customer?.individual_info?.first_name} ${payload.customer?.individual_info?.last_name}` ||
|
||||
payload.customer?.legal_info?.name ||
|
||||
'',
|
||||
tob: this.mapCustomerType(payload.customer?.type),
|
||||
address: '',
|
||||
mobile: payload.customer?.individual_info?.mobile_number || '',
|
||||
bid:
|
||||
payload.customer?.individual_info?.national_id ||
|
||||
payload.customer?.legal_info?.economic_code ||
|
||||
'',
|
||||
},
|
||||
body: payload.items.map(item => ({
|
||||
sstid: item.sku,
|
||||
vra: item.sku_vat,
|
||||
// sstt: item.unit_type,
|
||||
fee: String(item.unit_price),
|
||||
dis: String(item.discount),
|
||||
mu: item.measure_unit,
|
||||
am: String(item.quantity),
|
||||
consfee: '0',
|
||||
bros: '0',
|
||||
spro: '0',
|
||||
})),
|
||||
}
|
||||
}
|
||||
|
||||
private mapFiscalRequestType(type: FiscalRequestType) {
|
||||
switch (type) {
|
||||
case FiscalRequestType.MAIN:
|
||||
return '1'
|
||||
case FiscalRequestType.UPDATE:
|
||||
return '2'
|
||||
case FiscalRequestType.REVOKE:
|
||||
return '3'
|
||||
case FiscalRequestType.REMOVE:
|
||||
return '4'
|
||||
}
|
||||
}
|
||||
|
||||
private mapFiscalInvoiceCustomerType(type?: FiscalInvoiceCustomerType) {
|
||||
switch (type) {
|
||||
case FiscalInvoiceCustomerType.Unknown:
|
||||
return '1'
|
||||
case FiscalInvoiceCustomerType.Known:
|
||||
return '2'
|
||||
default:
|
||||
return '3'
|
||||
}
|
||||
}
|
||||
|
||||
private mapCustomerType(type?: CustomerType) {
|
||||
switch (type) {
|
||||
case CustomerType.INDIVIDUAL:
|
||||
return '1'
|
||||
case CustomerType.LEGAL:
|
||||
return '2'
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import { ApiProperty } from '@nestjs/swagger'
|
||||
import { Type } from 'class-transformer'
|
||||
import { IsArray, IsString, ValidateNested } from 'class-validator'
|
||||
import {
|
||||
IsArray,
|
||||
IsEnum,
|
||||
IsObject,
|
||||
IsOptional,
|
||||
IsString,
|
||||
ValidateNested,
|
||||
} from 'class-validator'
|
||||
import { TaxSendStatus } from '../../dto/tax-switch.dto'
|
||||
|
||||
export class NamaTaxBodyItemDto {
|
||||
@ApiProperty()
|
||||
@@ -11,9 +19,9 @@ export class NamaTaxBodyItemDto {
|
||||
@IsString()
|
||||
vra: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
sstt: string
|
||||
// @ApiProperty()
|
||||
// @IsString()
|
||||
// sstt: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@@ -45,7 +53,7 @@ export class NamaTaxBodyItemDto {
|
||||
}
|
||||
|
||||
export class NamaTaxHeaderDto {
|
||||
@ApiProperty()
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
ins: string
|
||||
|
||||
@@ -53,41 +61,43 @@ export class NamaTaxHeaderDto {
|
||||
@IsString()
|
||||
inp: string
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
inty: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
unique_tax_code: string
|
||||
// @ApiProperty({required: true})
|
||||
// @IsString()
|
||||
// unique_tax_code: string
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
inno: string
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
tins: string
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
indatim: string
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
name: string
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ required: true })
|
||||
@IsString()
|
||||
tob: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
address: string
|
||||
address?: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
mobile: string
|
||||
mobile?: string
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@@ -122,3 +132,63 @@ export class NamaTaxRequestDto {
|
||||
@IsString()
|
||||
fiscal_id: string
|
||||
}
|
||||
|
||||
export class NamaTaxSendItemResponseDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
invoice_item_id: string
|
||||
|
||||
@ApiProperty({ enum: TaxSendStatus })
|
||||
@IsEnum(TaxSendStatus)
|
||||
status: TaxSendStatus
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
tax_id?: string | null
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
request_payload?: unknown
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
response_payload?: unknown
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
error_message?: string | null
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
sent_at?: string | null
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
received_at?: string | null
|
||||
}
|
||||
|
||||
export class NamaTaxGetResponseDto {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
tax_id: string
|
||||
|
||||
@ApiProperty({ enum: TaxSendStatus })
|
||||
@IsEnum(TaxSendStatus)
|
||||
status: TaxSendStatus
|
||||
|
||||
@ApiProperty({ required: false, nullable: true, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
response_payload?: unknown
|
||||
|
||||
@ApiProperty({ required: false, nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
received_at?: string | null
|
||||
}
|
||||
|
||||
@@ -117,7 +117,12 @@ export class SaleInvoicesService {
|
||||
id: true,
|
||||
name: true,
|
||||
pricing_model: true,
|
||||
unit_type: true,
|
||||
measure_unit: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
|
||||
category: {
|
||||
select: {
|
||||
@@ -136,7 +141,7 @@ export class SaleInvoicesService {
|
||||
type: true,
|
||||
legal: {
|
||||
select: {
|
||||
company_name: true,
|
||||
name: true,
|
||||
economic_code: true,
|
||||
registration_number: true,
|
||||
postal_code: true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { PublicWithToken } from '@/common/decorators/withToken.decorator'
|
||||
import { Controller, Get } from '@nestjs/common'
|
||||
import { EnumsService } from './enums.service'
|
||||
import type { EnumsServiceGetEnumValuesResponseDto } from './dto/enums-response.dto'
|
||||
import { EnumsService } from './enums.service'
|
||||
|
||||
@Controller('enums')
|
||||
export class EnumsController {
|
||||
@@ -97,12 +97,6 @@ export class EnumsController {
|
||||
return this.enumsService.getEnumValues('TokenType')
|
||||
}
|
||||
|
||||
@Get('unit_type')
|
||||
@PublicWithToken()
|
||||
async getUnitType(): Promise<EnumsServiceGetEnumValuesResponseDto> {
|
||||
return this.enumsService.getEnumValues('UnitType')
|
||||
}
|
||||
|
||||
@Get('good_pricing_model')
|
||||
@PublicWithToken()
|
||||
async getGoodPricingModel(): Promise<EnumsServiceGetEnumValuesResponseDto> {
|
||||
@@ -114,4 +108,10 @@ export class EnumsController {
|
||||
async getConsumerRoleModel(): Promise<EnumsServiceGetEnumValuesResponseDto> {
|
||||
return this.enumsService.getEnumValues('ConsumerRole')
|
||||
}
|
||||
|
||||
@Get('fiscal_response_status')
|
||||
@PublicWithToken()
|
||||
async getFiscalResponseStatus(): Promise<EnumsServiceGetEnumValuesResponseDto> {
|
||||
return this.enumsService.getEnumValues('FiscalResponseStatus')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,18 @@ import { translateEnumValue } from '@/common/utils/enum-translator.util'
|
||||
import {
|
||||
AccountRole,
|
||||
AccountStatus,
|
||||
AccountType,
|
||||
ApplicationPlatform,
|
||||
ApplicationPublisher,
|
||||
ApplicationReleaseType,
|
||||
BusinessRole,
|
||||
ComplexRole,
|
||||
ConsumerRole,
|
||||
ConsumerStatus,
|
||||
ConsumerType,
|
||||
CustomerType,
|
||||
FiscalInvoiceCustomerType,
|
||||
FiscalRequestType,
|
||||
FiscalResponseStatus,
|
||||
GoodPricingModel,
|
||||
LicenseStatus,
|
||||
@@ -24,12 +28,14 @@ import {
|
||||
POSType,
|
||||
ProviderRole,
|
||||
ProviderStatus,
|
||||
SKUGuildType,
|
||||
TokenType,
|
||||
UnitType,
|
||||
UserStatus,
|
||||
UserType,
|
||||
} from '@/generated/prisma/enums'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { AccountType, GoldKarat, TokenType } from 'common/enums/enums'
|
||||
import { GoldKarat } from 'common/enums/enums'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
|
||||
@Injectable()
|
||||
@@ -63,6 +69,7 @@ export class EnumsService {
|
||||
AccountType: this.prepareData(AccountType, 'AccountType'),
|
||||
PartnerRole: this.prepareData(PartnerRole, 'PartnerRole'),
|
||||
BusinessRole: this.prepareData(BusinessRole, 'BusinessRole'),
|
||||
ComplexRole: this.prepareData(ComplexRole, 'ComplexRole'),
|
||||
ProviderRole: this.prepareData(ProviderRole, 'ProviderRole'),
|
||||
ProviderStatus: this.prepareData(ProviderStatus, 'ProviderStatus'),
|
||||
TokenType: this.prepareData(TokenType, 'TokenType'),
|
||||
@@ -90,6 +97,12 @@ export class EnumsService {
|
||||
FiscalResponseStatus,
|
||||
'FiscalResponseStatus',
|
||||
),
|
||||
FiscalRequestType: this.prepareData(FiscalRequestType, 'FiscalRequestType'),
|
||||
FiscalInvoiceCustomerType: this.prepareData(
|
||||
FiscalInvoiceCustomerType,
|
||||
'FiscalInvoiceCustomerType',
|
||||
),
|
||||
SKUGuildType: this.prepareData(SKUGuildType, 'SKUGuildType'),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@ export class BusinessActivitiesService {
|
||||
const createdBusinessActivity = await tx.businessActivity.create({
|
||||
data: {
|
||||
...rest,
|
||||
economic_code: String(data.economic_code),
|
||||
guild: {
|
||||
connect: {
|
||||
id: guild_id,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { IsNumber, IsString, MaxLength, MinLength } from 'class-validator'
|
||||
export class CreateCustomerLegalDto {
|
||||
@IsString()
|
||||
@ApiProperty({ required: true })
|
||||
company_name: string
|
||||
name: string
|
||||
|
||||
@IsString()
|
||||
@ApiProperty({ required: true })
|
||||
|
||||
@@ -13,8 +13,8 @@ export class CreateGoodDto {
|
||||
description?: string
|
||||
|
||||
@IsString()
|
||||
@ApiProperty()
|
||||
sku: string
|
||||
@ApiProperty({ required: true })
|
||||
sku_id: string
|
||||
|
||||
@IsString()
|
||||
@ApiProperty()
|
||||
@@ -42,6 +42,10 @@ export class CreateGoodDto {
|
||||
@IsNumber()
|
||||
@ApiProperty({ required: false })
|
||||
base_sale_price?: number
|
||||
|
||||
@IsString()
|
||||
@ApiProperty({ required: true })
|
||||
measure_unit_id: string
|
||||
}
|
||||
|
||||
export class UpdateGoodDto extends PartialType(CreateGoodDto) {}
|
||||
|
||||
@@ -14,11 +14,21 @@ export class GoodsService {
|
||||
barcode: true,
|
||||
created_at: true,
|
||||
description: true,
|
||||
sku: true,
|
||||
sku: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
local_sku: true,
|
||||
is_default_guild_good: true,
|
||||
pricing_model: true,
|
||||
unit_type: true,
|
||||
measure_unit: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
image_url: true,
|
||||
category: {
|
||||
select: {
|
||||
@@ -66,7 +76,7 @@ export class GoodsService {
|
||||
}
|
||||
|
||||
async create(data: CreateGoodDto, business_activity_id: string) {
|
||||
const { category_id, ...rest } = data
|
||||
const { category_id, sku_id, measure_unit_id, ...rest } = data
|
||||
|
||||
const dataToCreate = {
|
||||
...rest,
|
||||
@@ -81,6 +91,16 @@ export class GoodsService {
|
||||
const good = await this.prisma.good.create({
|
||||
data: {
|
||||
...rest,
|
||||
measure_unit: {
|
||||
connect: {
|
||||
id: measure_unit_id,
|
||||
},
|
||||
},
|
||||
sku: {
|
||||
connect: {
|
||||
id: sku_id,
|
||||
},
|
||||
},
|
||||
category: {
|
||||
connect: {
|
||||
id: category_id,
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
import { ApiPropertyOptional } from '@nestjs/swagger'
|
||||
import { Type } from 'class-transformer'
|
||||
import {
|
||||
IsDateString,
|
||||
IsEnum,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Min,
|
||||
} from 'class-validator'
|
||||
import { FiscalResponseStatus } from 'generated/prisma/enums'
|
||||
|
||||
export class SalesInvoicesFilterDto {
|
||||
@ApiPropertyOptional({ default: 1 })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(1)
|
||||
page?: number
|
||||
|
||||
@ApiPropertyOptional({ default: 10 })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(1)
|
||||
perPage?: number
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
invoice_date_from?: string
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
invoice_date_to?: string
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
created_at_from?: string
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
created_at_to?: string
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
code?: string
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
customer_name?: string
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
customer_mobile?: string
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
customer_national_id?: string
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
customer_economic_code?: string
|
||||
|
||||
@ApiPropertyOptional({ enum: FiscalResponseStatus })
|
||||
@IsOptional()
|
||||
@IsEnum(FiscalResponseStatus)
|
||||
status?: FiscalResponseStatus
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
total_amount?: number
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
total_amount_from?: number
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
total_amount_to?: number
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { PosInfo } from '@/common/decorators/posInfo.decorator'
|
||||
import type { IPosPayload } from '@/common/models/posPayload.model'
|
||||
import { Controller, Get, Param, Post } from '@nestjs/common'
|
||||
import { PosSalesInvoiceFiscalService } from './sales-invoice-fiscal.service'
|
||||
|
||||
@Controller('pos/sales_invoices/:invoiceId/fiscal')
|
||||
export class PosSalesInvoiceFiscalController {
|
||||
constructor(private readonly service: PosSalesInvoiceFiscalService) {}
|
||||
|
||||
@Post('send')
|
||||
async send(@PosInfo() posInfo: IPosPayload, @Param('invoiceId') invoiceId: string) {
|
||||
return this.service.send(invoiceId, posInfo)
|
||||
}
|
||||
|
||||
@Post('retry')
|
||||
async retry(@PosInfo() posInfo: IPosPayload, @Param('invoiceId') invoiceId: string) {
|
||||
return this.service.retry(invoiceId, posInfo)
|
||||
}
|
||||
|
||||
@Get('status')
|
||||
async getStatus(
|
||||
@PosInfo() posInfo: IPosPayload,
|
||||
@Param('invoiceId') invoiceId: string,
|
||||
) {
|
||||
return this.service.getStatus(invoiceId, posInfo)
|
||||
}
|
||||
|
||||
@Post('status/refresh')
|
||||
async refreshStatus(
|
||||
@PosInfo() posInfo: IPosPayload,
|
||||
@Param('invoiceId') invoiceId: string,
|
||||
) {
|
||||
return this.service.refreshStatus(invoiceId, posInfo)
|
||||
}
|
||||
|
||||
@Get('attempts')
|
||||
async getAttempts(
|
||||
@PosInfo() posInfo: IPosPayload,
|
||||
@Param('invoiceId') invoiceId: string,
|
||||
) {
|
||||
return this.service.getAttempts(invoiceId, posInfo)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Module } from '@nestjs/common'
|
||||
import { SalesInvoiceFiscalSwitchService } from '../../../consumer/saleInvoices/fiscal/sales-invoice-fiscal-switch.service'
|
||||
import { NamaTaxSwitchAdapter } from '../../../consumer/saleInvoices/fiscal/switch/nama/nama-fiscal-switch.adapter'
|
||||
import { PosSalesInvoiceFiscalController } from './sales-invoice-fiscal.controller'
|
||||
import { PosSalesInvoiceFiscalService } from './sales-invoice-fiscal.service'
|
||||
|
||||
@Module({
|
||||
controllers: [PosSalesInvoiceFiscalController],
|
||||
providers: [PosSalesInvoiceFiscalService, SalesInvoiceFiscalSwitchService, NamaTaxSwitchAdapter],
|
||||
exports: [PosSalesInvoiceFiscalService],
|
||||
})
|
||||
export class PosSalesInvoiceFiscalModule {}
|
||||
@@ -0,0 +1,411 @@
|
||||
import { IPosPayload } from '@/common/models/posPayload.model'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { Injectable, NotFoundException } from '@nestjs/common'
|
||||
import {
|
||||
FiscalInvoiceCustomerType,
|
||||
FiscalRequestType,
|
||||
FiscalResponseStatus,
|
||||
} from 'generated/prisma/enums'
|
||||
import {
|
||||
TaxSendStatus,
|
||||
TaxSwitchGetResultDto,
|
||||
TaxSwitchSendItemResultDto,
|
||||
TaxSwitchSendPayloadDto,
|
||||
} from '../../../consumer/saleInvoices/fiscal/dto/tax-switch.dto'
|
||||
import { SalesInvoiceFiscalSwitchService } from '../../../consumer/saleInvoices/fiscal/sales-invoice-fiscal-switch.service'
|
||||
|
||||
@Injectable()
|
||||
export class PosSalesInvoiceFiscalService {
|
||||
constructor(
|
||||
private readonly prisma: PrismaService,
|
||||
private readonly fiscalSwitchService: SalesInvoiceFiscalSwitchService,
|
||||
) {}
|
||||
|
||||
async send(invoiceId: string, posInfo: IPosPayload) {
|
||||
const payload = await this.buildPayload(invoiceId, posInfo)
|
||||
const itemResults = await this.safeSend(payload)
|
||||
const attempt = await this.persistAttempt(invoiceId, itemResults)
|
||||
|
||||
return {
|
||||
invoice_id: invoiceId,
|
||||
fiscal_id: attempt.fiscal_id,
|
||||
status: attempt.status,
|
||||
attempt_no: attempt.attempt_no,
|
||||
}
|
||||
}
|
||||
|
||||
async retry(invoiceId: string, posInfo: IPosPayload) {
|
||||
return this.send(invoiceId, posInfo)
|
||||
}
|
||||
|
||||
async getStatus(invoiceId: string, posInfo: IPosPayload) {
|
||||
const invoice = await this.getInvoiceForBusiness(invoiceId, posInfo.business_id)
|
||||
if (!invoice.fiscal) {
|
||||
return {
|
||||
invoice_id: invoiceId,
|
||||
status: FiscalResponseStatus.NOT_SEND,
|
||||
fiscal: null,
|
||||
}
|
||||
}
|
||||
|
||||
const latestAttempt = invoice.fiscal.attempts[0] || null
|
||||
return {
|
||||
invoice_id: invoiceId,
|
||||
status: latestAttempt?.status || FiscalResponseStatus.NOT_SEND,
|
||||
fiscal: {
|
||||
id: invoice.fiscal.id,
|
||||
retry_count: invoice.fiscal.retry_count,
|
||||
last_attempt_at: invoice.fiscal.last_attempt_at,
|
||||
},
|
||||
latest_attempt: latestAttempt,
|
||||
}
|
||||
}
|
||||
|
||||
async refreshStatus(invoiceId: string, posInfo: IPosPayload) {
|
||||
const invoice = await this.getInvoiceForBusiness(invoiceId, posInfo.business_id)
|
||||
const latestAttempt = invoice.fiscal?.attempts?.[0]
|
||||
|
||||
if (!invoice.fiscal || !latestAttempt?.tax_id) {
|
||||
return this.getStatus(invoiceId, posInfo)
|
||||
}
|
||||
|
||||
const providerCode = invoice.pos.provider?.code
|
||||
const switchResult = await this.fiscalSwitchService.get(
|
||||
providerCode,
|
||||
latestAttempt.tax_id,
|
||||
)
|
||||
const mappedStatus = this.mapSwitchGetStatus(switchResult.status)
|
||||
|
||||
const refreshedAttempt = await this.prisma.$transaction(async tx => {
|
||||
const nextNo = (latestAttempt.attempt_no || 0) + 1
|
||||
const createdAttempt = await tx.saleInvoiceFiscalAttempts.create({
|
||||
data: {
|
||||
fiscal_id: invoice.fiscal!.id,
|
||||
attempt_no: nextNo,
|
||||
status: mappedStatus,
|
||||
tax_id: switchResult.tax_id,
|
||||
response_payload: switchResult.response_payload
|
||||
? JSON.parse(JSON.stringify(switchResult.response_payload))
|
||||
: undefined,
|
||||
received_at: switchResult.received_at
|
||||
? new Date(switchResult.received_at)
|
||||
: null,
|
||||
type: FiscalRequestType.MAIN,
|
||||
},
|
||||
})
|
||||
|
||||
await tx.saleInvoiceFiscals.update({
|
||||
where: { id: invoice.fiscal!.id },
|
||||
data: {
|
||||
retry_count: nextNo,
|
||||
last_attempt_at: createdAttempt.created_at,
|
||||
},
|
||||
})
|
||||
|
||||
return createdAttempt
|
||||
})
|
||||
|
||||
return {
|
||||
invoice_id: invoiceId,
|
||||
status: refreshedAttempt.status,
|
||||
latest_attempt: refreshedAttempt,
|
||||
}
|
||||
}
|
||||
|
||||
async getAttempts(invoiceId: string, posInfo: IPosPayload) {
|
||||
const invoice = await this.getInvoiceForBusiness(invoiceId, posInfo.business_id)
|
||||
if (!invoice.fiscal) {
|
||||
return {
|
||||
invoice_id: invoiceId,
|
||||
fiscal_id: null,
|
||||
attempts: [],
|
||||
}
|
||||
}
|
||||
|
||||
const attempts = await this.prisma.saleInvoiceFiscalAttempts.findMany({
|
||||
where: {
|
||||
fiscal_id: invoice.fiscal.id,
|
||||
},
|
||||
orderBy: {
|
||||
attempt_no: 'desc',
|
||||
},
|
||||
})
|
||||
|
||||
return {
|
||||
invoice_id: invoiceId,
|
||||
fiscal_id: invoice.fiscal.id,
|
||||
attempts,
|
||||
}
|
||||
}
|
||||
|
||||
private async buildPayload(invoiceId: string, posInfo: IPosPayload) {
|
||||
const invoice = await this.prisma.salesInvoice.findUnique({
|
||||
where: {
|
||||
id: invoiceId,
|
||||
pos: {
|
||||
id: posInfo.pos_id,
|
||||
complex: {
|
||||
business_activity_id: posInfo.business_id,
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
code: true,
|
||||
invoice_date: true,
|
||||
total_amount: true,
|
||||
items: {
|
||||
select: {
|
||||
id: true,
|
||||
quantity: true,
|
||||
unit_price: true,
|
||||
total_amount: true,
|
||||
measure_unit_text: true,
|
||||
sku_code: true,
|
||||
sku_vat: true,
|
||||
measure_unit_code: true,
|
||||
good_id: true,
|
||||
service_id: true,
|
||||
payload: true,
|
||||
good_snapshot: true,
|
||||
},
|
||||
},
|
||||
customer: {
|
||||
select: {
|
||||
type: true,
|
||||
individual: true,
|
||||
legal: true,
|
||||
},
|
||||
},
|
||||
|
||||
pos: {
|
||||
select: {
|
||||
complex: {
|
||||
select: {
|
||||
business_activity: {
|
||||
select: {
|
||||
fiscal_id: true,
|
||||
economic_code: true,
|
||||
consumer: {
|
||||
select: {
|
||||
legal: {
|
||||
select: {
|
||||
partner: {
|
||||
select: {
|
||||
fiscal_switch_type: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
individual: {
|
||||
select: {
|
||||
partner: {
|
||||
select: {
|
||||
fiscal_switch_type: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (!invoice) {
|
||||
throw new NotFoundException('فاکتور مورد نظر یافت نشد.')
|
||||
}
|
||||
|
||||
const { partner } = (invoice.pos.complex.business_activity.consumer.legal ||
|
||||
invoice.pos.complex.business_activity.consumer.individual)!
|
||||
|
||||
return {
|
||||
invoice_id: invoice.id,
|
||||
invoice_code: invoice.code,
|
||||
invoice_date: invoice.invoice_date,
|
||||
total_amount: Number(invoice.total_amount),
|
||||
customer_type: invoice.customer
|
||||
? FiscalInvoiceCustomerType.Known
|
||||
: FiscalInvoiceCustomerType.Unknown,
|
||||
type: FiscalRequestType.MAIN,
|
||||
provider_code: partner.fiscal_switch_type,
|
||||
items: invoice.items.map(item => ({
|
||||
invoice_item_id: item.id,
|
||||
quantity: Number(item.quantity),
|
||||
unit_price: Number(item.unit_price),
|
||||
total_amount: Number(item.total_amount),
|
||||
good_id: item.good_id,
|
||||
service_id: item.service_id,
|
||||
payload: item.payload,
|
||||
good_snapshot: item.good_snapshot,
|
||||
discount: String((item.payload as Record<string, any>)?.discount || '0'),
|
||||
sku: item.sku_code,
|
||||
sku_vat: String(item.sku_vat),
|
||||
measure_unit: item.measure_unit_code,
|
||||
// sku: item.
|
||||
})),
|
||||
} satisfies TaxSwitchSendPayloadDto
|
||||
}
|
||||
|
||||
private async safeSend(payload: TaxSwitchSendPayloadDto) {
|
||||
try {
|
||||
return await this.fiscalSwitchService.send(payload)
|
||||
} catch (error: any) {
|
||||
const now = new Date().toISOString()
|
||||
return payload.items.map(item => ({
|
||||
invoice_item_id: item.invoice_item_id,
|
||||
status: TaxSendStatus.FAILED,
|
||||
error_message: error?.message || 'Unexpected fiscal switch error.',
|
||||
sent_at: now,
|
||||
received_at: now,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
private async persistAttempt(
|
||||
invoiceId: string,
|
||||
itemResults: TaxSwitchSendItemResultDto[],
|
||||
) {
|
||||
return this.prisma.$transaction(async tx => {
|
||||
const fiscal = await tx.saleInvoiceFiscals.upsert({
|
||||
where: { invoice_id: invoiceId },
|
||||
update: {},
|
||||
create: {
|
||||
invoice_id: invoiceId,
|
||||
},
|
||||
})
|
||||
|
||||
const latest = await tx.saleInvoiceFiscalAttempts.findFirst({
|
||||
where: { fiscal_id: fiscal.id },
|
||||
orderBy: { attempt_no: 'desc' },
|
||||
select: { attempt_no: true },
|
||||
})
|
||||
const nextAttemptNo = (latest?.attempt_no || 0) + 1
|
||||
|
||||
const finalStatus = this.mapItemResultsStatus(itemResults)
|
||||
const firstTaxId = itemResults.find(item => item.tax_id)?.tax_id || null
|
||||
const sentAt = itemResults.map(item => item.sent_at).find(Boolean)
|
||||
const receivedAt = itemResults.map(item => item.received_at).find(Boolean)
|
||||
const errors = itemResults.map(item => item.error_message).filter(Boolean)
|
||||
const errorMessage = errors.length ? Array.from(new Set(errors)).join(' | ') : null
|
||||
|
||||
const attempt = await tx.saleInvoiceFiscalAttempts.create({
|
||||
data: {
|
||||
fiscal_id: fiscal.id,
|
||||
attempt_no: nextAttemptNo,
|
||||
status: finalStatus,
|
||||
tax_id: firstTaxId,
|
||||
type: FiscalRequestType.MAIN,
|
||||
request_payload: JSON.parse(
|
||||
JSON.stringify(itemResults.map(item => item.request_payload)),
|
||||
),
|
||||
response_payload: JSON.parse(
|
||||
JSON.stringify(itemResults.map(item => item.response_payload)),
|
||||
),
|
||||
error_message: errorMessage,
|
||||
sent_at: sentAt ? new Date(sentAt) : null,
|
||||
received_at: receivedAt ? new Date(receivedAt) : null,
|
||||
},
|
||||
})
|
||||
|
||||
await tx.saleInvoiceFiscals.update({
|
||||
where: { id: fiscal.id },
|
||||
data: {
|
||||
retry_count: nextAttemptNo,
|
||||
last_attempt_at: attempt.sent_at || attempt.created_at,
|
||||
},
|
||||
})
|
||||
|
||||
return {
|
||||
fiscal_id: fiscal.id,
|
||||
status: attempt.status,
|
||||
attempt_no: attempt.attempt_no,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private mapItemResultsStatus(itemResults: TaxSwitchSendItemResultDto[]) {
|
||||
if (!itemResults.length) {
|
||||
return FiscalResponseStatus.NOT_SEND
|
||||
}
|
||||
const hasFailure = itemResults.some(item => item.status === TaxSendStatus.FAILED)
|
||||
if (hasFailure) {
|
||||
return FiscalResponseStatus.FAILURE
|
||||
}
|
||||
const hasSent = itemResults.some(item => item.status === TaxSendStatus.SENT)
|
||||
if (hasSent) {
|
||||
return FiscalResponseStatus.SUCCESS
|
||||
}
|
||||
return FiscalResponseStatus.NOT_SEND
|
||||
}
|
||||
|
||||
private mapSwitchGetStatus(status: TaxSwitchGetResultDto['status']) {
|
||||
switch (status) {
|
||||
case TaxSendStatus.SENT:
|
||||
return FiscalResponseStatus.SUCCESS
|
||||
case TaxSendStatus.FAILED:
|
||||
return FiscalResponseStatus.FAILURE
|
||||
default:
|
||||
return FiscalResponseStatus.NOT_SEND
|
||||
}
|
||||
}
|
||||
|
||||
private async getInvoiceForBusiness(invoiceId: string, businessId: string) {
|
||||
const invoice = await this.prisma.salesInvoice.findFirst({
|
||||
where: {
|
||||
id: invoiceId,
|
||||
pos: {
|
||||
complex: {
|
||||
business_activity_id: businessId,
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
pos: {
|
||||
select: {
|
||||
provider: {
|
||||
select: {
|
||||
code: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
fiscal: {
|
||||
select: {
|
||||
id: true,
|
||||
retry_count: true,
|
||||
last_attempt_at: true,
|
||||
attempts: {
|
||||
orderBy: {
|
||||
attempt_no: 'desc',
|
||||
},
|
||||
take: 1,
|
||||
select: {
|
||||
id: true,
|
||||
attempt_no: true,
|
||||
status: true,
|
||||
tax_id: true,
|
||||
sent_at: true,
|
||||
received_at: true,
|
||||
error_message: true,
|
||||
created_at: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if (!invoice) {
|
||||
throw new NotFoundException('فاکتور مورد نظر یافت نشد.')
|
||||
}
|
||||
|
||||
return invoice
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Body, Controller, Get, Param, Post } from '@nestjs/common'
|
||||
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common'
|
||||
|
||||
import { PosInfo } from '@/common/decorators/posInfo.decorator'
|
||||
import type { IPosPayload } from '@/common/models/posPayload.model'
|
||||
import { CreateSalesInvoiceDto } from './dto/create-sales-invoice.dto'
|
||||
import { SalesInvoicesFilterDto } from './dto/sales-invoices-filter.dto'
|
||||
import { SalesInvoicesService } from './sales-invoices.service'
|
||||
|
||||
@Controller('pos/sales_invoices')
|
||||
@@ -10,13 +11,13 @@ export class SalesInvoicesController {
|
||||
constructor(private readonly salesInvoicesService: SalesInvoicesService) {}
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.salesInvoicesService.findAll()
|
||||
findAll(@PosInfo() posInfo: IPosPayload, @Query() query: SalesInvoicesFilterDto) {
|
||||
return this.salesInvoicesService.findAll(posInfo, query)
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.salesInvoicesService.findOne(+id)
|
||||
findOne(@PosInfo() posInfo: IPosPayload, @Param('id') id: string) {
|
||||
return this.salesInvoicesService.findOne(posInfo, id)
|
||||
}
|
||||
|
||||
@Post()
|
||||
|
||||
@@ -2,10 +2,12 @@ import { Module } from '@nestjs/common'
|
||||
import { SalesInvoiceFiscalSwitchService } from '../../consumer/saleInvoices/fiscal/sales-invoice-fiscal-switch.service'
|
||||
import { SalesInvoiceFiscalService } from '../../consumer/saleInvoices/fiscal/sales-invoice-fiscal.service'
|
||||
import { NamaTaxSwitchAdapter } from '../../consumer/saleInvoices/fiscal/switch/nama/nama-fiscal-switch.adapter'
|
||||
import { PosSalesInvoiceFiscalModule } from './fiscal/sales-invoice-fiscal.module'
|
||||
import { SalesInvoicesController } from './sales-invoices.controller'
|
||||
import { SalesInvoicesService } from './sales-invoices.service'
|
||||
|
||||
@Module({
|
||||
imports: [PosSalesInvoiceFiscalModule],
|
||||
controllers: [SalesInvoicesController],
|
||||
providers: [
|
||||
SalesInvoicesService,
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
import { IPosPayload } from '@/common/models/posPayload.model'
|
||||
import { translateEnumValue } from '@/common/utils'
|
||||
import { PrismaService } from '@/prisma/prisma.service'
|
||||
import { BadRequestException, Injectable } from '@nestjs/common'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
import type { CustomerIndividual, CustomerLegal } from 'generated/prisma/client'
|
||||
import { Prisma } from 'generated/prisma/client'
|
||||
import { CustomerType, PaymentMethodType } from 'generated/prisma/enums'
|
||||
import {
|
||||
CustomerType,
|
||||
FiscalResponseStatus,
|
||||
PaymentMethodType,
|
||||
} from 'generated/prisma/enums'
|
||||
import { SalesInvoiceFiscalService } from '../../consumer/saleInvoices/fiscal/sales-invoice-fiscal.service'
|
||||
import { CreateSalesInvoiceDto } from './dto/create-sales-invoice.dto'
|
||||
import { SalesInvoicesFilterDto } from './dto/sales-invoices-filter.dto'
|
||||
|
||||
// Define type guard for CustomerIndividual
|
||||
function isCustomerIndividual(customer: any): customer is CustomerIndividual {
|
||||
@@ -50,14 +56,213 @@ export class SalesInvoicesService {
|
||||
private salesInvoiceTaxService: SalesInvoiceFiscalService,
|
||||
) {}
|
||||
|
||||
findAll() {
|
||||
// TODO: Implement fetching all sales invoices
|
||||
return []
|
||||
async findAll(posInfo: IPosPayload, query: SalesInvoicesFilterDto = {}) {
|
||||
const page = query.page || 1
|
||||
const perPage = Math.min(query.perPage || 10, 100)
|
||||
|
||||
const where = this.buildFindAllWhere(posInfo, query)
|
||||
const [items, total] = await this.prisma.$transaction(async tx => [
|
||||
await tx.salesInvoice.findMany({
|
||||
where,
|
||||
orderBy: {
|
||||
created_at: 'desc',
|
||||
},
|
||||
skip: (page - 1) * perPage,
|
||||
take: perPage,
|
||||
select: {
|
||||
id: true,
|
||||
code: true,
|
||||
invoice_number: true,
|
||||
invoice_date: true,
|
||||
created_at: true,
|
||||
total_amount: true,
|
||||
customer: {
|
||||
select: {
|
||||
type: true,
|
||||
individual: {
|
||||
select: {
|
||||
first_name: true,
|
||||
last_name: true,
|
||||
mobile_number: true,
|
||||
national_id: true,
|
||||
},
|
||||
},
|
||||
legal: {
|
||||
select: {
|
||||
name: true,
|
||||
economic_code: true,
|
||||
registration_number: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
fiscal: {
|
||||
select: {
|
||||
attempts: {
|
||||
orderBy: {
|
||||
created_at: 'desc',
|
||||
},
|
||||
take: 1,
|
||||
select: {
|
||||
status: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
await tx.salesInvoice.count({ where }),
|
||||
])
|
||||
|
||||
const summaryItems = items.map(invoice => ({
|
||||
...invoice,
|
||||
status: translateEnumValue(
|
||||
'FiscalResponseStatus',
|
||||
invoice.fiscal?.attempts?.[0]?.status || FiscalResponseStatus.NOT_SEND,
|
||||
),
|
||||
}))
|
||||
|
||||
return ResponseMapper.paginate(summaryItems, { total, page, perPage })
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
// TODO: Implement fetching a single sales invoice
|
||||
return {}
|
||||
async findOne(posInfo: IPosPayload, id: string) {
|
||||
const invoice = await this.prisma.salesInvoice.findFirstOrThrow({
|
||||
where: {
|
||||
id,
|
||||
pos: {
|
||||
complex: {
|
||||
business_activity_id: posInfo.business_id,
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
code: true,
|
||||
invoice_number: true,
|
||||
invoice_date: true,
|
||||
created_at: true,
|
||||
updated_at: true,
|
||||
notes: true,
|
||||
total_amount: true,
|
||||
unknown_customer: true,
|
||||
customer: {
|
||||
select: {
|
||||
id: true,
|
||||
type: true,
|
||||
individual: {
|
||||
select: {
|
||||
first_name: true,
|
||||
last_name: true,
|
||||
mobile_number: true,
|
||||
national_id: true,
|
||||
postal_code: true,
|
||||
economic_code: true,
|
||||
},
|
||||
},
|
||||
legal: {
|
||||
select: {
|
||||
name: true,
|
||||
economic_code: true,
|
||||
registration_number: true,
|
||||
postal_code: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
pos: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
complex: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
business_activity: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
consumer_account: {
|
||||
select: {
|
||||
id: true,
|
||||
role: true,
|
||||
account: {
|
||||
select: {
|
||||
username: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
items: {
|
||||
select: {
|
||||
id: true,
|
||||
good_id: true,
|
||||
service_id: true,
|
||||
quantity: true,
|
||||
measure_unit_code: true,
|
||||
measure_unit_text: true,
|
||||
sku_code: true,
|
||||
unit_price: true,
|
||||
discount: true,
|
||||
total_amount: true,
|
||||
notes: true,
|
||||
payload: true,
|
||||
good_snapshot: true,
|
||||
},
|
||||
},
|
||||
payments: {
|
||||
select: {
|
||||
id: true,
|
||||
amount: true,
|
||||
payment_method: true,
|
||||
paid_at: true,
|
||||
created_at: true,
|
||||
terminal_info: {
|
||||
select: {
|
||||
terminal_id: true,
|
||||
stan: true,
|
||||
rrn: true,
|
||||
transaction_date_time: true,
|
||||
customer_card_no: true,
|
||||
description: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
fiscal: {
|
||||
select: {
|
||||
id: true,
|
||||
retry_count: true,
|
||||
last_attempt_at: true,
|
||||
attempts: {
|
||||
orderBy: {
|
||||
created_at: 'desc',
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
attempt_no: true,
|
||||
status: true,
|
||||
tax_id: true,
|
||||
error_message: true,
|
||||
sent_at: true,
|
||||
received_at: true,
|
||||
created_at: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
return ResponseMapper.single({
|
||||
...invoice,
|
||||
status: invoice.fiscal?.attempts?.[0]?.status || FiscalResponseStatus.NOT_SEND,
|
||||
})
|
||||
}
|
||||
|
||||
// async send(invoiceId: string, posInfo: IPosPayload) {
|
||||
@@ -83,7 +288,7 @@ export class SalesInvoicesService {
|
||||
// }
|
||||
|
||||
async create(data: CreateSalesInvoiceDto, posInfo: IPosPayload) {
|
||||
const { business_id, pos_id, consumer_account_id } = posInfo
|
||||
const { business_id, pos_id, consumer_account_id, complex_id } = posInfo
|
||||
const normalizedInvoiceDate = this.normalizeInvoiceDate(data.invoice_date)
|
||||
const { payments, terminalInfo } = this.buildPaymentsData(
|
||||
data.payments,
|
||||
@@ -101,6 +306,8 @@ export class SalesInvoicesService {
|
||||
normalizedInvoiceDate,
|
||||
invoiceNumber,
|
||||
consumer_account_id,
|
||||
businessId: business_id,
|
||||
complexId: complex_id,
|
||||
pos_id,
|
||||
goodsById,
|
||||
customerId: newCustomerId,
|
||||
@@ -156,6 +363,161 @@ export class SalesInvoicesService {
|
||||
)
|
||||
}
|
||||
|
||||
private buildFindAllWhere(posInfo: IPosPayload, query: SalesInvoicesFilterDto) {
|
||||
const where: Prisma.SalesInvoiceWhereInput = {
|
||||
pos: {
|
||||
complex: {
|
||||
business_activity_id: posInfo.business_id,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
if (query.code?.trim()) {
|
||||
where.code = {
|
||||
contains: query.code.trim(),
|
||||
}
|
||||
}
|
||||
|
||||
if (query.invoice_date_from || query.invoice_date_to) {
|
||||
where.invoice_date = {
|
||||
...(query.invoice_date_from ? { gte: new Date(query.invoice_date_from) } : {}),
|
||||
...(query.invoice_date_to ? { lte: new Date(query.invoice_date_to) } : {}),
|
||||
}
|
||||
}
|
||||
|
||||
if (query.created_at_from || query.created_at_to) {
|
||||
where.created_at = {
|
||||
...(query.created_at_from ? { gte: new Date(query.created_at_from) } : {}),
|
||||
...(query.created_at_to ? { lte: new Date(query.created_at_to) } : {}),
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
query.total_amount !== undefined ||
|
||||
query.total_amount_from !== undefined ||
|
||||
query.total_amount_to !== undefined
|
||||
) {
|
||||
where.total_amount = {
|
||||
...(query.total_amount !== undefined ? { equals: query.total_amount } : {}),
|
||||
...(query.total_amount_from !== undefined
|
||||
? { gte: query.total_amount_from }
|
||||
: {}),
|
||||
...(query.total_amount_to !== undefined ? { lte: query.total_amount_to } : {}),
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
query.customer_name?.trim() ||
|
||||
query.customer_mobile?.trim() ||
|
||||
query.customer_national_id?.trim() ||
|
||||
query.customer_economic_code?.trim()
|
||||
) {
|
||||
where.customer = {
|
||||
is: {
|
||||
OR: [
|
||||
...(query.customer_name?.trim()
|
||||
? [
|
||||
{
|
||||
individual: {
|
||||
is: {
|
||||
OR: [
|
||||
{
|
||||
first_name: {
|
||||
contains: query.customer_name.trim(),
|
||||
},
|
||||
},
|
||||
{
|
||||
last_name: {
|
||||
contains: query.customer_name.trim(),
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
legal: {
|
||||
is: {
|
||||
name: {
|
||||
contains: query.customer_name.trim(),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(query.customer_mobile?.trim()
|
||||
? [
|
||||
{
|
||||
individual: {
|
||||
is: {
|
||||
mobile_number: {
|
||||
contains: query.customer_mobile.trim(),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(query.customer_national_id?.trim()
|
||||
? [
|
||||
{
|
||||
individual: {
|
||||
is: {
|
||||
national_id: {
|
||||
contains: query.customer_national_id.trim(),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(query.customer_economic_code?.trim()
|
||||
? [
|
||||
{
|
||||
legal: {
|
||||
is: {
|
||||
OR: [
|
||||
{
|
||||
economic_code: {
|
||||
contains: query.customer_economic_code.trim(),
|
||||
},
|
||||
},
|
||||
{
|
||||
registration_number: {
|
||||
contains: query.customer_economic_code.trim(),
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if (query.status) {
|
||||
if (query.status === FiscalResponseStatus.NOT_SEND) {
|
||||
where.fiscal = null
|
||||
} else {
|
||||
where.fiscal = {
|
||||
is: {
|
||||
attempts: {
|
||||
some: {
|
||||
status: query.status,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return where
|
||||
}
|
||||
|
||||
private normalizeInvoiceDate(invoiceDate: Date | string) {
|
||||
return new Date(invoiceDate).toISOString() as any
|
||||
}
|
||||
@@ -339,11 +701,21 @@ export class SalesInvoicesService {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
sku: true,
|
||||
sku: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
local_sku: true,
|
||||
barcode: true,
|
||||
pricing_model: true,
|
||||
unit_type: true,
|
||||
measure_unit: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
base_sale_price: true,
|
||||
image_url: true,
|
||||
category: {
|
||||
@@ -364,6 +736,8 @@ export class SalesInvoicesService {
|
||||
normalizedInvoiceDate: Date
|
||||
invoiceNumber: number
|
||||
consumer_account_id: string
|
||||
businessId: string
|
||||
complexId: string
|
||||
pos_id: string
|
||||
goodsById: Map<string, any>
|
||||
customerId: string | null
|
||||
@@ -376,6 +750,8 @@ export class SalesInvoicesService {
|
||||
pos_id,
|
||||
goodsById,
|
||||
customerId,
|
||||
businessId,
|
||||
complexId,
|
||||
} = params
|
||||
const { customer_id, customer_type, customer, payments, ...invoiceData } = data
|
||||
|
||||
@@ -384,7 +760,7 @@ export class SalesInvoicesService {
|
||||
invoice_date: normalizedInvoiceDate,
|
||||
invoice_number: invoiceNumber,
|
||||
total_amount: data.total_amount,
|
||||
code: 'INV-' + Date.now(),
|
||||
code: this.generateInvoiceCode(businessId, complexId, pos_id, invoiceNumber),
|
||||
items: {
|
||||
createMany: {
|
||||
data: data.items.map(item => ({
|
||||
@@ -392,6 +768,7 @@ export class SalesInvoicesService {
|
||||
quantity: item.quantity,
|
||||
unit_price: item.unit_price,
|
||||
total_amount: item.total_amount,
|
||||
measure_unit_text: item.unit_type,
|
||||
payload: item.payload ? JSON.parse(JSON.stringify(item.payload)) : undefined,
|
||||
good_snapshot: item.good_id
|
||||
? JSON.parse(
|
||||
@@ -483,4 +860,13 @@ export class SalesInvoicesService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private generateInvoiceCode(
|
||||
business_id: string,
|
||||
complex_id: string,
|
||||
pos_id: string,
|
||||
invoice_number: number,
|
||||
) {
|
||||
return `${business_id.substring(0, 2)}-${complex_id.substring(0, 2)}-${pos_id.substring(0, 2)}-${invoice_number.toString()}`
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user