From 87a4f9784d7cc7d0df68ca0f747eb90e1ec92bee Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Thu, 26 Dec 2024 17:34:17 +0530 Subject: [PATCH] fix: entity search endpoint (#2032) --- .../details/header/description-input.tsx | 13 +++++++++---- web/ee/hooks/use-issue-embed.tsx | 7 ++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/web/ee/components/project-overview/details/header/description-input.tsx b/web/ee/components/project-overview/details/header/description-input.tsx index 8449c6fab6..84513f50d5 100644 --- a/web/ee/components/project-overview/details/header/description-input.tsx +++ b/web/ee/components/project-overview/details/header/description-input.tsx @@ -13,12 +13,14 @@ import { RichTextEditor, RichTextReadOnlyEditor } from "@/components/editor"; import { getDescriptionPlaceholder } from "@/helpers/issue.helper"; // hooks import { useWorkspace } from "@/hooks/store"; -// services +// plane web services +import { WorkspaceService } from "@/plane-web/services/workspace.service"; +// plane web types import { TProject } from "@/plane-web/types"; +// services import { FileService } from "@/services/file.service"; -import { ProjectService } from "@/services/project"; const fileService = new FileService(); -const projectService = new ProjectService(); +const workspaceService = new WorkspaceService(); export type ProjectDescriptionInputProps = { containerClassName?: string; @@ -98,7 +100,10 @@ export const ProjectDescriptionInput: FC = observe workspaceId={workspaceId} projectId={project.id} searchMentionCallback={async (payload) => - await projectService.searchEntity(workspaceSlug?.toString() ?? "", project.id, payload) + await workspaceService.searchEntity(workspaceSlug?.toString() ?? "", { + ...payload, + project_id: project.id, + }) } dragDropEnabled onChange={(_description: object, description_html: string) => { diff --git a/web/ee/hooks/use-issue-embed.tsx b/web/ee/hooks/use-issue-embed.tsx index da42e778f9..30fe4858a0 100644 --- a/web/ee/hooks/use-issue-embed.tsx +++ b/web/ee/hooks/use-issue-embed.tsx @@ -7,18 +7,19 @@ import { IssueEmbedCard, IssueEmbedUpgradeCard } from "@/plane-web/components/pa // plane web hooks import { useFlag } from "@/plane-web/hooks/store/use-flag"; // services -import { ProjectService } from "@/services/project"; -const projectService = new ProjectService(); +import { WorkspaceService } from "@/plane-web/services/workspace.service"; +const workspaceService = new WorkspaceService(); export const useIssueEmbed = (workspaceSlug: string, projectId: string) => { // store hooks const isIssueEmbedEnabled = useFlag(workspaceSlug, "PAGE_ISSUE_EMBEDS"); const fetchIssues = async (searchQuery: string): Promise => { - const response = await projectService.searchEntity(workspaceSlug, projectId, { + const response = await workspaceService.searchEntity(workspaceSlug, { query_type: ["issue"], query: searchQuery, count: 10, + project_id: projectId, }); const structuredIssues: TEmbedItem[] = (response.issue ?? []).map((issue) => ({ id: issue.id,