5ce560ce97
- Updated `findAll` method in `CustomersController` to accept filtering parameters. - Implemented filtering logic in `CustomersService` to retrieve customers based on type and search query. - Added `PosCustomerFilterDto` for query validation. - Updated customer-related DTOs to make fields optional and added length validation where necessary. - Modified customer-related logic in `sales-invoice-tsp.utils.ts` to accommodate new DTO structure. - Added unique constraints to `customer_individuals` and `customer_legal` tables in the database migration. - Removed commented-out code in `PosMiddleware` for cleaner codebase. - Set default value for `is_default_guild_good` to false in `OwnedGoodsService`.
26 lines
1.2 KiB
SQL
26 lines
1.2 KiB
SQL
/*
|
|
Warnings:
|
|
|
|
- A unique constraint covering the columns `[business_activity_id,postal_code,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,postal_code,registration_number]` on the table `customer_legal` will be added. If there are existing duplicate values, this will fail.
|
|
|
|
*/
|
|
-- AlterTable
|
|
ALTER TABLE `customer_individuals` MODIFY `first_name` VARCHAR(255) NULL,
|
|
MODIFY `last_name` VARCHAR(255) NULL,
|
|
MODIFY `national_id` CHAR(10) NULL,
|
|
MODIFY `mobile_number` CHAR(15) NULL,
|
|
MODIFY `postal_code` CHAR(10) NULL,
|
|
MODIFY `economic_code` CHAR(14) NULL;
|
|
|
|
-- AlterTable
|
|
ALTER TABLE `customer_legal` MODIFY `name` VARCHAR(255) NULL,
|
|
MODIFY `economic_code` CHAR(11) NULL,
|
|
MODIFY `postal_code` CHAR(10) NULL;
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX `customer_individuals_business_activity_id_postal_code_nation_key` ON `customer_individuals`(`business_activity_id`, `postal_code`, `national_id`);
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX `customer_legal_business_activity_id_postal_code_registration_key` ON `customer_legal`(`business_activity_id`, `postal_code`, `registration_number`);
|