mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
1bee808551
[web] scripts/undelete_project_to_user: add missing wait for db call GitOrigin-RevId: 80a767d26ee529c0aabf8ce11a010dca4a51be2b
26 lines
714 B
JavaScript
26 lines
714 B
JavaScript
const minimist = require('minimist')
|
|
const { waitForDb } = require('../app/src/infrastructure/mongodb')
|
|
const ProjectDeleter = require('../app/src/Features/Project/ProjectDeleter')
|
|
|
|
async function main() {
|
|
const argv = minimist(process.argv.slice(2))
|
|
const projectId = argv['project-id']
|
|
const userId = argv['user-id']
|
|
|
|
if (!projectId || !userId) {
|
|
throw new Error('set --project-id and --user-id')
|
|
}
|
|
console.log(`Restoring project ${projectId} to user ${userId}`)
|
|
await waitForDb()
|
|
await ProjectDeleter.promises.undeleteProject(projectId, { userId })
|
|
}
|
|
|
|
main()
|
|
.then(() => {
|
|
console.log('Done.')
|
|
process.exit(0)
|
|
})
|
|
.catch(err => {
|
|
console.error(err)
|
|
process.exit(1)
|
|
})
|