mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 14:49:01 +02:00
Merge pull request #21097 from overleaf/ls-scripts-to-esm-1
Migrate scripts folder to esm 1/x GitOrigin-RevId: 4a4bc9a161f144fdb40ce3f2a0a9313b36c6df81
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { OauthApplication } from '../app/src/models/OauthApplication.js'
|
||||
import parseArgs from 'minimist'
|
||||
import OError from '@overleaf/o-error'
|
||||
import { waitForDb } from '../app/src/infrastructure/mongodb.js'
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
try {
|
||||
await main()
|
||||
console.log('Done')
|
||||
process.exit(0)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
}
|
||||
Reference in New Issue
Block a user