feat: add knowledge version history (closes #75, closes #76)

- Added EntryVersion model with author relation
- Implemented automatic versioning on entry create/update
- Added API endpoints for version history:
  - GET /api/knowledge/entries/:slug/versions - list versions
  - GET /api/knowledge/entries/:slug/versions/:version - get specific
  - POST /api/knowledge/entries/:slug/restore/:version - restore version
- Created VersionHistory.tsx component with timeline view
- Added History tab to entry detail page
- Supports version viewing and restoring
- Includes comprehensive tests for version operations
- All TypeScript types are explicit and type-safe
This commit is contained in:
Jason Woltje
2026-01-29 23:27:03 -06:00
parent 59aec28d5c
commit 7465d0a3c2
14 changed files with 2450 additions and 24 deletions

View File

@@ -3,6 +3,7 @@ export { UpdateEntryDto } from "./update-entry.dto";
export { EntryQueryDto } from "./entry-query.dto";
export { CreateTagDto } from "./create-tag.dto";
export { UpdateTagDto } from "./update-tag.dto";
export { RestoreVersionDto } from "./restore-version.dto";
export {
SearchQueryDto,
TagSearchDto,

View File

@@ -0,0 +1,15 @@
import {
IsString,
IsOptional,
MaxLength,
} from "class-validator";
/**
* DTO for restoring a previous version of a knowledge entry
*/
export class RestoreVersionDto {
@IsOptional()
@IsString({ message: "changeNote must be a string" })
@MaxLength(500, { message: "changeNote must not exceed 500 characters" })
changeNote?: string;
}