Add dryRun to automation row create and remove env conditional on delete

This commit is contained in:
Rory Powell 2022-01-18 15:53:55 +00:00
parent fc043e116d
commit 604d316834
3 changed files with 5 additions and 7 deletions

View File

@ -82,8 +82,9 @@ exports.run = async function ({ inputs, appId, emitter }) {
inputs.row.tableId,
inputs.row
)
await usage.update(usage.Properties.ROW, 1)
await usage.update(usage.Properties.ROW, 1, { dryRun: true })
await rowController.save(ctx)
await usage.update(usage.Properties.ROW, 1)
return {
row: inputs.row,
response: ctx.body,

View File

@ -1,5 +1,4 @@
const rowController = require("../../api/controllers/row")
const env = require("../../environment")
const usage = require("../../utilities/usageQuota")
const { buildCtx } = require("./utils")
const automationUtils = require("../automationUtils")
@ -74,9 +73,7 @@ exports.run = async function ({ inputs, appId, emitter }) {
})
try {
if (env.isProd()) {
await usage.update(usage.Properties.ROW, -1)
}
await usage.update(usage.Properties.ROW, -1)
await rowController.destroy(ctx)
return {
response: ctx.body,

View File

@ -25,12 +25,12 @@ exports.useQuotas = () => {
}
exports.Properties = {
ROW: "rows", // mostly works - app / table deletion not yet accounted for
ROW: "rows",
UPLOAD: "storage", // doesn't work yet
VIEW: "views", // doesn't work yet
USER: "users", // doesn't work yet
AUTOMATION: "automationRuns", // doesn't work yet
APPS: "apps", // works
APPS: "apps",
EMAILS: "emails", // doesn't work yet
}