mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
prefixed data entity endpoints with /entity
This commit is contained in:
@@ -142,14 +142,13 @@ export class SystemController extends Controller {
|
||||
const value = await c.req.json();
|
||||
const path = c.req.param("path") as string;
|
||||
|
||||
const moduleConfig = this.app.mutateConfig(module);
|
||||
if (moduleConfig.has(path)) {
|
||||
if (this.app.modules.get(module).schema().has(path)) {
|
||||
return c.json({ success: false, path, error: "Path already exists" }, { status: 400 });
|
||||
}
|
||||
console.log("-- add", module, path, value);
|
||||
|
||||
return await handleConfigUpdateResponse(c, async () => {
|
||||
await moduleConfig.patch(path, value);
|
||||
await this.app.mutateConfig(module).patch(path, value);
|
||||
return {
|
||||
success: true,
|
||||
module,
|
||||
@@ -283,6 +282,6 @@ export class SystemController extends Controller {
|
||||
return c.json(generateOpenAPI(config));
|
||||
});
|
||||
|
||||
return hono;
|
||||
return hono.all("*", (c) => c.notFound());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ function dataRoutes(config: ModuleConfigs): { paths: OAS.Document["paths"] } {
|
||||
|
||||
const tags = ["data"];
|
||||
const paths: OAS.PathsObject = {
|
||||
"/{entity}": {
|
||||
"/entity/{entity}": {
|
||||
get: {
|
||||
summary: "List entities",
|
||||
parameters: [params.entity],
|
||||
@@ -148,7 +148,7 @@ function dataRoutes(config: ModuleConfigs): { paths: OAS.Document["paths"] } {
|
||||
tags
|
||||
}
|
||||
},
|
||||
"/{entity}/{id}": {
|
||||
"/entity/{entity}/{id}": {
|
||||
get: {
|
||||
summary: "Get entity",
|
||||
parameters: [params.entity, params.entityId],
|
||||
|
||||
Reference in New Issue
Block a user