2024-10-18 07:04:57 -04:00
|
|
|
import InstitutionsManager from '../app/src/Features/Institutions/InstitutionsManager.js'
|
|
|
|
import { ensureRunningOnMongoSecondaryWithTimeout } from './helpers/env_variable_helper.mjs'
|
2021-11-02 06:34:08 -04:00
|
|
|
|
2024-10-18 07:04:57 -04:00
|
|
|
ensureRunningOnMongoSecondaryWithTimeout(300000)
|
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
|
|
|
|
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
|
|
|
}
|
2024-10-18 07:04:57 -04:00
|
|
|
|
|
|
|
try {
|
|
|
|
await main()
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error)
|
|
|
|
process.exit(1)
|
|
|
|
}
|