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

feat: provide support for groupby #2175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aaqilniz
Copy link
Contributor

@aaqilniz aaqilniz commented Dec 28, 2023

This PR enables the loopback-datasource-juggler to add min(), max(), count(), avg() & sum() in the result.

Related PRs:

Checklist

  • Sign off your commits with DCO (Developer Certificate of Origin)
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • Commit messages are following our guidelines

@coveralls
Copy link

coveralls commented Dec 28, 2023

Pull Request Test Coverage Report for Build 11081499018

Details

  • 35 of 36 (97.22%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 84.737%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/dao.js 3 4 75.0%
Totals Coverage Status
Change from base Build 10987739711: 0.02%
Covered Lines: 7316
Relevant Lines: 8323

💛 - Coveralls

nodes = nodes.slice(skip, skip + limit);
if (filter.groupBy) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this will require support for connector too

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. And it's implemented here.

@@ -272,6 +272,28 @@ describe('crud-with-options', function() {
User.find({limit: 3});
});

it('should allow filter with groupBy, count, max, min, sum & avg', function(done) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add test cases for when there are other filter queries too and limit and offset is also provided ? Basically to confirm whether this feature works with other features together or not. And whether it has any impact there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, @samarpanB. I have added one more test to verify the change with existing filters.

@aaqilniz aaqilniz force-pushed the feat/support-groupby branch 7 times, most recently from 82da092 to a4872f5 Compare September 28, 2024 05:32
Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants