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(data): new API to search Readings by multiple resource names #3766

Merged
merged 1 commit into from
Oct 21, 2021

Conversation

judehung
Copy link
Member

Add a new Get API that will accept multiple resource names in the payload as the query criteria.
GET /reading/device/name/{deviceName}/start/{start}/end/{end}

the query payload would be:

{
"resourceNames": ["r1", "r2", "r3"]
}

If the resourceNames or the payload is empty, return all the Readings meet the deviceName and in the start/end timestamp

Signed-off-by: Jude Hung [email protected]

closes #3693

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-go/blob/main/.github/Contributing.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?) This PR updates openapi doc to describe the new API.

Testing Instructions

  1. Modify the edgex-go's go.mod to replace the core-contracts lib
  2. Run core-data
  3. Add several events and readings with various resource name under the same device name. Query readings through following API verify if expected readings are returned:
    GET reading/device/name/{deviceName}/start/{start}/end/{end}

New Dependency Instructions (If applicable)

lenny-goodell
lenny-goodell previously approved these changes Oct 21, 2021
Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

LGTM

@judehung
Copy link
Member Author

rebased and update go.mod, go.sum to pick up the latest version of go-mod-core-contracts.

Add a new Get API that will accept multiple resource names in the payload as the query criteria.
/reading/device/name/{deviceName}/start/{start}/end/{end}

the query payload would be:

{
  "resourceNames": ["r1", "r2", "r3"]
}

If the resourceNames or the payload is empty, return all the Readings meet the deviceName and in the start/end timestamp

Unit tests are added and openapi doc is updated

Signed-off-by: Jude Hung <[email protected]>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@judehung judehung marked this pull request as ready for review October 21, 2021 07:10
@codecov-commenter
Copy link

Codecov Report

Merging #3766 (dff1392) into main (4de7b29) will decrease coverage by 0.21%.
The diff coverage is 26.78%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3766      +/-   ##
==========================================
- Coverage   46.21%   45.99%   -0.22%     
==========================================
  Files         112      112              
  Lines        9479     9583     +104     
==========================================
+ Hits         4381     4408      +27     
- Misses       4718     4794      +76     
- Partials      380      381       +1     
Impacted Files Coverage Δ
internal/pkg/infrastructure/redis/client.go 0.00% <0.00%> (ø)
internal/pkg/infrastructure/redis/queries.go 0.00% <0.00%> (ø)
internal/pkg/infrastructure/redis/reading.go 10.49% <0.00%> (-0.89%) ⬇️
internal/core/data/application/reading.go 44.53% <5.26%> (-5.93%) ⬇️
internal/core/data/controller/http/reading.go 85.87% <80.55%> (-1.45%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4de7b29...dff1392. Read the comment docs.

Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

LGTM

@lenny-goodell lenny-goodell merged commit e2d5d6c into edgexfoundry:main Oct 21, 2021
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.

New API to search Reading by multiple ResourceNames
3 participants