mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 02:13:35 -05:00
26f3f3e2e2
Migrate scripts folder to esm 1/x GitOrigin-RevId: 4a4bc9a161f144fdb40ce3f2a0a9313b36c6df81
27 lines
846 B
JavaScript
27 lines
846 B
JavaScript
import { waitForDb } from '../app/src/infrastructure/mongodb.js'
|
|
import InstitutionsManager from '../app/src/Features/Institutions/InstitutionsManager.js'
|
|
import { ensureRunningOnMongoSecondaryWithTimeout } from './helpers/env_variable_helper.mjs'
|
|
|
|
ensureRunningOnMongoSecondaryWithTimeout(300000)
|
|
|
|
const institutionId = parseInt(process.argv[2])
|
|
if (isNaN(institutionId)) throw new Error('No institution id')
|
|
console.log('Checking users of institution', institutionId)
|
|
const emitNonProUserIds = process.argv.includes('--emit-non-pro-user-ids')
|
|
|
|
async function main() {
|
|
const usersSummary = await InstitutionsManager.promises.checkInstitutionUsers(
|
|
institutionId,
|
|
emitNonProUserIds
|
|
)
|
|
console.log(usersSummary)
|
|
process.exit()
|
|
}
|
|
|
|
try {
|
|
await waitForDb()
|
|
await main()
|
|
} catch (error) {
|
|
console.error(error)
|
|
process.exit(1)
|
|
}
|