feat(kb): publish lifecycle, slug uniqueness, version restore, trigram search, feedback, portal feed (PMS-79) #78
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/pms-79-kb"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements PMS-79. published_at stamped on draft->published; per-tenant unique slugs (app 409 + DB constraints, migration 026); POST .../versions/{n}/restore; pg_trgm word-similarity search (index-backed) replacing ILIKE; helpful/not_helpful endpoints; portal KB feed scoped to the contact's company (public or client_specific). tests/knowledge_base.rs 9/9. clippy -D warnings clean. Migration numbered 026 to avoid colliding with contracts' 025.
PMS-79: implement the knowledge-base working components on top of the existing CRUD + versioning. published_at is stamped on the draft->published transition (create-as-published and update) and left immutable afterward. Category and article slugs are unique per tenant (application-layer 409 plus DB UNIQUE constraints in migration 026). A new POST /api/v1/kb/articles/{id}/versions/{n}/restore copies a prior kb_article_versions snapshot back into the article as a new monotonic version. Full-text search now uses pg_trgm word-similarity against the existing GIN index (index-backed, ranked) instead of ILIKE. helpful / not_helpful endpoints increment the article tallies. The portal KB feed (previously an empty stub) returns published articles that are public, or client_specific scoped to the calling contact's company_id (from the portal JWT), so a contact never sees another company's articles. Integration tests in tests/knowledge_base.rs cover create -> publish (published_at) -> edit (new version) -> restore, trigram fuzzy match, duplicate-slug rejection, feedback increments, and portal company scoping. Migration numbered 026 to avoid colliding with the contracts story's 025. #PMS-79 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>