mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-24 01:29:35 +02:00
* [web] Add deletedReason parameter to project deletion methods * revert sinon.match.any in ProjectDuplicator negative assertion Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> GitOrigin-RevId: d1595eefe0e36150231ee9646fe5eba0786fd1f5
28 lines
803 B
JavaScript
28 lines
803 B
JavaScript
import minimist from 'minimist'
|
|
import ProjectDeleter from '../app/src/Features/Project/ProjectDeleter.mjs'
|
|
import { DeletedProjectReasons } from '../app/src/Features/Project/DeletedProjectReasons.mjs'
|
|
import { scriptRunner } from './lib/ScriptRunner.mjs'
|
|
|
|
async function main() {
|
|
const argv = minimist(process.argv.slice(2))
|
|
const projectId = argv['project-id']
|
|
|
|
if (!projectId) {
|
|
throw new Error('set --project-id')
|
|
}
|
|
console.log(`Soft deleting project ${projectId}`)
|
|
// soft delete, project will be permanently deleted after 90 days
|
|
await ProjectDeleter.promises.deleteProject(projectId, {
|
|
deletedReason: DeletedProjectReasons.SCRIPT,
|
|
})
|
|
}
|
|
|
|
try {
|
|
await scriptRunner(main)
|
|
console.log('Done.')
|
|
process.exit(0)
|
|
} catch (error) {
|
|
console.error(error)
|
|
process.exit(1)
|
|
}
|