matteodelabre / mongoose-beautiful-unique-validation

Plugin for Mongoose that turns duplicate errors into regular Mongoose validation errors
MIT License
117 stars 38 forks source link

Switched type to `unique` to be consistent with Mongoose types #40

Closed niftylettuce closed 7 years ago

niftylettuce commented 7 years ago

Closes #39

niftylettuce commented 7 years ago

Fixing tests now

niftylettuce commented 7 years ago

@matteodelabre I have fixed the tests and force-pushed after rebasing, should be good now.

matteodelabre commented 7 years ago

Hello @niftylettuce, and thanks for your contribution! I’m currently reviewing this.

niftylettuce commented 7 years ago

@matteodelabre OK I've updated my PR per all your requests - please see my latest push. Note that I've added a fallback global message formatted adhering to Mongoose's standard behavior (e.g. https://github.com/Automattic/mongoose/blob/e659958fe80c5d03a7cb89a4e43804c1dd3ddda2/lib/error/messages.js).

niftylettuce commented 7 years ago

Also @matteodelabre I documented mongoose.Error.messages.general.unique in the Readme too!

matteodelabre commented 7 years ago

Looks good to me! Thanks for your help :-) I will publish a new major release with this as soon as possible.

niftylettuce commented 7 years ago

I can release an NPM version if you npm owner add niftylettuce if needed!

matteodelabre commented 7 years ago

Let’s do that! But first, I wanted to add some tests for the default validation message and fix some minor formatting issues — unfortunately your latest patch does not pass ESLint validation, but it’s entirely my fault, I didn’t integrate ESLint to the CI. Please give me a few minutes :-)

niftylettuce commented 7 years ago

Oh awesome!

niftylettuce commented 7 years ago

@matteodelabre see my comment here https://github.com/Automattic/mongoose/issues/2284#issuecomment-320810641 😄

niftylettuce commented 7 years ago

Not sure what's going on here, but I tried to fix this per https://github.com/matteodelabre/mongoose-beautiful-unique-validation/compare/master...niftylettuce:master yet your master branch here on GitHub is still synced to an older version before you accepted the PR 🤦‍♂️ ....

matteodelabre commented 7 years ago

Thanks for the comment! Much appreciated. :)

matteodelabre commented 7 years ago

If you want to submit new changes, you need to create a new pull request, because this one was merged and cannot be re-opened.

niftylettuce commented 7 years ago

I tried to create a new one... this is weird

niftylettuce commented 7 years ago

See what I mean here @matteodelabre ? Never seen this ever before:

screen shot 2017-08-07 at 9 34 11 pm
matteodelabre commented 7 years ago

Strange indeed. What happens if you click “Create pull request”?

niftylettuce commented 7 years ago

Same thing, this is a GitHub bug 🤦‍♂️

niftylettuce commented 7 years ago

I sent in a support request on GitHub and tweeted them

matteodelabre commented 7 years ago

Weird. Please keep me updated if you receive a response, I’m also interested. :-)

niftylettuce commented 7 years ago

All fixed

On Aug 8, 2017 6:59 AM, "Mattéo Delabre ✏️" notifications@github.com wrote:

Weird. Please keep me updated if you receive a response, I’m also interested. :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/matteodelabre/mongoose-beautiful-unique-validation/pull/40#issuecomment-320922526, or mute the thread https://github.com/notifications/unsubscribe-auth/AAf7hSQrKoT0soDDgMcL4bb2CoeV0Pmaks5sWD97gaJpZM4OvxlU .