/
service.go
47 lines (39 loc) · 1.92 KB
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package graphql
import (
// embed schema.graphql
_ "embed"
"flamingo.me/graphql"
"flamingo.me/flamingo-commerce/v3/search/application"
"flamingo.me/flamingo-commerce/v3/search/domain"
"flamingo.me/flamingo-commerce/v3/search/interfaces/graphql/searchdto"
)
// Service is the Graphql-Service of this module
type Service struct{}
var _ graphql.Service = new(Service)
//go:embed schema.graphql
var schema []byte
// Schema returns graphql schema of this module
func (*Service) Schema() []byte {
return schema
}
// Types configures the GraphQL to Go resolvers
func (*Service) Types(types *graphql.Types) {
types.Map("Commerce_Search_Meta", domain.SearchMeta{})
types.Resolve("Commerce_Search_Meta", "sortOptions", CommerceSearchQueryResolver{}, "SortOptions")
types.Map("Commerce_Search_Request", searchdto.CommerceSearchRequest{})
types.Map("Commerce_Search_KeyValueFilter", searchdto.CommerceSearchKeyValueFilter{})
types.Map("Commerce_Search_Suggestion", domain.Suggestion{})
types.Map("Commerce_Search_Action", domain.Action{})
types.Map("Commerce_Search_Result", application.SearchResult{})
types.Map("Commerce_Search_SortOption", searchdto.CommerceSearchSortOption{})
types.Map("Commerce_Search_Facet", new(searchdto.CommerceSearchFacet))
types.Map("Commerce_Search_ListFacet", searchdto.CommerceSearchListFacet{})
types.Map("Commerce_Search_TreeFacet", searchdto.CommerceSearchTreeFacet{})
types.Map("Commerce_Search_RangeFacet", searchdto.CommerceSearchRangeFacet{})
types.Map("Commerce_Search_FacetItem", new(searchdto.CommerceSearchFacetItem))
types.Map("Commerce_Search_ListFacetItem", searchdto.CommerceSearchListFacetItem{})
types.Map("Commerce_Search_TreeFacetItem", searchdto.CommerceSearchTreeFacetItem{})
types.Map("Commerce_Search_RangeFacetItem", searchdto.CommerceSearchRangeFacetItem{})
types.Map("Commerce_Search_Promotion", searchdto.PromotionDTO{})
types.Map("Commerce_Search_PromotionMedia", domain.Media{})
}