Amazon dynamodb AWS AppSync-为缺少自定义类型和枚举的架构创建资源
我知道枚举不是Dynamo中的标准类型: 然而,这里的确切解决方案是什么? 我们应该如何恰当地表示与生成代码的关系 --是我遗漏了什么,还是生成的代码正确,我们需要在dynamo表中创建一些自定义字段,然后重写查询 例如:Amazon dynamodb AWS AppSync-为缺少自定义类型和枚举的架构创建资源,amazon-dynamodb,graphql,aws-appsync,Amazon Dynamodb,Graphql,Aws Appsync,我知道枚举不是Dynamo中的标准类型: 然而,这里的确切解决方案是什么? 我们应该如何恰当地表示与生成代码的关系 --是我遗漏了什么,还是生成的代码正确,我们需要在dynamo表中创建一些自定义字段,然后重写查询 例如: type Competition { id: ID! name: String! creator: UserProfile! startDate: String! endDate: String! competitionType: Competitio
type Competition {
id: ID!
name: String!
creator: UserProfile!
startDate: String!
endDate: String!
competitionType: CompetitionType!
competitors: [UserProfile]!
prize: Prize!
}
竞赛由用户创建,有类型、奖项和竞争者。当为此表创建资源时
,代码显然缺少从自定义类型或枚举派生的任何信息。复杂的模式总是有这种类型的结构,所以我对输出的代码和正确的方向有点困惑
extend type Mutation {
createCompetition(input: CreateCompetitionInput!): Competition
}
input CreateCompetitionInput {
id: ID!
name: String!
startDate: String!
endDate: String!
## Missing info
}
当AppSync自动生成模式时,它会跳过这些模式,因为这些模式将通过其他解析程序手动添加。您可以定义一个附加到每个自定义或枚举字段的新查询,但是您所引用的数据需要加盖竞争对手独有的标记,以便可以根据此类型对其进行查询(因为dynamoDB不是关系数据库) 创建新竞争对手时,您需要使用该竞争对手独有的内容更新子字段。也就是说,需要作为竞争对手跟踪的每个用户配置文件都会加盖此竞争ID的印章。每个自定义字段的变化需要单独处理 这篇文章帮助我解决了同样的问题: