fix: entity search endpoint (#2032)

This commit is contained in:
Aaryan Khandelwal
2024-12-26 17:34:17 +05:30
committed by GitHub
parent 34115a932b
commit 87a4f9784d
2 changed files with 13 additions and 7 deletions

View File

@@ -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<ProjectDescriptionInputProps> = 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) => {

View File

@@ -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<TEmbedItem[]> => {
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,