mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
26f3f3e2e2
Migrate scripts folder to esm 1/x GitOrigin-RevId: 4a4bc9a161f144fdb40ce3f2a0a9313b36c6df81
30 lines
774 B
JavaScript
30 lines
774 B
JavaScript
import { waitForDb } from '../app/src/infrastructure/mongodb.js'
|
|
import ProjectDetailsHandler from '../app/src/Features/Project/ProjectDetailsHandler.js'
|
|
const projectId = process.argv[2]
|
|
|
|
if (!/^(?=[a-f\d]{24}$)(\d+[a-f]|[a-f]+\d)/.test(projectId)) {
|
|
console.error('Usage: node clear_project_tokens.js projectId')
|
|
process.exit(1)
|
|
}
|
|
|
|
function main() {
|
|
ProjectDetailsHandler.clearTokens(projectId, err => {
|
|
if (err) {
|
|
console.error(
|
|
`Error clearing project tokens from project ${projectId}`,
|
|
err
|
|
)
|
|
process.exit(1)
|
|
}
|
|
console.log(`Successfully cleared project tokens from project ${projectId}`)
|
|
process.exit(0)
|
|
})
|
|
}
|
|
|
|
try {
|
|
await waitForDb()
|
|
await main()
|
|
} catch (error) {
|
|
console.error(error)
|
|
process.exit(1)
|
|
}
|