mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
running schema mutations in safe proxy and revert to previous on error
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
import { Exception, isDebug } from "core";
|
||||
import { Exception } from "core";
|
||||
import { type Static, StringEnum, Type } from "core/utils";
|
||||
import { Hono } from "hono";
|
||||
import { cors } from "hono/cors";
|
||||
import { timing } from "hono/timing";
|
||||
import { Module } from "modules/Module";
|
||||
import * as SystemPermissions from "modules/permissions";
|
||||
|
||||
const serverMethods = ["GET", "POST", "PATCH", "PUT", "DELETE"];
|
||||
export const serverConfigSchema = Type.Object(
|
||||
|
||||
@@ -256,17 +256,15 @@ export class SystemController extends Controller {
|
||||
tb(
|
||||
"query",
|
||||
Type.Object({
|
||||
sync: Type.Optional(booleanLike),
|
||||
drop: Type.Optional(booleanLike),
|
||||
save: Type.Optional(booleanLike)
|
||||
sync: Type.Optional(booleanLike)
|
||||
})
|
||||
),
|
||||
async (c) => {
|
||||
const { sync, drop, save } = c.req.valid("query") as Record<string, boolean>;
|
||||
const { sync } = c.req.valid("query") as Record<string, boolean>;
|
||||
this.ctx.guard.throwUnlessGranted(SystemPermissions.build);
|
||||
|
||||
await this.app.build({ sync, drop, save });
|
||||
return c.json({ success: true, options: { sync, drop, save } });
|
||||
await this.app.build({ sync });
|
||||
return c.json({ success: true, options: { sync } });
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user