-
Notifications
You must be signed in to change notification settings - Fork 48
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
Cache aspect writers #341
Cache aspect writers #341
Conversation
5e55802
to
673a0ed
Compare
There are 4 parts to this PR and each of the part is in its own commit. |
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.
In tests, when we check for errors, do you think it would be better to check for the error messages which is returned in responses? Previously, I have found some errors to return right status but unexpected/no response message. So, I thought I will just mention, fyi.
constants.ISOfields.forEach((field) => { | ||
if (!obj[field]) { | ||
obj[field] = new Date().toISOString(); | ||
} else if (obj[field] && obj[field].toISOString) { |
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.
obj[field].toISOString() ?
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.
what do you mean ?
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.
Nevermind, I just checked obj[field].toISOString will return undefined for something other than Date.
api/v1/controllers/aspects.js
Outdated
.catch((err) => Promise.resolve(err)); | ||
} | ||
|
||
return Promise.resolve(true); |
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.
Some comments would be a plus!
* @param {String} name - Name of the key | ||
* @returns {Promise} - which resolves to the value associated with the key | ||
*/ | ||
function getValue(type, name) { |
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.
There is already a function getHashPromise with same intent. This method converts arrayStringsToJson as well. Any way we can avoid code duplication? If you insist on keeping the function, we should atleast change the name and comments to reflect how this function is different from other.
.catch((err) => u.handleError(next, err, helper.modelName)); | ||
} else { | ||
doDeleteAllAssoc(req, res, next, helper, helper.belongsToManyAssoc.users); | ||
} |
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.
Some comments if you can.
.then(() => doDeleteOneAssoc(req, res, next, helper, | ||
helper.belongsToManyAssoc.users, userNameOrId)) | ||
.catch((err) => u.handleError(next, err, helper.modelName)); | ||
} else { |
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.
Inline Comments or update function comment please!
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.
What comments do you need ??
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.
I just thought its better to add comments whenever we are adding a chunk of code, on why/what new code is. But you can ignore this if you feel this is unnecessary.
expect(aspect.writers).to.have | ||
.members([user4.name]); | ||
}) | ||
.then(() => samstoinit.init()) |
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.
what is the reason for initializing the sample store at the end of the test?
|
||
return done(); | ||
}); | ||
return null; |
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.
is there a reason for returning null? do we need a return here at all?
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.
@annyhe Will correct it, we do not need it.
@shriramshankar Just to confirm, my understanding is that I am not required to review this PR. |
9086678
to
ac3f899
Compare
ac3f899
to
79726f9
Compare
I have resolved the conflicts, added a few more tests and some comments. Can we merge this, please? |
ok by me, need's @pallavi2209 to approve the changes since she requested changes |
@iamigo I added the third reviewer by mistake and there is nothing I can do to remove the third reviewer. If I start working on my bulkUpsert story without this in the master, I will have to resolve the conflict again. Can we please merge this? |
No description provided.