1
0
Fork 0
mirror of synced 2024-06-28 11:00:55 +12:00
budibase/packages/worker/src/api/controllers/global/events.ts

18 lines
497 B
TypeScript

import {
UserCtx,
PostEventPublishRequest,
EventPublishType,
} from "@budibase/types"
import { events } from "@budibase/backend-core"
export async function publish(ctx: UserCtx<PostEventPublishRequest, void>) {
switch (ctx.request.body.type) {
case EventPublishType.ENVIRONMENT_VARIABLE_UPGRADE_PANEL_OPENED:
await events.environmentVariable.upgradePanelOpened(ctx.user._id!)
break
default:
ctx.throw(400, "Invalid publish event type.")
}
ctx.status = 200
}