refactor: 产品页与产品列表的API重构
- 将产品页与产品列表的API由REST重构为GraphQL - 修改Mapper与单元测试
This commit is contained in:
66
app/graphql/product.graphql
Normal file
66
app/graphql/product.graphql
Normal file
@ -0,0 +1,66 @@
|
||||
query GetProduct($id: ID!, $locale: String!) {
|
||||
products_by_id(id: $id) {
|
||||
id
|
||||
status
|
||||
translations(filter: { languages_code: { code: { _eq: $locale } } }) {
|
||||
id
|
||||
name
|
||||
summary
|
||||
description
|
||||
}
|
||||
images {
|
||||
id
|
||||
product_images_id {
|
||||
id
|
||||
image {
|
||||
id
|
||||
}
|
||||
translations(filter: { languages_code: { code: { _eq: $locale } } }) {
|
||||
id
|
||||
caption
|
||||
}
|
||||
}
|
||||
}
|
||||
specs {
|
||||
id
|
||||
translations(filter: { languages_code: { code: { _eq: $locale } } }) {
|
||||
id
|
||||
name
|
||||
}
|
||||
specs {
|
||||
translations(filter: { languages_code: { code: { _eq: $locale } } }) {
|
||||
id
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
faqs {
|
||||
id
|
||||
questions_id {
|
||||
id
|
||||
translations(filter: { languages_code: { code: { _eq: $locale } } }) {
|
||||
id
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
documents {
|
||||
id
|
||||
product_documents_id {
|
||||
id
|
||||
file {
|
||||
id
|
||||
filesize
|
||||
filename_download
|
||||
}
|
||||
translations(filter: { languages_code: { code: { _eq: $locale } } }) {
|
||||
id
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user