Skip to content

Commit

Permalink
Merge pull request #29 from Vidyaranya-Gavai-TTPL/issueFix
Browse files Browse the repository at this point in the history
Issue Fixed
  • Loading branch information
gouravmore authored Feb 13, 2025
2 parents e90678e + 17358d2 commit 4dc96df
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/invitation/invitation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class InvitationService {
}

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

if (userRoleMap) {
const cohortMember = await this.cohortMembersRepository.findOne({
where: { cohortId: invitation.cohortId, userId },
})

if (userRoleMap && cohortMember) {
const error = API_RESPONSES.INVITEE_ALREADY_MAPPED;
return APIResponse.error(
response,
Expand Down

0 comments on commit 4dc96df

Please sign in to comment.