Controllers Documentation
This document provides comprehensive documentation for all controllers in the Yappa Knowledge Hub backend.
Overview
The backend has 8 controllers that handle different aspects of the application:
- KnowledgeController - Main knowledge CRUD with Notion sync
- LocalKnowledgeController - SQLite-only read operations
- CategoryController - Category management with auto-sync
- SummaryController - AI summary management
- NotionSyncController - Manual sync operations
- NotionWebhookController - Notion webhook handling
- DigestController - Digest generation
- NotionDigestController - Notion digest operations
KnowledgeController
Route Prefix: /api/knowledge
Description: Main controller for knowledge item CRUD operations. All operations sync with Notion API.
Dependencies:
NotionKnowledgeService- Notion API operationsNotionCategoryService- Category lookupsNotionSyncService- Dual-storage syncOpenAiService- AI summaries (optional)
KnowledgeController Endpoints
Create a new knowledge item in both SQLite and Notion.
Request Body:
json
{
"title": "How to Deploy Symfony Apps",
"content": "Detailed deployment guide...",
"tags": ["symfony", "deployment", "devops"],
"category": "notion-page-id-here",
"categoryId": "notion-page-id-here",
"targetGroups": ["developers", "devops"],
"status": "Not started",
"url": "https://example.com/article",
"userId": "U12345",
"sourceMessage": {
"ts": "1234567890.123456",
"channel": "C12345"
}
}Response (201 Created):
json
{
"id": "notion-page-id",
"notionId": "notion-page-id",
"notionUrl": "https://notion.so/...",
"title": "How to Deploy Symfony Apps",
"content": "Detailed deployment guide...",
"tags": ["symfony", "deployment", "devops"],
"targetGroups": ["developers", "devops"],
"status": "Not started",
"sourceUrl": "https://example.com/article",
"aiSummary": "",
"created": "2026-02-19T10:30:00.000Z",
"lastEdited": "2026-02-19T10:30:00.000Z",
"categoryId": ["notion-page-id-here"]
}Notes:
- If
targetGroupsis not provided, it inherits from the category's default target groups - Accepts
category,category_id, orcategoryId(all map to the same field) - Creates in both SQLite and Notion for dual persistence
GET /api/knowledge
List all knowledge items or search/filter.
Query Parameters:
search(string, optional) - Full-text search querycategory(string, optional) - Filter by category ID
Examples:
bash
# List all
GET /api/knowledge
# Search
GET /api/knowledge?search=symfony
# Filter by category
GET /api/knowledge?category=notion-category-idResponse (200 OK):
json