mirror of
https://github.com/BetterCorp/BetterFrame.git
synced 2026-05-27 03:56:33 +00:00
fix: auto-create setup_state if missing + map ablesign→web in bundle
- getSetupState: INSERT if row missing instead of throwing. Handles manual DELETE or fresh tenant schema. - Bundle generation: ablesign entities map to content_type='web' with web_url from entity. Kiosk renders as WebView — no kiosk update needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4e282f503d
commit
d58792524d
2 changed files with 10 additions and 3 deletions
|
|
@ -229,10 +229,11 @@ export async function generateBundle(
|
|||
// Dashboard entities are surfaced to the kiosk as `web` cells
|
||||
// pointing at /dash/<dashboard_id> — kiosk WebKit handles them
|
||||
// identically to user-supplied web cells.
|
||||
contentType = ent.type === "dashboard" ? "web" : ent.type;
|
||||
contentType = (ent.type === "dashboard" || ent.type === "ablesign") ? "web" : ent.type;
|
||||
cameraId = ent.type === "camera" ? ent.camera_id : null;
|
||||
webUrl =
|
||||
ent.type === "web" ? ent.web_url :
|
||||
ent.type === "ablesign" ? ent.web_url :
|
||||
ent.type === "dashboard" && ent.dashboard_id ? `/dash/${ent.dashboard_id}` :
|
||||
null;
|
||||
htmlContent = ent.type === "html" ? ent.html_content : null;
|
||||
|
|
|
|||
|
|
@ -254,8 +254,14 @@ export class Repository {
|
|||
// ===========================================================================
|
||||
|
||||
async getSetupState(): Promise<SetupState> {
|
||||
const r = await this._get("SELECT * FROM setup_state WHERE id = 1");
|
||||
if (!r) throw new Error("setup_state row missing");
|
||||
let r = await this._get("SELECT * FROM setup_state WHERE id = 1");
|
||||
if (!r) {
|
||||
await this._run(
|
||||
"INSERT INTO setup_state (id, is_complete, extras) VALUES (1, false, '{}') ON CONFLICT (id) DO NOTHING",
|
||||
);
|
||||
r = await this._get("SELECT * FROM setup_state WHERE id = 1");
|
||||
if (!r) throw new Error("setup_state row could not be created");
|
||||
}
|
||||
return rowToSetupState(r as Record<string, unknown>);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue