Skip to content

Commit

Permalink
Merge pull request #30 from vishnuvinay89/all-saas-0.2-dev
Browse files Browse the repository at this point in the history
send cohortids for learner in auth API
  • Loading branch information
sudeeppr1998 authored Feb 17, 2025
2 parents 4dc96df + 30ca3ca commit 378cbdc
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/adapters/postgres/user-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,15 +677,24 @@ export class PostgresUserService implements IServicelocator {

const privilegeData = await this.postgresRoleService.findPrivilegeByRoleId(roleArray);
const privileges = privilegeData.map(priv => priv.name);

combinedResult.push({
let cohortIds = [];
if(roleName === 'learner') {
const mappedCohorts = await this.cohortMemberRepository.find({
where: { userId },
select: ['cohortId']
})
cohortIds = mappedCohorts.map(id => id.cohortId)
}
const result = {
tenantName: data.tenantname,
tenantId: data.tenantId,
userTenantMappingId: data.usertenantmappingid,
roleId: roleId,
roleName: roleName,
privileges: privileges
});
privileges: privileges,
...(roleName === 'learner' && { mappedCohorts: cohortIds })
}
combinedResult.push(result);
}
}

Expand Down

0 comments on commit 378cbdc

Please sign in to comment.