Skip to content

Commit

Permalink
FIX: setting a field UUID if required during validate
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael O'Brien committed Feb 10, 2021
1 parent 0ae2357 commit 5961408
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ OneTable is not opinionated as much as possible and provides hooks for you to cu

After watching the famous [Rick Houlihan DynamoDB ReInvent Video](https://www.youtube.com/watch?v=6yqfmXiZTlM), we changed how we used DynamoDB for our [SenseDeep](https://www.sensedeep.com) serverless troubleshooter to use one-table design patterns. However, we found the going tough and thus this library was created to make our one-table patterns less tedious, more natural and a joy with DynamoDB.

OneTable is used by the [SenseDeep Serverless Troubleshooter](https://www.sensedeep.com/) for all DynamoDB access.
OneTable was used in production by the [SenseDeep Serverless Troubleshooter](https://www.sensedeep.com/) for all DynamoDB access for a year before it was published as an NPM module.

A big thank you to [Alex DeBrie](https://www.alexdebrie.com/about/) and his excellent [DynamoDB Book](https://www.dynamodbbook.com/). Highly recommended. And thanks also to [Jeremy Daly](https://www.jeremydaly.com/about/) for his [Off by None Blog](https://offbynone.io/) blog, posts and his [DynamoDB Toolbox](https://github.com/jeremydaly/dynamodb-toolbox) which pointed out a better way for us to do a number of things.

Expand Down
2 changes: 2 additions & 0 deletions src/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,8 @@ export default class Model {
if (field.required && value == null && field.value == null) {
if (context[fieldName] !== undefined) {
value = context[fieldName]
} else if (field.uuid) {
value = this.table.uuid()
} else {
details[fieldName] = `Missing required "${fieldName}"`
continue
Expand Down

0 comments on commit 5961408

Please sign in to comment.