undelete_project_to_user.mjs 604 B

1234567891011121314151617181920212223
  1. import minimist from 'minimist'
  2. import ProjectDeleter from '../app/src/Features/Project/ProjectDeleter.js'
  3. async function main() {
  4. const argv = minimist(process.argv.slice(2))
  5. const projectId = argv['project-id']
  6. const userId = argv['user-id']
  7. if (!projectId || !userId) {
  8. throw new Error('set --project-id and --user-id')
  9. }
  10. console.log(`Restoring project ${projectId} to user ${userId}`)
  11. await ProjectDeleter.promises.undeleteProject(projectId, { userId })
  12. }
  13. try {
  14. await main()
  15. console.log('Done.')
  16. process.exit(0)
  17. } catch (error) {
  18. console.error(error)
  19. process.exit(1)
  20. }