Adding group app cleanup.

This commit is contained in:
mike12345567 2022-09-21 23:12:38 +01:00
parent 2c5d2f7b12
commit d80cd5042d
2 changed files with 5 additions and 7 deletions

View File

@ -67,11 +67,13 @@ export function createGroupsStore() {
addApp: async (groupId, appId, roleId) => { addApp: async (groupId, appId, roleId) => {
await API.addAppsToGroup(groupId, [{ appId, roleId }]) await API.addAppsToGroup(groupId, [{ appId, roleId }])
// refresh the group roles
await getGroup(groupId) await getGroup(groupId)
}, },
removeApp: async (groupId, appId) => { removeApp: async (groupId, appId) => {
await API.removeAppsFromGroup(groupId, [{ appId }]) await API.removeAppsFromGroup(groupId, [{ appId }])
// refresh the group roles
await getGroup(groupId) await getGroup(groupId)
}, },
} }

View File

@ -47,14 +47,9 @@ import { checkAppMetadata } from "../../automations/logging"
import { getUniqueRows } from "../../utilities/usageQuota/rows" import { getUniqueRows } from "../../utilities/usageQuota/rows"
import { quotas } from "@budibase/pro" import { quotas } from "@budibase/pro"
import { errors, events, migrations } from "@budibase/backend-core" import { errors, events, migrations } from "@budibase/backend-core"
import { import { App, Layout, Screen, MigrationType } from "@budibase/types"
App,
Layout,
Screen,
MigrationType,
AppNavigation,
} from "@budibase/types"
import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts" import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts"
import { groups } from "@budibase/pro"
const URL_REGEX_SLASH = /\/|\\/g const URL_REGEX_SLASH = /\/|\\/g
@ -501,6 +496,7 @@ const preDestroyApp = async (ctx: any) => {
const postDestroyApp = async (ctx: any) => { const postDestroyApp = async (ctx: any) => {
const rowCount = ctx.rowCount const rowCount = ctx.rowCount
await groups.cleanupApp(ctx.params.appId)
if (rowCount) { if (rowCount) {
await quotas.removeRows(rowCount) await quotas.removeRows(rowCount)
} }