feat(kb): publish lifecycle, slug uniqueness, version restore, trigram search, feedback, portal feed (PMS-79) #78

Merged
vas2000-work merged 2 commits from feat/pms-79-kb into main 2026-06-05 04:13:49 +02:00
Owner

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.

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.
feat(kb): publish lifecycle, slug uniqueness, version restore, trigram search, feedback, portal feed (PMS-79)
Some checks failed
Build OCI container / Build and push mokosh-api image (push) Has been cancelled
Check / fmt + clippy + compile + tests (pull_request) Has been cancelled
dbf8c914f5
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>
Merge branch 'main' into feat/pms-79-kb
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / fmt + clippy + compile + tests (pull_request) Successful in 1m30s
Build OCI container / Build and push mokosh-api image (push) Successful in 7m34s
89fd6fdec6
vas2000-work deleted branch feat/pms-79-kb 2026-06-05 04:13:49 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!78
No description provided.