feat(customers): add DTOs for individual and legal customer creation
- Created CreateCustomerIndividualDto for individual customer data with fields: first_name, last_name, national_code, postal_code, is_favorite, and economic_code. - Created CreateCustomerLegalDto for legal customer data with fields: company_name, economic_code, registration_number, and postal_code.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `account_id` on the `customers` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `address` on the `customers` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `email` on the `customers` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `first_name` on the `customers` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `is_active` on the `customers` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `last_name` on the `customers` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `mobile_number` on the `customers` table. All the data in the column will be lost.
|
||||
- Added the required column `type` to the `customers` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX `customers_mobile_number_key` ON `customers`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `customers` DROP COLUMN `account_id`,
|
||||
DROP COLUMN `address`,
|
||||
DROP COLUMN `email`,
|
||||
DROP COLUMN `first_name`,
|
||||
DROP COLUMN `is_active`,
|
||||
DROP COLUMN `last_name`,
|
||||
DROP COLUMN `mobile_number`,
|
||||
ADD COLUMN `is_favorite` BOOLEAN NULL DEFAULT false,
|
||||
ADD COLUMN `type` ENUM('INDIVIDUAL', 'LEGAL') NOT NULL;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `customer_individuals` (
|
||||
`customer_id` VARCHAR(191) NOT NULL,
|
||||
`first_name` VARCHAR(255) NOT NULL,
|
||||
`last_name` VARCHAR(255) NOT NULL,
|
||||
`national_id` CHAR(10) NOT NULL,
|
||||
`postal_code` CHAR(10) NOT NULL,
|
||||
`economic_code` CHAR(10) NULL,
|
||||
|
||||
PRIMARY KEY (`customer_id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `customer_legal` (
|
||||
`customer_id` VARCHAR(191) NOT NULL,
|
||||
`company_name` VARCHAR(255) NOT NULL,
|
||||
`economic_code` CHAR(10) NOT NULL,
|
||||
`registration_number` CHAR(20) NOT NULL,
|
||||
`postal_code` CHAR(10) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`customer_id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `customer_individuals` ADD CONSTRAINT `customer_individuals_customer_id_fkey` FOREIGN KEY (`customer_id`) REFERENCES `customers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `customer_legal` ADD CONSTRAINT `customer_legal_customer_id_fkey` FOREIGN KEY (`customer_id`) REFERENCES `customers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
Reference in New Issue
Block a user