Skip to content

feat(api): knowledge base + /api/kb read endpoints#84

Merged
mpge merged 1 commit into
mainfrom
feat/api-kb
Jun 26, 2026
Merged

feat(api): knowledge base + /api/kb read endpoints#84
mpge merged 1 commit into
mainfrom
feat/api-kb

Conversation

@mpge

@mpge mpge commented Jun 26, 2026

Copy link
Copy Markdown
Member

Builds the knowledge base for Go (it was a placeholder — a model struct with no table or queries) and exposes it over the general JSON API. Resolves the divergent widget-oriented Article stub by adopting the canonical cross-backend schema.

What

  • Models — reshape Article to canonical (status draft/published, helpful_count/not_helpful_count, published_at, category_id, slug, body) + new ArticleCategory (nestable).
  • Migrations — create articles + article_categories (with unique-slug, status, category indexes) in the inline migrate path the library actually runs.
  • /api/kb endpoints (published only): GET /articles (optional ?search + ?category), GET /categories, GET /articles/{slug} (records a view). Registered in both routers.

Verification

  • go build ./... clean; golangci-lint run0 issues.
  • New handlers/kb_test.go (real SQLite + migrations) — list returns published only, show increments views + 404s drafts/unknown, categories ordered by position.
  • migrations test still green (KB tables created by MigrateSQLite).
  • Full go test ./... passes.

Build the knowledge base for Go (previously a placeholder model with no
table or queries). Reshape the Article model to the canonical cross-backend
schema (status draft/published, helpful_count/not_helpful_count,
published_at, category) and add an ArticleCategory model. Create the
articles + article_categories tables in the inline migrate path.

Add public read endpoints to the general JSON API: GET /api/kb/articles
(published, optional search + category filter), GET /api/kb/categories, and
GET /api/kb/articles/{slug} (published lookup that records a view). Routes
registered in both routers. Resolves the divergent widget-oriented Article
stub.
@mpge mpge merged commit 9e11fd1 into main Jun 26, 2026
2 checks passed
@mpge mpge deleted the feat/api-kb branch June 26, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant