|
|
@@ -3,7 +3,7 @@ const UserGetter = require('../User/UserGetter')
|
|
|
const UserMembershipsHandler = require('../UserMembership/UserMembershipsHandler')
|
|
|
const UserMembershipEntityConfigs = require('../UserMembership/UserMembershipEntityConfigs')
|
|
|
|
|
|
-async function _getCurrentAffiliations(userId) {
|
|
|
+async function getCurrentAffiliations(userId) {
|
|
|
const fullEmails = await UserGetter.promises.getUserFullEmails(userId)
|
|
|
// current are those confirmed and not with lapsed reconfirmations
|
|
|
return fullEmails
|
|
|
@@ -22,7 +22,7 @@ async function getCurrentInstitutionIds(userId) {
|
|
|
// current are those confirmed and not with lapsed reconfirmations
|
|
|
// only 1 record returned per current institutionId
|
|
|
const institutionIds = new Set()
|
|
|
- const currentAffiliations = await _getCurrentAffiliations(userId)
|
|
|
+ const currentAffiliations = await getCurrentAffiliations(userId)
|
|
|
currentAffiliations.forEach(affiliation => {
|
|
|
institutionIds.add(affiliation.institution.id)
|
|
|
})
|
|
|
@@ -33,7 +33,7 @@ async function getCurrentInstitutionsWithLicence(userId) {
|
|
|
// current are those confirmed and not with lapsed reconfirmations
|
|
|
// only 1 record returned per current institution
|
|
|
const institutions = {}
|
|
|
- const currentAffiliations = await _getCurrentAffiliations(userId)
|
|
|
+ const currentAffiliations = await getCurrentAffiliations(userId)
|
|
|
currentAffiliations.forEach(affiliation => {
|
|
|
if (affiliation.licence && affiliation.licence !== 'free') {
|
|
|
institutions[affiliation.institution.id] = affiliation.institution
|
|
|
@@ -78,6 +78,7 @@ const InstitutionsGetter = {
|
|
|
}
|
|
|
|
|
|
InstitutionsGetter.promises = {
|
|
|
+ getCurrentAffiliations,
|
|
|
getCurrentInstitutionIds,
|
|
|
getCurrentInstitutionsWithLicence,
|
|
|
getManagedInstitutions: promisify(InstitutionsGetter.getManagedInstitutions),
|