Describe the content issue:
I tried to describe CartItem data model and update the CartItem but it was hard to get an example to update properties where there is hash and sort key. Most of the example or search or chatgpt solutions only provide gen1 examples . The below code was generated by chat gpt, but i could not correct it as there is lack of complex examples everywhere. Manytimes, i had to trial and error or rely on chatgpt to provide the code but sometimes even that fails. Please add tons of example snippets for variety of scenarios and it wont cost AWS anything ,but it is very hepful for coders who are new to gen2 amplify .
Describe the content issue: I tried to describe CartItem data model and update the CartItem but it was hard to get an example to update properties where there is hash and sort key. Most of the example or search or chatgpt solutions only provide gen1 examples . The below code was generated by chat gpt, but i could not correct it as there is lack of complex examples everywhere. Manytimes, i had to trial and error or rely on chatgpt to provide the code but sometimes even that fails. Please add tons of example snippets for variety of scenarios and it wont cost AWS anything ,but it is very hepful for coders who are new to gen2 amplify .
await client.models.CartItem.update({ userId: userId, lineItemId: lineItemId, // Composite key { quantity: quantity, total: quantity * cartItems.find((item) => item.id.lineItemId === lineItemId)?.price ?? 0 }, });
URL page where content issue is: