mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-28 22:03:16 -05:00
Merge pull request #11960 from overleaf/jk-script-to-remove-oauth-application
[web] script to remove oauthApplication record GitOrigin-RevId: d217bec8d4b271ec8007ea90c0fde5e8f7e3fe52
This commit is contained in:
parent
eb32081585
commit
3472a82ac9
1 changed files with 39 additions and 0 deletions
39
services/web/scripts/remove_oauth_application.js
Normal file
39
services/web/scripts/remove_oauth_application.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
const { OauthApplication } = require('../app/src/models/OauthApplication')
|
||||
const parseArgs = require('minimist')
|
||||
const OError = require('@overleaf/o-error')
|
||||
const { waitForDb } = require('../app/src/infrastructure/mongodb')
|
||||
|
||||
async function _removeOauthApplication(appId) {
|
||||
if (!appId) {
|
||||
throw new OError('No app id supplied')
|
||||
}
|
||||
console.log('Waiting for db...')
|
||||
await waitForDb()
|
||||
console.log(`Removing oauthApplication with id=${appId}`)
|
||||
const result = await OauthApplication.deleteOne({ id: appId })
|
||||
console.log('Result', result)
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const argv = parseArgs(process.argv.slice(2), {
|
||||
string: ['id'],
|
||||
unknown: function (arg) {
|
||||
console.error('unrecognised argument', arg)
|
||||
process.exit(1)
|
||||
},
|
||||
})
|
||||
const appId = argv.id
|
||||
await _removeOauthApplication(appId)
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main()
|
||||
.then(() => {
|
||||
console.log('Done')
|
||||
process.exit(0)
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue