mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
26f3f3e2e2
Migrate scripts folder to esm 1/x GitOrigin-RevId: 4a4bc9a161f144fdb40ce3f2a0a9313b36c6df81
25 lines
689 B
JavaScript
25 lines
689 B
JavaScript
import minimist from 'minimist'
|
|
import { waitForDb } from '../app/src/infrastructure/mongodb.js'
|
|
import ProjectDeleter from '../app/src/Features/Project/ProjectDeleter.js'
|
|
|
|
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 })
|
|
}
|
|
|
|
try {
|
|
await main()
|
|
console.log('Done.')
|
|
process.exit(0)
|
|
} catch (error) {
|
|
console.error(error)
|
|
process.exit(1)
|
|
}
|