Add support for search results for posts

Extended the search functionality to include results for posts. Updated `SearchResultsType` and related types to handle `posts`, adding a new `SearchPostsResultsType` with `uuid`, `name`, and `slug`. Adjusted mutations to populate posts in the search response.
This commit is contained in:
Egor Pavlovich Gorbunov 2025-05-07 15:57:10 +03:00
parent 80e1b0335b
commit 0cb4ae42a4
2 changed files with 11 additions and 0 deletions

View file

@ -493,5 +493,6 @@ class Search(BaseMutation):
products=data["products"], products=data["products"],
categories=data["categories"], categories=data["categories"],
brands=data["brands"], brands=data["brands"],
posts=data["posts"],
) )
) )

View file

@ -454,19 +454,29 @@ class LanguageType(ObjectType):
class SearchProductsResultsType(ObjectType): class SearchProductsResultsType(ObjectType):
uuid = UUID() uuid = UUID()
name = String() name = String()
slug = String()
class SearchCategoriesResultsType(ObjectType): class SearchCategoriesResultsType(ObjectType):
uuid = UUID() uuid = UUID()
name = String() name = String()
slug = String()
class SearchBrandsResultsType(ObjectType): class SearchBrandsResultsType(ObjectType):
uuid = UUID() uuid = UUID()
name = String() name = String()
slug = String()
class SearchPostsResultsType(ObjectType):
uuid = UUID()
name = String()
slug = String()
class SearchResultsType(ObjectType): class SearchResultsType(ObjectType):
products = List(description=_("products search results"), of_type=SearchProductsResultsType) products = List(description=_("products search results"), of_type=SearchProductsResultsType)
categories = List(description=_("products search results"), of_type=SearchCategoriesResultsType) categories = List(description=_("products search results"), of_type=SearchCategoriesResultsType)
brands = List(description=_("products search results"), of_type=SearchBrandsResultsType) brands = List(description=_("products search results"), of_type=SearchBrandsResultsType)
posts = List(description=_("posts search results"), of_type=SearchPostsResultsType)