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: Add resources/info endpoint (DEV-792) #2309

Merged
merged 26 commits into from Dec 19, 2022

Conversation

seakayone
Copy link
Collaborator

@seakayone seakayone commented Nov 29, 2022

Issue Number: DEV-792

includes orderBy [creationDate|lastmodficationDate], and order [ASC|DESC].

Http Example request:

GET /v2/resources/info?resourceClass=http%3A%2F%2F0.0.0.0%3A3333%2Fontology%2F0001%2Fanything%2Fv2%23Thing&order=DESC&orderBy=creationDate HTTP/1.1
X-Knora-Accept-Project: http://rdfh.ch/projects/Lw3FC39BSzCwvmdOaTyLqQ

Http Example response:
{
	"resources": [
		{
			"resourceIri": "http://rdfh.ch/0001/thing-with-pages",
			"creationDate": "2021-05-11T10:00:00Z",
			"lastModificationDate": "2021-05-11T10:00:00Z",
			"isDeleted": false
		},
		{
			"resourceIri": "http://rdfh.ch/0001/0JhgKcqoRIeRRG6ownArSw",
			"creationDate": "2020-04-07T09:12:56.710717Z",
			"lastModificationDate": "2020-04-07T09:12:56.710717Z",
			"isDeleted": false
		},
		...
	]
}

Pull Request Checklist

Basic Requirements

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix: represents bug fixes
  • Refactor: represents production code refactoring
  • Feature: represents a new feature
  • Documentation: documentation changes (no production code change)
  • Chore: maintenance tasks (no production code change)
  • Style: styles updates (no production code change)
  • Test: all about tests: adding, refactoring tests (no production code change)
  • Other... Please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

Does this PR change client-test-data?

  • Yes (don't forget to update the JS-LIB team about the change)
  • No

@seakayone seakayone force-pushed the wip/add-resources-info-DEV-792 branch from 66f32fa to d40183d Compare November 29, 2022 13:04
@seakayone seakayone requested review from irinaschubert, mpro7 and BalduinLandolt and removed request for irinaschubert November 29, 2022 13:12
@seakayone seakayone changed the title Wip/add resources info dev 792 Add resources/info endpoint Nov 29, 2022
@seakayone seakayone force-pushed the wip/add-resources-info-DEV-792 branch 2 times, most recently from 8f1a3f8 to fdb7ab8 Compare November 29, 2022 14:08
@seakayone seakayone force-pushed the wip/add-resources-info-DEV-792 branch 2 times, most recently from d445876 to e83c808 Compare December 5, 2022 13:33
@codecov
Copy link

codecov bot commented Dec 5, 2022

Codecov Report

Base: 86.68% // Head: 86.38% // Decreases project coverage by -0.29% ⚠️

Coverage data is based on head (8b163ff) compared to base (26e9596).
Patch coverage: 39.06% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2309      +/-   ##
==========================================
- Coverage   86.68%   86.38%   -0.30%     
==========================================
  Files         250      264      +14     
  Lines       28252    28417     +165     
==========================================
+ Hits        24490    24549      +59     
- Misses       3762     3868     +106     
Impacted Files Coverage Δ
webapi/src/main/scala/org/knora/webapi/Main.scala 0.00% <0.00%> (ø)
...main/scala/org/knora/webapi/config/AppConfig.scala 82.97% <0.00%> (+1.34%) ⬆️
.../main/scala/org/knora/webapi/core/HttpServer.scala 100.00% <ø> (ø)
...main/scala/org/knora/webapi/core/HttpServerZ.scala 0.00% <0.00%> (ø)
.../knora/webapi/core/InstrumentationHttpServer.scala 0.00% <0.00%> (ø)
.../knora/webapi/http/handler/ExceptionHandlerZ.scala 0.00% <0.00%> (ø)
...org/knora/webapi/http/status/ApiStatusCodesZ.scala 0.00% <0.00%> (ø)
...nora/webapi/instrumentation/health/HealthApp.scala 0.00% <0.00%> (ø)
.../knora/webapi/instrumentation/index/IndexApp.scala 0.00% <0.00%> (ø)
...api/instrumentation/prometheus/PrometheusApp.scala 0.00% <0.00%> (ø)
... and 16 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@seakayone seakayone self-assigned this Dec 7, 2022
@seakayone seakayone force-pushed the wip/add-resources-info-DEV-792 branch 9 times, most recently from 9247db4 to 1a19913 Compare December 14, 2022 10:19
@seakayone seakayone force-pushed the wip/add-resources-info-DEV-792 branch 5 times, most recently from c0c5574 to c59ce47 Compare December 15, 2022 07:50
Copy link

@irinaschubert irinaschubert left a comment

Choose a reason for hiding this comment

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

I think it is a good pattern to separate domain entities from DTOs but it is a pattern we haven't used so far. So, I would prefer to document it if we go this way in the future.

In general, documentation (also for end users) is missing. Could you add some?

And, we already discussed it, I totally agree that we don't need docstrings if a method name says everything. But there are a lot of methods and case classes doing more than the signature states, so it would be good to have docstrings there (especially for params).

seakayone and others added 2 commits December 16, 2022 11:53
…iConverterLiveSpec$.scala

Co-authored-by: irinaschubert <irina.schubert@dasch.swiss>
@mpro7 mpro7 changed the title feat: Add resources/info endpoint feat: Add resources/info endpoint (DEV-792) Dec 19, 2022
@swarmia
Copy link

swarmia bot commented Dec 19, 2022

Copy link
Collaborator

@mpro7 mpro7 left a comment

Choose a reason for hiding this comment

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

That's nice piece of code.

Http.collectZIO[Request] { case req @ Method.GET -> !! / "v2" / "resources" / "info" =>
(for {
p <- getParameters(req)
result <- restService.findByProjectAndResourceClass(p._1, p._2, (p._3, p._4))
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO it looks OK, params are coming from method which is. just few lines below - easy to find out.

@seakayone seakayone merged commit c3f96a9 into main Dec 19, 2022
@seakayone seakayone deleted the wip/add-resources-info-DEV-792 branch December 19, 2022 09:54
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.

None yet

3 participants