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,