feat: greepy review

This commit is contained in:
=
2025-10-20 22:05:02 +05:30
parent 2fa762e56d
commit eec2b30666
25 changed files with 65 additions and 66 deletions
@@ -291,7 +291,7 @@ export const membershipUserDALFactory = (db: TDbClient) => {
}
};
// this right nwo only support sub organization
// this right now only support sub organization
const listAvailableUsers = async (orgId: string, rootOrgId: string) => {
try {
const usersConnectedToOrg = db
@@ -92,10 +92,15 @@ export const newOrgMembershipUserFactory = ({
},
scopeOrgId: org.rootOrgId
});
if (rootOrgMembership.length !== newMembers.length)
if (rootOrgMembership.length !== newMembers.length) {
const emails = newMembers
.filter((user) => !rootOrgMembership.find((i) => i.actorUserId === user.id))
.map((el) => el.email)
.join(",");
throw new BadRequestError({
message: "User doesn't have membership in root organization"
message: `Users with email ${emails} doesn't have membership in root organization`
});
}
}
};