feat: add response DTOs for various services across modules

- Created response DTOs for ConfigService, AppService, AuthService, CatalogsService, AccountsService, BusinessActivityComplexesService, ComplexPosesService, SalesInvoicesService, BusinessActivitiesService, ConsumerBusinessActivityGoodsService, and others.
- Implemented Create, FindAll, FindOne, and Update response types for services in consumer, partners, and POS modules.
- Added request DTOs for creating and updating goods in the consumer business activities module.
- Introduced filtering DTO for partner licenses.
- Enhanced response mapping for partner license activations.
This commit is contained in:
2026-04-27 10:45:39 +03:30
parent 34793295c9
commit dee96b6e91
208 changed files with 8058 additions and 2349 deletions
@@ -0,0 +1,75 @@
/*
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;
@@ -0,0 +1,102 @@
/*
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;
@@ -0,0 +1,22 @@
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;