Endpoint scaffolding
This commit is contained in:
parent
3f5161aaf7
commit
107bd08e21
|
@ -0,0 +1,15 @@
|
|||
export function find() {
|
||||
throw new Error("Function not implemented.")
|
||||
}
|
||||
|
||||
export function create() {
|
||||
throw new Error("Function not implemented.")
|
||||
}
|
||||
|
||||
export function update() {
|
||||
throw new Error("Function not implemented.")
|
||||
}
|
||||
|
||||
export function remove() {
|
||||
throw new Error("Function not implemented.")
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
export * from "./crud"
|
||||
export * from "./run"
|
|
@ -0,0 +1,3 @@
|
|||
export function run() {
|
||||
throw new Error("Function not implemented.")
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
import Router from "@koa/router"
|
||||
import * as rowActionController from "../controllers/rowAction"
|
||||
import { authorizedResource } from "../../middleware/authorized"
|
||||
|
||||
import { permissions } from "@budibase/backend-core"
|
||||
|
||||
const { PermissionLevel, PermissionType } = permissions
|
||||
|
||||
const router: Router = new Router()
|
||||
|
||||
// CRUD endpoints
|
||||
router
|
||||
.get(
|
||||
"/api/tables/:tableId/actions",
|
||||
authorizedResource(PermissionType.TABLE, PermissionLevel.READ, "tableId"),
|
||||
rowActionController.find
|
||||
)
|
||||
.post(
|
||||
"/api/tables/:tableId/actions",
|
||||
authorizedResource(PermissionType.TABLE, PermissionLevel.READ, "tableId"),
|
||||
rowActionController.create
|
||||
)
|
||||
.put(
|
||||
"/api/tables/:tableId/actions/:actionId",
|
||||
authorizedResource(PermissionType.TABLE, PermissionLevel.READ, "tableId"),
|
||||
rowActionController.update
|
||||
)
|
||||
.delete(
|
||||
"/api/tables/:tableId/actions/:actionId",
|
||||
authorizedResource(PermissionType.TABLE, PermissionLevel.READ, "tableId"),
|
||||
rowActionController.remove
|
||||
)
|
||||
|
||||
// Other endpoints
|
||||
.post(
|
||||
"/api/tables/:tableId/actions/:actionId/run",
|
||||
authorizedResource(PermissionType.TABLE, PermissionLevel.READ, "tableId"),
|
||||
rowActionController.run
|
||||
)
|
||||
|
||||
export default router
|
Loading…
Reference in New Issue