Start implementing row action trigger
This commit is contained in:
parent
cf4f463da4
commit
7bad3ad39c
|
@ -1,3 +1,14 @@
|
||||||
export function run() {
|
import { RowActionTriggerRequest, Ctx } from "@budibase/types"
|
||||||
throw new Error("Function not implemented.")
|
import sdk from "../../../sdk"
|
||||||
|
|
||||||
|
export async function run(ctx: Ctx<RowActionTriggerRequest, void>) {
|
||||||
|
const { tableId } = ctx.params
|
||||||
|
const table = await sdk.tables.getTable(tableId)
|
||||||
|
if (!table) {
|
||||||
|
ctx.throw(404)
|
||||||
|
}
|
||||||
|
|
||||||
|
const { rowId } = ctx.request.body
|
||||||
|
console.warn({ rowId })
|
||||||
|
ctx.status = 200
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
import Router from "@koa/router"
|
import Router from "@koa/router"
|
||||||
|
import Joi from "joi"
|
||||||
|
import { middleware, permissions } from "@budibase/backend-core"
|
||||||
import * as rowActionController from "../controllers/rowAction"
|
import * as rowActionController from "../controllers/rowAction"
|
||||||
import { authorizedResource } from "../../middleware/authorized"
|
import { authorizedResource } from "../../middleware/authorized"
|
||||||
|
|
||||||
import { middleware, permissions } from "@budibase/backend-core"
|
import {
|
||||||
import Joi from "joi"
|
middleware as appInfoMiddleware,
|
||||||
|
AppType,
|
||||||
|
} from "../../middleware/appInfo"
|
||||||
|
|
||||||
const { PermissionLevel, PermissionType } = permissions
|
const { PermissionLevel, PermissionType } = permissions
|
||||||
|
|
||||||
|
@ -45,7 +49,8 @@ router
|
||||||
|
|
||||||
// Other endpoints
|
// Other endpoints
|
||||||
.post(
|
.post(
|
||||||
"/api/tables/:tableId/actions/:actionId/run",
|
"/api/tables/:tableId/actions/:actionId/trigger",
|
||||||
|
appInfoMiddleware({ appType: AppType.PROD }),
|
||||||
authorizedResource(PermissionType.TABLE, PermissionLevel.READ, "tableId"),
|
authorizedResource(PermissionType.TABLE, PermissionLevel.READ, "tableId"),
|
||||||
rowActionController.run
|
rowActionController.run
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue