renew name
This commit is contained in:
@@ -24,7 +24,7 @@ export type CommitSnapshot = {
|
|||||||
wikis?: WikiSnapshot[];
|
wikis?: WikiSnapshot[];
|
||||||
|
|
||||||
geometry_entity?: GeometryEntitySnapshot[]; // geometry ↔ entity (many-to-many)
|
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).
|
`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
|
## 3) Ý Nghĩa Từng Phần
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ FE build `entities[]` từ:
|
|||||||
3. Entities xuất hiện trong `geometry_entity[]`:
|
3. Entities xuất hiện trong `geometry_entity[]`:
|
||||||
`source:"ref"`, `operation:"reference"`.
|
`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"`.
|
`source:"ref"`, `operation:"reference"`.
|
||||||
|
|
||||||
### 3.3 `geometries[]`
|
### 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 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`.
|
- 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
|
```ts
|
||||||
export type EntityWikiLinkSnapshot = {
|
export type EntityWikiLinkSnapshot = {
|
||||||
@@ -201,7 +201,7 @@ Toggle link trong UI:
|
|||||||
"doc": null
|
"doc": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"entity_wikis": [
|
"entity_wiki": [
|
||||||
{ "entity_id": "e_1", "wiki_id": "w_inline_1", "operation": "reference" }
|
{ "entity_id": "e_1", "wiki_id": "w_inline_1", "operation": "reference" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export function useSectionCommands(options: Options) {
|
|||||||
options.setCreatedEntities([]);
|
options.setCreatedEntities([]);
|
||||||
const geoEntityIds = new Set((snapshot?.geometry_entity || []).map((row) => row.entity_id));
|
const geoEntityIds = new Set((snapshot?.geometry_entity || []).map((row) => row.entity_id));
|
||||||
const linkedByWikiIds = new Set(
|
const linkedByWikiIds = new Set(
|
||||||
(snapshot?.entity_wikis || [])
|
(snapshot?.entity_wiki || [])
|
||||||
.filter((l) => l?.operation !== "delete")
|
.filter((l) => l?.operation !== "delete")
|
||||||
.map((l) => l.entity_id)
|
.map((l) => l.entity_id)
|
||||||
);
|
);
|
||||||
@@ -94,7 +94,7 @@ export function useSectionCommands(options: Options) {
|
|||||||
&& e.operation !== "delete"
|
&& e.operation !== "delete"
|
||||||
));
|
));
|
||||||
options.setWikis(snapshot?.wikis || []);
|
options.setWikis(snapshot?.wikis || []);
|
||||||
options.setEntityWikiLinks(snapshot?.entity_wikis || []);
|
options.setEntityWikiLinks(snapshot?.entity_wiki || []);
|
||||||
options.setSelectedFeatureId(null);
|
options.setSelectedFeatureId(null);
|
||||||
options.setEntityFormStatus(null);
|
options.setEntityFormStatus(null);
|
||||||
}, [options]);
|
}, [options]);
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ export function normalizeEditorSnapshot(raw: unknown): EditorSnapshot | null {
|
|||||||
})
|
})
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const entityWikisRaw = snapshot.entity_wikis;
|
const entityWikisRaw = snapshot.entity_wiki ?? snapshot.entity_wikis;
|
||||||
const entityWikis: EntityWikiLinkSnapshot[] | undefined = Array.isArray(entityWikisRaw)
|
const entityWikis: EntityWikiLinkSnapshot[] | undefined = Array.isArray(entityWikisRaw)
|
||||||
? entityWikisRaw
|
? entityWikisRaw
|
||||||
.filter(isRecord)
|
.filter(isRecord)
|
||||||
@@ -186,7 +186,7 @@ export function normalizeEditorSnapshot(raw: unknown): EditorSnapshot | null {
|
|||||||
geometries,
|
geometries,
|
||||||
wikis,
|
wikis,
|
||||||
geometry_entity: geometryEntity || migratedGeometryEntity,
|
geometry_entity: geometryEntity || migratedGeometryEntity,
|
||||||
entity_wikis: entityWikis,
|
entity_wiki: entityWikis,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,7 +406,7 @@ export function buildEditorSnapshot(options: {
|
|||||||
geometries,
|
geometries,
|
||||||
geometry_entity: geometryEntity,
|
geometry_entity: geometryEntity,
|
||||||
wikis,
|
wikis,
|
||||||
entity_wikis: entityWikis,
|
entity_wiki: entityWikis,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export type EditorSnapshot = {
|
|||||||
// Join table geometry ↔ entity (many-to-many).
|
// Join table geometry ↔ entity (many-to-many).
|
||||||
geometry_entity?: GeometryEntitySnapshot[];
|
geometry_entity?: GeometryEntitySnapshot[];
|
||||||
wikis?: WikiSnapshot[];
|
wikis?: WikiSnapshot[];
|
||||||
entity_wikis?: EntityWikiLinkSnapshot[];
|
entity_wiki?: EntityWikiLinkSnapshot[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EditorLoadResponse = {
|
export type EditorLoadResponse = {
|
||||||
|
|||||||
Reference in New Issue
Block a user