Multi-environment and multi-user construction
This commit is contained in:
@@ -242,7 +242,11 @@ export class LeadFormsService {
|
||||
ownerId ??
|
||||
(
|
||||
await this.prisma.user.findFirst({
|
||||
where: { organizationId: form.organizationId, role: 'owner' },
|
||||
where: {
|
||||
memberships: {
|
||||
some: { organizationId: form.organizationId, role: 'owner' },
|
||||
},
|
||||
},
|
||||
select: { id: true },
|
||||
})
|
||||
)?.id;
|
||||
@@ -447,7 +451,10 @@ export class LeadFormsService {
|
||||
) {
|
||||
if (!assigneeIds?.length) return;
|
||||
const count = await this.prisma.user.count({
|
||||
where: { organizationId, id: { in: assigneeIds } },
|
||||
where: {
|
||||
id: { in: assigneeIds },
|
||||
memberships: { some: { organizationId } },
|
||||
},
|
||||
});
|
||||
if (count !== assigneeIds.length) {
|
||||
throw new BadRequestException('یکی از مسئولان انتخابشده معتبر نیست');
|
||||
|
||||
Reference in New Issue
Block a user