in workshop-2/app/monolith-service/service/mysfitsTableClient.py [0:0]
def likeMysfit(mysfitId):
# Use the DynamoDB API UpdateItem to increment the number of Likes
# the mysfit has by 1 using an UpdateExpression.
response = client.update_item(
TableName=table_name,
Key={
'MysfitId': {
'S': mysfitId
}
},
UpdateExpression="SET Likes = Likes + :n",
ExpressionAttributeValues={':n': {'N': '1'}}
)
response = {}
response["Update"] = "Success";
return json.dumps(response)