From 856b7a20e934d2bb61c8f0d6acfdc6f4349f02ef Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Thu, 29 Jan 2026 20:58:33 -0600 Subject: [PATCH] fix: address code review feedback - Add explicit return types to all SearchController methods - Import necessary types (PaginatedSearchResults, PaginatedEntries) - Define RecentEntriesResponse interface for type safety - Ensures compliance with TypeScript strict typing standards --- apps/api/src/knowledge/search.controller.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/api/src/knowledge/search.controller.ts b/apps/api/src/knowledge/search.controller.ts index 5d3f7b0..41ba4e9 100644 --- a/apps/api/src/knowledge/search.controller.ts +++ b/apps/api/src/knowledge/search.controller.ts @@ -1,9 +1,21 @@ import { Controller, Get, Query, UseGuards } from "@nestjs/common"; -import { SearchService } from "./services/search.service"; +import { SearchService, PaginatedSearchResults } from "./services/search.service"; import { SearchQueryDto, TagSearchDto, RecentEntriesDto } from "./dto"; import { AuthGuard } from "../auth/guards/auth.guard"; import { WorkspaceGuard, PermissionGuard } from "../common/guards"; import { Workspace, Permission, RequirePermission } from "../common/decorators"; +import type { + PaginatedEntries, + KnowledgeEntryWithTags, +} from "./entities/knowledge-entry.entity"; + +/** + * Response for recent entries endpoint + */ +interface RecentEntriesResponse { + data: KnowledgeEntryWithTags[]; + count: number; +} /** * Controller for knowledge search endpoints @@ -30,7 +42,7 @@ export class SearchController { async search( @Workspace() workspaceId: string, @Query() query: SearchQueryDto - ) { + ): Promise { return this.searchService.search(query.q, workspaceId, { status: query.status, page: query.page, @@ -53,7 +65,7 @@ export class SearchController { async searchByTags( @Workspace() workspaceId: string, @Query() query: TagSearchDto - ) { + ): Promise { return this.searchService.searchByTags(query.tags, workspaceId, { status: query.status, page: query.page, @@ -74,7 +86,7 @@ export class SearchController { async recentEntries( @Workspace() workspaceId: string, @Query() query: RecentEntriesDto - ) { + ): Promise { const entries = await this.searchService.recentEntries( workspaceId, query.limit || 10,