feat: Refactor accounts service and related DTOs to enhance consumer account management

- Updated AccountsService to filter out OWNER roles in findAll method.
- Removed CreateConsumerAccountDto and its role property from account creation logic.
- Enhanced BusinessActivitiesService to include complex counts in responses.
- Modified ComplexesController and ComplexesService to handle consumer-specific logic.
- Introduced CreateConsumerComplexDto and UpdateConsumerComplexDto for complex management.
- Updated PosesController and PosesService to manage POS creation and updates with consumer context.
- Added utility function to calculate remaining accounts for business activities.
- Updated Prisma migration to add account_id to poses and enforce unique constraints.
This commit is contained in:
2026-04-24 04:27:28 +03:30
parent 11488093a7
commit 9b652a3603
21 changed files with 770 additions and 125 deletions
@@ -0,0 +1,20 @@
/*
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;
+4
View File
@@ -11,6 +11,7 @@ model ConsumerAccount {
account_id String @unique()
account Account @relation(fields: [account_id], references: [id])
pos Pos?
permission PermissionConsumer?
sales_invoices SalesInvoice[]
@@ -101,6 +102,9 @@ model Pos {
device_id String?
device Device? @relation(fields: [device_id], references: [id])
account_id String? @unique
account ConsumerAccount? @relation(fields: [account_id], references: [id])
provider_id String?
provider Provider? @relation(fields: [provider_id], references: [id])