1
0
Fork 0
mirror of synced 2024-06-23 08:30:31 +12:00

fix revert on unpublished app

This commit is contained in:
Martin McKeaveney 2021-11-08 13:06:25 +01:00
parent 56e5aca60f
commit ed051e1547

View file

@ -82,6 +82,13 @@ exports.revert = async ctx => {
const db = new CouchDB(productionAppId, { skip_setup: true })
const info = await db.info()
if (info.error) throw info.error
const deploymentDoc = await db.get(DocumentTypes.DEPLOYMENTS)
if (
!deploymentDoc.history ||
Object.keys(deploymentDoc.history).length === 0
) {
throw new Error("No deployments for app")
}
} catch (err) {
return ctx.throw(400, "App has not yet been deployed")
}