Slide 30
Slide 30 text
開発の流れ
1. schema.graphqlにデータ構造を定義
▪ nullable or non-nullable
▪ 他テーブルとのrelation
2. amplify mock
▪ 内部ではamplify codegenが実行
▪ API.ts(型定義)とqueries.ts, mutation.ts,
subscription.tsが生成
3. 型定義に沿ってquery/mutationを実行
type Project @model {
id: ID!
name: String
team: Team @hasOne
}
type Team @model {
id: ID!
name: String!
}
const project = { name: “New project", team: “uuidv4" };
await API.graphql(graphqlOperation(createProject, {input: project}));