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:
48
apps/api/src/knowledge/dto/update-entry.dto.ts
Normal file
48
apps/api/src/knowledge/dto/update-entry.dto.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import {
|
||||
IsString,
|
||||
IsOptional,
|
||||
IsEnum,
|
||||
IsArray,
|
||||
MinLength,
|
||||
MaxLength,
|
||||
} from "class-validator";
|
||||
import { EntryStatus, Visibility } from "@prisma/client";
|
||||
|
||||
/**
|
||||
* DTO for updating a knowledge entry
|
||||
*/
|
||||
export class UpdateEntryDto {
|
||||
@IsOptional()
|
||||
@IsString({ message: "title must be a string" })
|
||||
@MinLength(1, { message: "title must not be empty" })
|
||||
@MaxLength(500, { message: "title must not exceed 500 characters" })
|
||||
title?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString({ message: "content must be a string" })
|
||||
@MinLength(1, { message: "content must not be empty" })
|
||||
content?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString({ message: "summary must be a string" })
|
||||
@MaxLength(1000, { message: "summary must not exceed 1000 characters" })
|
||||
summary?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(EntryStatus, { message: "status must be a valid EntryStatus" })
|
||||
status?: EntryStatus;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(Visibility, { message: "visibility must be a valid Visibility" })
|
||||
visibility?: Visibility;
|
||||
|
||||
@IsOptional()
|
||||
@IsArray({ message: "tags must be an array" })
|
||||
@IsString({ each: true, message: "each tag must be a string" })
|
||||
tags?: string[];
|
||||
|
||||
@IsOptional()
|
||||
@IsString({ message: "changeNote must be a string" })
|
||||
@MaxLength(500, { message: "changeNote must not exceed 500 characters" })
|
||||
changeNote?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user