From 9455cd9faba2fd5702b23533fcd2a06415d7d180 Mon Sep 17 00:00:00 2001 From: Alireza Hassani Date: Sun, 26 Jul 2026 14:45:02 +0330 Subject: [PATCH] Allow creating a business with an existing active owner cell number. Reuse the existing user as owner instead of rejecting duplicate cells, so one person can own multiple businesses. Co-authored-by: Cursor --- src/business-admin/business-admin.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/business-admin/business-admin.service.ts b/src/business-admin/business-admin.service.ts index 6deb72e..a771912 100644 --- a/src/business-admin/business-admin.service.ts +++ b/src/business-admin/business-admin.service.ts @@ -492,8 +492,13 @@ export class BusinessAdminService { where: { cellNumber: dto.ownerCellNumber }, }); + // Users can own multiple businesses. If the cell number already exists, + // leave that user unchanged and only attach the new business as owner. if (existing) { - throw new ConflictException('A user with this cell number already exists'); + if (!existing.isActive) { + throw new BadRequestException('Owner user is inactive'); + } + return existing; } const passwordHash = await bcrypt.hash(dto.ownerPassword, 10);