feat: add knowledge graph views and stats (closes #73, closes #74)

Issue #73 - Entry-Centered Graph View:
- Added GET /api/knowledge/entries/:id/graph endpoint with depth parameter
- Returns entry + connected nodes with link relationships
- Created GraphService for graph traversal using BFS
- Added EntryGraphViewer component for frontend
- Integrated graph view tab into entry detail page

Issue #74 - Graph Statistics Dashboard:
- Added GET /api/knowledge/stats endpoint
- Returns overview stats (entries, tags, links by status)
- Includes most connected entries, recent activity, tag distribution
- Created StatsDashboard component with visual stats
- Added route at /knowledge/stats

Backend:
- GraphService: BFS-based graph traversal with configurable depth
- StatsService: Parallel queries for comprehensive statistics
- GraphQueryDto: Validation for depth parameter (1-5)
- Entity types for graph nodes/edges and statistics
- Unit tests for both services

Frontend:
- EntryGraphViewer: Entry-centered graph visualization
- StatsDashboard: Statistics overview with charts
- Graph view tab on entry detail page
- API client functions for new endpoints
- TypeScript strict typing throughout
This commit is contained in:
Jason Woltje
2026-01-29 23:25:29 -06:00
parent 59aec28d5c
commit 26a334c677
18 changed files with 1351 additions and 12 deletions

View File

@@ -128,6 +128,22 @@ export async function fetchTags(): Promise<KnowledgeTag[]> {
return response.data;
}
/**
* Fetch entry-centered graph view
*/
export async function fetchEntryGraph(slug: string, depth: number = 1) {
const params = new URLSearchParams();
params.append("depth", depth.toString());
return apiGet(`/api/knowledge/entries/${slug}/graph?${params.toString()}`);
}
/**
* Fetch knowledge base statistics
*/
export async function fetchKnowledgeStats() {
return apiGet("/api/knowledge/stats");
}
/**
* Mock entries for development (until backend endpoints are ready)
*/