-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
[NEW] Route to get updated roles after a date #16610
Merged
rodrigok
merged 11 commits into
RocketChat:develop
from
ashwaniYDV:roleListByUpdatedDate
Mar 20, 2020
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
63efe63
[NEW] Route to get updated roles after a date
ashwaniYDV 69a1ab2
some minor fixes
ashwaniYDV 40f6590
changed variable
ashwaniYDV 2e8e718
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
ashwaniYDV 7e173b4
added checks to date variable and added function in model
ashwaniYDV 6afd153
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
ashwaniYDV 2c64f7b
updated fetch
ashwaniYDV a6b4a42
updated function of query and added tests
ashwaniYDV 47876eb
minor fix
ashwaniYDV 93c0432
removed unnecisary condition
ashwaniYDV bca82e4
Final tweaks
MarcosSpessatto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,19 @@ API.v1.addRoute('roles.list', { authRequired: true }, { | |
}, | ||
}); | ||
|
||
// api to to get updated roles after a date(in ISODate format) | ||
API.v1.addRoute('roles.listByUpdatedDate', { authRequired: true }, { | ||
get() { | ||
check(this.bodyParams, { | ||
updatedAfter: String, | ||
}); | ||
|
||
const roles = Roles.find({ _updatedAt: { $gte: new Date(this.bodyParams.updatedAfter) } }).fetch(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you create a Model method and put this logic inside it to avoid model logic leak? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes sure. I'll do it :) |
||
|
||
return API.v1.success({ roles }); | ||
}, | ||
}); | ||
|
||
API.v1.addRoute('roles.create', { authRequired: true }, { | ||
post() { | ||
check(this.bodyParams, { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@ashwaniYDV can you please validate this query parameter, to make sure it is a valid date? Here we have an example: https://github.com/RocketChat/Rocket.Chat/blob/develop/app/api/server/v1/rooms.js#L34-L43
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.
Done 👍