Skip to content
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
merged 11 commits into from
Mar 20, 2020
Merged

[NEW] Route to get updated roles after a date #16610

merged 11 commits into from
Mar 20, 2020

Conversation

ashwaniYDV
Copy link
Contributor

@ashwaniYDV ashwaniYDV commented Feb 15, 2020

Closes #16599

Copy link
Member

@MarcosSpessatto MarcosSpessatto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API.v1.addRoute('roles.listByUpdatedDate', { authRequired: true }, {
get() {
check(this.bodyParams, {
updatedAfter: String,
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

updatedAfter: String,
});

const roles = Roles.find({ _updatedAt: { $gte: new Date(this.bodyParams.updatedAfter) } }).fetch();
Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sure. I'll do it :)

@ashwaniYDV
Copy link
Contributor Author

@MarcosSpessatto I have done the requested changes. Please review

@CLAassistant
Copy link

CLA assistant check
All committers have signed the CLA.

_updatedAt: { $gte: new Date(updatedAfterDate) },
};

return this.find(query, options).fetch();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@MarcosSpessatto
Copy link
Member

@ashwaniYDV can you please add some tests?

@ashwaniYDV
Copy link
Contributor Author

ashwaniYDV commented Mar 10, 2020

@MarcosSpessatto I have merged the two functionalities roles.list and roles.list?updatedSince?date in the same function keeping it consistent to the other APIs.
I have added the tests too.

@lgtm-com
Copy link

lgtm-com bot commented Mar 10, 2020

This pull request introduces 1 alert when merging a6b4a42 into 606eb44 - view on LGTM.com

new alerts:

  • 1 for Useless conditional

@MarcosSpessatto
Copy link
Member

@ashwaniYDV I did some adjustments like keep the two endpoints. Can you please add docs for the new endpoint?

@MarcosSpessatto MarcosSpessatto modified the milestones: 3.0.2, 3.1.0 Mar 10, 2020
@ashwaniYDV
Copy link
Contributor Author

ashwaniYDV commented Mar 10, 2020

hi @MarcosSpessatto
I have updated docs in this repo https://github.com/rocketchat/docs
Please review

@rodrigok rodrigok merged commit ad176ef into RocketChat:develop Mar 20, 2020
ggazzo added a commit that referenced this pull request Mar 21, 2020
…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)
  ...
ggazzo added a commit that referenced this pull request Mar 21, 2020
…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)
  ...
ggazzo added a commit that referenced this pull request Mar 21, 2020
…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)
  ...
@sampaiodiego sampaiodiego mentioned this pull request Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Route to get updated and deleted roles after a date
4 participants