Skip to content

Commit 4dc96df

Browse files
authored
Merge pull request #29 from Vidyaranya-Gavai-TTPL/issueFix
Issue Fixed
2 parents e90678e + 17358d2 commit 4dc96df

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/invitation/invitation.service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ export class InvitationService {
286286
}
287287

288288
// If accepted, then map user as cohort admin
289-
if (invitation.invitationStatus === "Accepted") {
289+
if (updateInvitationDto.invitationStatus === "Accepted") {
290290
// Get role for roleId
291291
const role = await this.roleRepository.findOne({
292292
where: { tenantId: invitation.tenantId, code: "cohort_admin" },
@@ -297,7 +297,11 @@ export class InvitationService {
297297
where: { userId, roleId: role.roleId },
298298
});
299299

300-
if (userRoleMap) {
300+
const cohortMember = await this.cohortMembersRepository.findOne({
301+
where: { cohortId: invitation.cohortId, userId },
302+
})
303+
304+
if (userRoleMap && cohortMember) {
301305
const error = API_RESPONSES.INVITEE_ALREADY_MAPPED;
302306
return APIResponse.error(
303307
response,

0 commit comments

Comments
 (0)