-
Notifications
You must be signed in to change notification settings - Fork 156
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
generate methods options for .serve function #386
base: main
Are you sure you want to change the base?
generate methods options for .serve function #386
Conversation
- defaults - tests for non-existent PUT
I see now that the |
Awesome! I'll take a look at the tests, the one's checking for errors depend on the specific MongoDB/Mongoose versions so as long as Travis passes, we're fine. |
Shall I have another look at this? |
Since the package is so closely coupled to MongoDB, would it make sense to align the method names with Mongo's?
And so on? I'm not sure myself! I might also be tempted to shorten Also, just a small thing, I'd rather we stick to prettier defaults so we can focus on code and not style 😸 |
let app = createFn() | ||
let server | ||
|
||
before(done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Replace done
with (done)
before(done => { | |
before((done) => { |
dismantle(app, server, done) | ||
}) | ||
|
||
it('GET /Customer 200', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Replace done
with (done)
it('GET /Customer 200', done => { | |
it('GET /Customer 200', (done) => { |
let server | ||
|
||
before(done => { | ||
setup(err => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Replace err
with (err)
setup(err => { | |
setup((err) => { |
|
||
app.post(uriItems, prepareQuery, ensureContentType, options.preMiddleware, options.preCreate, accessMiddleware, ops.createObject, prepareOutput) | ||
app.post(uriItem, util.deprecate(prepareQuery, 'express-restify-mongoose: in a future major version, the POST method to update resources will be removed. Use PATCH instead.'), ensureContentType, options.preMiddleware, options.findOneAndUpdate ? [] : filterAndFindById, options.preUpdate, accessMiddleware, ops.modifyObject, prepareOutput) | ||
options.generateMethods.forEach(method => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Replace method
with (method)
options.generateMethods.forEach(method => { | |
options.generateMethods.forEach((method) => { |
) | ||
}) | ||
|
||
it('PUT /Customer 404', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Replace done
with (done)
it('PUT /Customer 404', done => { | |
it('PUT /Customer 404', (done) => { |
}) | ||
}) | ||
|
||
after(done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Replace (done
with ((done)
after(done => { | |
after((done) => { |
@@ -19,7 +19,8 @@ function getDefaults() { | |||
runValidators: false, | |||
allowRegex: true, | |||
private: [], | |||
protected: [] | |||
protected: [], | |||
generateMethods: ['delete', 'deleteone', 'get', 'getone', 'getcount', 'getshallow', 'patch', 'put', 'post', 'modifyobject'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy has a fix for the issue: Insert ,
generateMethods: ['delete', 'deleteone', 'get', 'getone', 'getcount', 'getshallow', 'patch', 'put', 'post', 'modifyobject'] | |
generateMethods: ['delete', 'deleteone', 'get', 'getone', 'getcount', 'getshallow', 'patch', 'put', 'post', 'modifyobject'], |
I added the feature mentioned in issue #385 .
Am encountering two issues:
findOneAndUpdate: true
with400 - mongo error
are not passing.