2020-10-05 04:29:37 -04:00
|
|
|
const { waitForDb } = require('../app/src/infrastructure/mongodb')
|
2019-07-11 14:45:50 -04:00
|
|
|
const InstitutionsManager = require('../app/src/Features/Institutions/InstitutionsManager')
|
2019-01-28 09:18:01 -05:00
|
|
|
|
|
|
|
const institutionId = parseInt(process.argv[2])
|
|
|
|
if (isNaN(institutionId)) throw new Error('No institution id')
|
|
|
|
console.log('Checking users of institution', institutionId)
|
2021-08-18 10:56:07 -04:00
|
|
|
const emitNonProUserIds = process.argv.includes('--emit-non-pro-user-ids')
|
2019-01-28 09:18:01 -05:00
|
|
|
|
2020-10-05 04:29:37 -04:00
|
|
|
waitForDb()
|
|
|
|
.then(main)
|
|
|
|
.catch(err => {
|
|
|
|
console.error(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
|
|
|
|
2021-07-27 09:23:22 -04:00
|
|
|
async function main() {
|
|
|
|
const usersSummary = await InstitutionsManager.promises.checkInstitutionUsers(
|
2021-08-18 10:56:07 -04:00
|
|
|
institutionId,
|
|
|
|
emitNonProUserIds
|
2021-04-14 09:17:21 -04:00
|
|
|
)
|
2021-07-27 09:23:22 -04:00
|
|
|
console.log(usersSummary)
|
|
|
|
process.exit()
|
2020-10-05 04:29:37 -04:00
|
|
|
}
|