Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add enum attribute #274

Merged
merged 5 commits into from
Jun 13, 2018

Conversation

billouboq
Copy link
Contributor

Add enum feature like mongoose one with tests and documentation.
Don't hesitate to tell me if there is something to change or if something is missing.

Fixes #239

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 79.078% when pulling 8ba9cbb on billouboq:feature/add-enum-attribute into 3af8303 on automategreen:master.

1 similar comment
@coveralls
Copy link

coveralls commented Jan 15, 2018

Coverage Status

Coverage increased (+0.05%) to 79.078% when pulling 8ba9cbb on billouboq:feature/add-enum-attribute into 3af8303 on automategreen:master.

Copy link
Member

@fishcharlie fishcharlie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry in advance for being picky on a few things. This looks really promising and good so far, just want to make sure it's solid before merging. Really excited to get this merged in!

@@ -122,6 +126,10 @@ function(model) {
}
```

**Enum: Array of string**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be enum not Enum, correct? And probably array of strings.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this in my commit to this PR

oscar.save(function(err) {
should(err).be.null();

Dog.$__.table.delete(function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for the table.delete here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking at this closer this now makes sense.

@@ -427,6 +427,11 @@ Attribute.prototype.toDynamo = function(val, noSet, model) {
}

if(type.dynamo === 'S') {
if (this.options.enum) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to be in the toDynamo function. Do we think it would be beneficial to add it to the fromDynamo function as well? Not sure if it makes sense, what are your thoughts on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brandongoode can you take a look at this and let me know your thoughts? Do you think we should add this to fromDynamo as well? Should we throw an error in the fromDynamo if it's not correct in the enum, or?

@fishcharlie fishcharlie added this to the v0.9.0 milestone Mar 31, 2018
Copy link
Member

@fishcharlie fishcharlie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fishcharlie fishcharlie mentioned this pull request Apr 3, 2018
@fishcharlie fishcharlie modified the milestones: v0.9.0, v1.0 Jun 13, 2018
@fishcharlie fishcharlie merged commit 50b9b67 into dynamoose:master Jun 13, 2018
@fishcharlie fishcharlie mentioned this pull request Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants