feat(knowledge): add tag management API (KNOW-003)
- Add Tag DTOs (CreateTagDto, UpdateTagDto) with validation - Implement TagsService with CRUD operations - Add TagsController with authenticated endpoints - Support automatic slug generation from tag names - Add workspace isolation for tags - Include entry count in tag responses - Add findOrCreateTags method for entry creation/update - Implement comprehensive test coverage (29 tests passing) Endpoints: - GET /api/knowledge/tags - List workspace tags - POST /api/knowledge/tags - Create tag - GET /api/knowledge/tags/:slug - Get tag by slug - PUT /api/knowledge/tags/:slug - Update tag - DELETE /api/knowledge/tags/:slug - Delete tag - GET /api/knowledge/tags/:slug/entries - List entries with tag Related: KNOW-003
This commit is contained in:
46
apps/api/src/knowledge/entities/knowledge-entry.entity.ts
Normal file
46
apps/api/src/knowledge/entities/knowledge-entry.entity.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { EntryStatus, Visibility } from "@prisma/client";
|
||||
|
||||
/**
|
||||
* Knowledge Entry entity
|
||||
* Represents a knowledge base document/page
|
||||
*/
|
||||
export interface KnowledgeEntryEntity {
|
||||
id: string;
|
||||
workspaceId: string;
|
||||
slug: string;
|
||||
title: string;
|
||||
content: string;
|
||||
contentHtml: string | null;
|
||||
summary: string | null;
|
||||
status: EntryStatus;
|
||||
visibility: Visibility;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
createdBy: string;
|
||||
updatedBy: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extended knowledge entry with tag information
|
||||
*/
|
||||
export interface KnowledgeEntryWithTags extends KnowledgeEntryEntity {
|
||||
tags: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
color: string | null;
|
||||
}>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paginated list response
|
||||
*/
|
||||
export interface PaginatedEntries {
|
||||
data: KnowledgeEntryWithTags[];
|
||||
pagination: {
|
||||
page: number;
|
||||
limit: number;
|
||||
total: number;
|
||||
totalPages: number;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user