From d2439ab042d6bb8df2cfacaf45d72301339dac7d Mon Sep 17 00:00:00 2001 From: Rizky Date: Wed, 13 Dec 2023 13:59:13 +0700 Subject: [PATCH] fix --- app/srv/ws/edit/action/diff-local.ts | 36 ++++++++++++++-------------- pkgs/core/server/api-ctx.ts | 3 --- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/app/srv/ws/edit/action/diff-local.ts b/app/srv/ws/edit/action/diff-local.ts index a17335ee..4c1dc551 100644 --- a/app/srv/ws/edit/action/diff-local.ts +++ b/app/srv/ws/edit/action/diff-local.ts @@ -31,13 +31,13 @@ export const diffLocal = (ws: any, msg: any) => { if (msg.id) { const page = eg.edit.page[msg.id].doc.getMap("map").toJSON(); try { - // await db.page.update({ - // where: { id: page.id }, - // data: { - // content_tree: page.content_tree, - // updated_at: new Date(), - // }, - // }); + await db.page.update({ + where: { id: page.id }, + data: { + content_tree: page.content_tree, + updated_at: new Date(), + }, + }); resolve(); } catch (e) { console.error(e); @@ -50,17 +50,17 @@ export const diffLocal = (ws: any, msg: any) => { }, 1500); } else if (msg.mode === "comp") { eg.edit.comp[msg.id].saveTimeout = setTimeout(async () => { - // const comp = eg.edit.comp[msg.id].doc.getMap("map").toJSON(); - // await db.component.update({ - // where: { - // id: msg.id, - // }, - // data: { - // name: comp.name, - // content_tree: comp.content_tree, - // updated_at: new Date(), - // }, - // }); + const comp = eg.edit.comp[msg.id].doc.getMap("map").toJSON(); + await db.component.update({ + where: { + id: msg.id, + }, + data: { + name: comp.name, + content_tree: comp.content_tree, + updated_at: new Date(), + }, + }); }, 1500); } else if (msg.mode === "site") { clearTimeout(eg.edit.site[msg.id].saveTimeout); diff --git a/pkgs/core/server/api-ctx.ts b/pkgs/core/server/api-ctx.ts index 2ad8c0c5..6f3c8a13 100644 --- a/pkgs/core/server/api-ctx.ts +++ b/pkgs/core/server/api-ctx.ts @@ -41,9 +41,6 @@ const replacer = (key: string, value: string) => { if (typeof value === "bigint") { return `BigInt::${value}`; } - if (typeof value === "string" && value.startsWith("BigInt::")) { - return BigInt(value.substring(8)); - } return value; };