[NEW] Route to get updated roles after a date#16610
[NEW] Route to get updated roles after a date#16610rodrigok merged 11 commits intoRocketChat:developfrom ashwaniYDV:roleListByUpdatedDate
Conversation
There was a problem hiding this comment.
Can you please create some tests? Here we have an example: https://github.com/RocketChat/Rocket.Chat/blob/develop/tests/end-to-end/api/11-permissions.js#L51-L88
app/api/server/v1/roles.js
Outdated
| API.v1.addRoute('roles.listByUpdatedDate', { authRequired: true }, { | ||
| get() { | ||
| check(this.bodyParams, { | ||
| updatedAfter: String, |
There was a problem hiding this comment.
@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
app/api/server/v1/roles.js
Outdated
| updatedAfter: String, | ||
| }); | ||
|
|
||
| const roles = Roles.find({ _updatedAt: { $gte: new Date(this.bodyParams.updatedAfter) } }).fetch(); |
There was a problem hiding this comment.
Can you create a Model method and put this logic inside it to avoid model logic leak?
There was a problem hiding this comment.
Yes sure. I'll do it :)
|
@MarcosSpessatto I have done the requested changes. Please review |
app/models/server/models/Roles.js
Outdated
| _updatedAt: { $gte: new Date(updatedAfterDate) }, | ||
| }; | ||
|
|
||
| return this.find(query, options).fetch(); |
There was a problem hiding this comment.
I think you can put this fetch outside the method(use when you call the findByUpdatedDate), this way we can call another model methods like count, forEach, etc
|
@ashwaniYDV can you please add some tests? |
|
@MarcosSpessatto I have merged the two functionalities |
|
This pull request introduces 1 alert when merging a6b4a42 into 606eb44 - view on LGTM.com new alerts:
|
|
@ashwaniYDV I did some adjustments like keep the two endpoints. Can you please add docs for the new endpoint? |
|
hi @MarcosSpessatto |
…ultiple-users * 'develop' of github.com:RocketChat/Rocket.Chat: (35 commits) Change license version requested (#16956) Synchronize saml roles to local user (#16158) Fix: Padding required in the Facebook Messenger option in Livechat (#16202) Add some missing ES translations (#16120) Adding margin to click to load text (#16210) [FIX] Explicitly set text of confirmation button (#16138) Redirected to home when a room has been deleted instead of getting broken link(blank page) of deleted room (#16227) Fixed translate variable in ArchiveRoom Modal (#16310) [FIX] Display user status along with icon (#16875) [FIX] users.setStatus and user from params (#16128) Update cypress to version 4.0.2 (#16685) [FIX] Text formatted to remain within button even on screen resize (#14136) fix(slack-bridge): messages doesn't send to slack after renaming channel (#16565) [NEW] Route to get updated roles after a date (#16610) [FIX] Removed Reply in DM from livechat rooms (#16957) Update presence package (#16786) [NEW] Enterprise Edition (#16944) Add an index to the name field for omnichannel department (#16953) [FIX] Login with LinkedIn not mapping name and picture correctly (#16955) [IMPROVE] Allow login of non LDAP users when LDAP is enabled (#16949) ...
…ultiple-users * 'develop' of github.com:RocketChat/Rocket.Chat: (35 commits) Change license version requested (#16956) Synchronize saml roles to local user (#16158) Fix: Padding required in the Facebook Messenger option in Livechat (#16202) Add some missing ES translations (#16120) Adding margin to click to load text (#16210) [FIX] Explicitly set text of confirmation button (#16138) Redirected to home when a room has been deleted instead of getting broken link(blank page) of deleted room (#16227) Fixed translate variable in ArchiveRoom Modal (#16310) [FIX] Display user status along with icon (#16875) [FIX] users.setStatus and user from params (#16128) Update cypress to version 4.0.2 (#16685) [FIX] Text formatted to remain within button even on screen resize (#14136) fix(slack-bridge): messages doesn't send to slack after renaming channel (#16565) [NEW] Route to get updated roles after a date (#16610) [FIX] Removed Reply in DM from livechat rooms (#16957) Update presence package (#16786) [NEW] Enterprise Edition (#16944) Add an index to the name field for omnichannel department (#16953) [FIX] Login with LinkedIn not mapping name and picture correctly (#16955) [IMPROVE] Allow login of non LDAP users when LDAP is enabled (#16949) ...
…ultiple-users * 'develop' of github.com:RocketChat/Rocket.Chat: (35 commits) Change license version requested (#16956) Synchronize saml roles to local user (#16158) Fix: Padding required in the Facebook Messenger option in Livechat (#16202) Add some missing ES translations (#16120) Adding margin to click to load text (#16210) [FIX] Explicitly set text of confirmation button (#16138) Redirected to home when a room has been deleted instead of getting broken link(blank page) of deleted room (#16227) Fixed translate variable in ArchiveRoom Modal (#16310) [FIX] Display user status along with icon (#16875) [FIX] users.setStatus and user from params (#16128) Update cypress to version 4.0.2 (#16685) [FIX] Text formatted to remain within button even on screen resize (#14136) fix(slack-bridge): messages doesn't send to slack after renaming channel (#16565) [NEW] Route to get updated roles after a date (#16610) [FIX] Removed Reply in DM from livechat rooms (#16957) Update presence package (#16786) [NEW] Enterprise Edition (#16944) Add an index to the name field for omnichannel department (#16953) [FIX] Login with LinkedIn not mapping name and picture correctly (#16955) [IMPROVE] Allow login of non LDAP users when LDAP is enabled (#16949) ...
Closes #16599