fix: code review cleanup
- Added missing API functions: fetchKnowledgeStats, fetchEntryGraph - Exported StatsDashboard and EntryGraphViewer components - Replaced 'any' types with proper TypeScript types: * AuthUser for @CurrentUser parameters * Prisma.KnowledgeEntryWhereInput for where clauses * Prisma.KnowledgeEntryUpdateInput for update data * Prisma.TransactionClient for transaction parameters - All TypeScript checks passing - XSS protection verified in WikiLinkRenderer (escapeHtml function) - Wiki-link parsing properly handles code blocks and escaping
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
ParseIntPipe,
|
||||
DefaultValuePipe,
|
||||
} from "@nestjs/common";
|
||||
import type { AuthUser } from "@mosaic/shared";
|
||||
import { KnowledgeService } from "./knowledge.service";
|
||||
import { CreateEntryDto, UpdateEntryDto, EntryQueryDto, RestoreVersionDto } from "./dto";
|
||||
import { AuthGuard } from "../auth/guards/auth.guard";
|
||||
@@ -69,7 +70,7 @@ export class KnowledgeController {
|
||||
@RequirePermission(Permission.WORKSPACE_MEMBER)
|
||||
async create(
|
||||
@Workspace() workspaceId: string,
|
||||
@CurrentUser() user: any,
|
||||
@CurrentUser() user: AuthUser,
|
||||
@Body() createDto: CreateEntryDto
|
||||
) {
|
||||
return this.knowledgeService.create(workspaceId, user.id, createDto);
|
||||
@@ -85,7 +86,7 @@ export class KnowledgeController {
|
||||
async update(
|
||||
@Workspace() workspaceId: string,
|
||||
@Param("slug") slug: string,
|
||||
@CurrentUser() user: any,
|
||||
@CurrentUser() user: AuthUser,
|
||||
@Body() updateDto: UpdateEntryDto
|
||||
) {
|
||||
return this.knowledgeService.update(workspaceId, slug, user.id, updateDto);
|
||||
@@ -101,7 +102,7 @@ export class KnowledgeController {
|
||||
async remove(
|
||||
@Workspace() workspaceId: string,
|
||||
@Param("slug") slug: string,
|
||||
@CurrentUser() user: any
|
||||
@CurrentUser() user: AuthUser
|
||||
) {
|
||||
await this.knowledgeService.remove(workspaceId, slug, user.id);
|
||||
return { message: "Entry archived successfully" };
|
||||
@@ -177,7 +178,7 @@ export class KnowledgeController {
|
||||
@Workspace() workspaceId: string,
|
||||
@Param("slug") slug: string,
|
||||
@Param("version", ParseIntPipe) version: number,
|
||||
@CurrentUser() user: any,
|
||||
@CurrentUser() user: AuthUser,
|
||||
@Body() restoreDto: RestoreVersionDto
|
||||
) {
|
||||
return this.knowledgeService.restoreVersion(
|
||||
|
||||
Reference in New Issue
Block a user