2024-10-18 07:04:57 -04:00
|
|
|
import minimist from 'minimist'
|
|
|
|
import { waitForDb } from '../app/src/infrastructure/mongodb.js'
|
|
|
|
import ProjectDeleter from '../app/src/Features/Project/ProjectDeleter.js'
|
2022-03-24 11:41:23 -04:00
|
|
|
|
|
|
|
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}`)
|
2022-03-24 12:31:15 -04:00
|
|
|
await waitForDb()
|
2022-03-24 11:41:23 -04:00
|
|
|
await ProjectDeleter.promises.undeleteProject(projectId, { userId })
|
|
|
|
}
|
|
|
|
|
2024-10-18 07:04:57 -04:00
|
|
|
try {
|
|
|
|
await main()
|
|
|
|
console.log('Done.')
|
|
|
|
process.exit(0)
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error)
|
|
|
|
process.exit(1)
|
|
|
|
}
|