【发布时间】:2021-10-08 17:19:57
【问题描述】:
我有一个类似 AWS 的小型 graphQL 结构,但是当我尝试推送它时会抛出一个错误提示
✖将资源推送到云端时出错
@connection 必须在 @model 对象类型字段上。
请帮助了解我在哪里犯了错误。
有没有 VS 代码扩展来调试这个?
type Store {
id: ID!
products: [Product] @connection(name: "StoreProducts")
}
type Product @model @searchable {
id: ID!
name: String!
description: String!
price: Float!
isOnCourse: Boolean!
isOnOutlet: Boolean!
store: Store @connection(name: "StoreProducts", sortField: "crearedAt")
file: S3Object!
}
type S3Object {
bucket: String!
region: String!
key: String!
}
type User
@model(
queries: { get: "getUser" }
mutations: { create: "registredUser", update: "updateUser" }
subscriptions: null
) {
id: ID!
username: String!
email: String!
phoneNumber: String!
registred: Boolean
orders: [Order] @connection(name: "UserOrders", sortField: "createdAt")
}
type Order
@model(
queries: null
mutations: { create: "createOrder" }
subscriptions: null
) {
id: ID!
product: Product @connection
user: User @connection(name: "UserOrders")
orderLocation: OrderLocation
crearedAt: String
}
type OrderLocation {
tableNumber: String
qrData: String
holeNumber: String
}
【问题讨论】:
标签: amazon-web-services graphql aws-amplify