feat(db): add wiki-link extraction, resolution, and backlinks
CI / test (pull_request) Successful in 2m27s
CI / test (pull_request) Successful in 2m27s
[[wiki-links]] in entry bodies are extracted at save time, resolved to entity IDs (title match first, body substring fallback), and stored in entity_links junction table. Backlinks surface in TUI detail view showing entries that link to the current entry. Schema migration v5 adds entity_links with CASCADE/SET NULL semantics. Links sync on Create, Update, and Absorb.
This commit is contained in:
@@ -287,6 +287,12 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
m.detail.mode = detailPreview
|
||||
return m, tea.Batch(loadEntities(m.store, m.listParams()), m.setStatus("copied resolved"))
|
||||
|
||||
case backlinksLoadedMsg:
|
||||
if m.detail.entity != nil {
|
||||
m.detail.backlinks = msg.backlinks
|
||||
}
|
||||
return m, nil
|
||||
|
||||
case tagsLoadedMsg:
|
||||
m.filter.setTags(msg.tags)
|
||||
m.tagRail.setTags(msg.tags)
|
||||
@@ -865,6 +871,7 @@ func (m model) updateBrowse(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
} else {
|
||||
m.state = stateDetail
|
||||
}
|
||||
return m, loadBacklinks(m.store, e.ID)
|
||||
}
|
||||
}
|
||||
return m, nil
|
||||
@@ -1212,6 +1219,7 @@ func (m model) selectedEntity() *db.Entity {
|
||||
func (m model) reloadDetail(id string) tea.Cmd {
|
||||
return tea.Batch(
|
||||
loadEntities(m.store, m.listParams()),
|
||||
loadBacklinks(m.store, id),
|
||||
func() tea.Msg {
|
||||
e, err := m.store.Get(context.Background(), id)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user