From f555909b09be7e472a58d960fdd5a91ff45675a2 Mon Sep 17 00:00:00 2001 From: taDuc Date: Sun, 3 May 2026 19:36:18 +0700 Subject: [PATCH] renew name --- commit_snapshot.md | 10 +++++----- src/uhm/lib/editor/section/useSectionCommands.ts | 4 ++-- src/uhm/lib/editor/snapshot/editorSnapshot.ts | 6 +++--- src/uhm/types/sections.ts | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/commit_snapshot.md b/commit_snapshot.md index 5a2097f..f35feee 100644 --- a/commit_snapshot.md +++ b/commit_snapshot.md @@ -24,7 +24,7 @@ export type CommitSnapshot = { wikis?: WikiSnapshot[]; geometry_entity?: GeometryEntitySnapshot[]; // geometry ↔ entity (many-to-many) - entity_wikis?: EntityWikiLinkSnapshot[]; // entity ↔ wiki + entity_wiki?: EntityWikiLinkSnapshot[]; // entity ↔ wiki }; ``` @@ -54,7 +54,7 @@ FE hiện tại luôn ghi `source` cho `entities[]`, `geometries[]`, `wikis[]`. `geometry_entity[]` không có `operation` (join table state). -`entity_wikis[]` dùng `operation:"reference"|"delete"` để biểu diễn link/unlink **trong snapshot** (không phải delete trong DB). +`entity_wiki[]` dùng `operation:"reference"|"delete"` để biểu diễn link/unlink **trong snapshot** (không phải delete trong DB). ## 3) Ý Nghĩa Từng Phần @@ -87,7 +87,7 @@ FE build `entities[]` từ: 3. Entities xuất hiện trong `geometry_entity[]`: `source:"ref"`, `operation:"reference"`. -4. Entities xuất hiện trong `entity_wikis[]`: +4. Entities xuất hiện trong `entity_wiki[]`: `source:"ref"`, `operation:"reference"`. ### 3.3 `geometries[]` @@ -130,7 +130,7 @@ Danh sách wiki của project tại thời điểm commit: - Wiki không đổi: thường không có `operation`. - Wiki add từ search (wiki đã có trong DB): `source:"ref"`, `operation:"reference"`, `doc` có thể là `null`. -### 3.6 `entity_wikis[]` (join table Entity ↔ Wiki) +### 3.6 `entity_wiki[]` (join table Entity ↔ Wiki) ```ts export type EntityWikiLinkSnapshot = { @@ -201,7 +201,7 @@ Toggle link trong UI: "doc": null } ], - "entity_wikis": [ + "entity_wiki": [ { "entity_id": "e_1", "wiki_id": "w_inline_1", "operation": "reference" } ] } diff --git a/src/uhm/lib/editor/section/useSectionCommands.ts b/src/uhm/lib/editor/section/useSectionCommands.ts index 984b52f..3815b13 100644 --- a/src/uhm/lib/editor/section/useSectionCommands.ts +++ b/src/uhm/lib/editor/section/useSectionCommands.ts @@ -81,7 +81,7 @@ export function useSectionCommands(options: Options) { options.setCreatedEntities([]); const geoEntityIds = new Set((snapshot?.geometry_entity || []).map((row) => row.entity_id)); const linkedByWikiIds = new Set( - (snapshot?.entity_wikis || []) + (snapshot?.entity_wiki || []) .filter((l) => l?.operation !== "delete") .map((l) => l.entity_id) ); @@ -94,7 +94,7 @@ export function useSectionCommands(options: Options) { && e.operation !== "delete" )); options.setWikis(snapshot?.wikis || []); - options.setEntityWikiLinks(snapshot?.entity_wikis || []); + options.setEntityWikiLinks(snapshot?.entity_wiki || []); options.setSelectedFeatureId(null); options.setEntityFormStatus(null); }, [options]); diff --git a/src/uhm/lib/editor/snapshot/editorSnapshot.ts b/src/uhm/lib/editor/snapshot/editorSnapshot.ts index f3778dc..8bac929 100644 --- a/src/uhm/lib/editor/snapshot/editorSnapshot.ts +++ b/src/uhm/lib/editor/snapshot/editorSnapshot.ts @@ -133,7 +133,7 @@ export function normalizeEditorSnapshot(raw: unknown): EditorSnapshot | null { }) : undefined; - const entityWikisRaw = snapshot.entity_wikis; + const entityWikisRaw = snapshot.entity_wiki ?? snapshot.entity_wikis; const entityWikis: EntityWikiLinkSnapshot[] | undefined = Array.isArray(entityWikisRaw) ? entityWikisRaw .filter(isRecord) @@ -186,7 +186,7 @@ export function normalizeEditorSnapshot(raw: unknown): EditorSnapshot | null { geometries, wikis, geometry_entity: geometryEntity || migratedGeometryEntity, - entity_wikis: entityWikis, + entity_wiki: entityWikis, }; } @@ -406,7 +406,7 @@ export function buildEditorSnapshot(options: { geometries, geometry_entity: geometryEntity, wikis, - entity_wikis: entityWikis, + entity_wiki: entityWikis, }; } diff --git a/src/uhm/types/sections.ts b/src/uhm/types/sections.ts index b3accc0..4ce6fe2 100644 --- a/src/uhm/types/sections.ts +++ b/src/uhm/types/sections.ts @@ -72,7 +72,7 @@ export type EditorSnapshot = { // Join table geometry ↔ entity (many-to-many). geometry_entity?: GeometryEntitySnapshot[]; wikis?: WikiSnapshot[]; - entity_wikis?: EntityWikiLinkSnapshot[]; + entity_wiki?: EntityWikiLinkSnapshot[]; }; export type EditorLoadResponse = {