Wiki Phase 4: full-text search + revision history
Final phase of the wiki upgrade (see WIKI_UPGRADE.md). Schema (additive): wiki_revisions table (per-save content snapshots). The FULLTEXT index on wiki_pages(title, body) shipped in Phase 1. Search: - MATCH ... AGAINST natural-language search over title + body, ordered by relevance - public: GET /public/wiki?q= (published only); admin: GET /admin/wiki?q= (all statuses) - public wiki index gains a search box; admin list gains a search field Revision history: - every create/update snapshots the page into wiki_revisions - admin endpoints: list revisions, get one, and restore (restore overwrites the page, rebuilds links, and appends a new revision — history stays append-only); logged as wiki.revision.restore - editor gains a History modal: revision list + word-level diff (jsdiff) of a chosen revision against the current page, with one-click restore Verified end-to-end: search matches body and title; two edits produce three revisions; diff renders added/removed words; restore reverts and records a new revision. No console errors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,7 @@ export const api = {
|
||||
const qs = new URLSearchParams()
|
||||
if (opts.category) qs.set('category', opts.category)
|
||||
if (opts.tag) qs.set('tag', opts.tag)
|
||||
if (opts.q) qs.set('q', opts.q)
|
||||
const s = qs.toString()
|
||||
return req(`/public/wiki${s ? `?${s}` : ''}`)
|
||||
},
|
||||
@@ -90,6 +91,10 @@ export const api = {
|
||||
publishWiki: (slug, published) =>
|
||||
req(`/admin/wiki/${slug}/publish`, { method: 'PATCH', body: { published } }),
|
||||
deleteWiki: (slug) => req(`/admin/wiki/${slug}`, { method: 'DELETE' }),
|
||||
listWikiRevisions: (slug) => req(`/admin/wiki/${slug}/revisions`),
|
||||
getWikiRevision: (slug, id) => req(`/admin/wiki/${slug}/revisions/${id}`),
|
||||
restoreWikiRevision: (slug, id) =>
|
||||
req(`/admin/wiki/${slug}/revisions/${id}/restore`, { method: 'POST' }),
|
||||
listWikiTags: () => req('/admin/wiki/tags'),
|
||||
listWikiCategories: () => req('/admin/wiki/categories'),
|
||||
createWikiCategory: (data) => req('/admin/wiki/categories', { method: 'POST', body: data }),
|
||||
|
||||
Reference in New Issue
Block a user