diff --git a/packages/server/src/automations/steps/createRow.js b/packages/server/src/automations/steps/createRow.js index 816cd829ab..1937121062 100644 --- a/packages/server/src/automations/steps/createRow.js +++ b/packages/server/src/automations/steps/createRow.js @@ -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, diff --git a/packages/server/src/automations/steps/deleteRow.js b/packages/server/src/automations/steps/deleteRow.js index c7bee577a5..e41e5ad263 100644 --- a/packages/server/src/automations/steps/deleteRow.js +++ b/packages/server/src/automations/steps/deleteRow.js @@ -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, diff --git a/packages/server/src/utilities/usageQuota/index.js b/packages/server/src/utilities/usageQuota/index.js index 110f8ef600..b0ff310aa3 100644 --- a/packages/server/src/utilities/usageQuota/index.js +++ b/packages/server/src/utilities/usageQuota/index.js @@ -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 }