update deployment quota after deploy

This commit is contained in:
Martin McKeaveney 2020-10-08 15:06:27 +01:00
parent 212a24348a
commit 3f4fa0674d
1 changed files with 5 additions and 1 deletions

View File

@ -46,8 +46,12 @@ async function getCurrentInstanceQuota(instanceId) {
}) })
) )
const existingRecords = records.rows.length const existingRecords = records.rows.length
const designDoc = await db.get("_design/database")
return { return {
records: existingRecords, records: existingRecords,
views: Object.keys(designDoc.views).length,
} }
} }
@ -88,7 +92,7 @@ exports.deployApp = async function(ctx) {
const deployedInstanceQuota = await getCurrentInstanceQuota( const deployedInstanceQuota = await getCurrentInstanceQuota(
ctx.user.instanceId ctx.user.instanceId
) )
updateDeploymentQuota(deployedInstanceQuota) await updateDeploymentQuota(deployedInstanceQuota)
ctx.body = { ctx.body = {
status: "SUCCESS", status: "SUCCESS",