feat: add markdown import/export (closes #77, #78)

- Add POST /api/knowledge/import endpoint for .md and .zip files
- Add GET /api/knowledge/export endpoint with markdown/json formats
- Import parses frontmatter (title, tags, status, visibility)
- Export includes frontmatter in markdown format
- Add ImportExportActions component with drag-and-drop UI
- Add import progress dialog with success/error summary
- Add export dropdown with format selection
- Include comprehensive test suite
- Support bulk import with detailed error reporting
This commit is contained in:
Jason Woltje
2026-01-30 00:05:15 -06:00
parent 806a518467
commit c4c15ee87e
12 changed files with 1224 additions and 15 deletions

View File

@@ -0,0 +1,52 @@
import {
IsString,
IsOptional,
IsEnum,
IsArray,
ArrayMinSize,
} from "class-validator";
/**
* Export format enum
*/
export enum ExportFormat {
MARKDOWN = "markdown",
JSON = "json",
}
/**
* DTO for export query parameters
*/
export class ExportQueryDto {
@IsOptional()
@IsEnum(ExportFormat, { message: "format must be either 'markdown' or 'json'" })
format?: ExportFormat = ExportFormat.MARKDOWN;
@IsOptional()
@IsArray({ message: "entryIds must be an array" })
@IsString({ each: true, message: "each entryId must be a string" })
entryIds?: string[];
}
/**
* Import result for a single entry
*/
export interface ImportResult {
filename: string;
success: boolean;
entryId?: string;
slug?: string;
title?: string;
error?: string;
}
/**
* Response DTO for import operation
*/
export interface ImportResponseDto {
success: boolean;
totalFiles: number;
imported: number;
failed: number;
results: ImportResult[];
}

View File

@@ -10,3 +10,9 @@ export {
RecentEntriesDto,
} from "./search-query.dto";
export { GraphQueryDto } from "./graph-query.dto";
export {
ExportQueryDto,
ExportFormat,
ImportResult,
ImportResponseDto,
} from "./import-export.dto";