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

[POLICY_STORE] Add filter, sorting, pagination for GET endpoints #639

Closed
1 of 9 tasks
mkanal opened this issue May 14, 2024 · 16 comments
Closed
1 of 9 tasks

[POLICY_STORE] Add filter, sorting, pagination for GET endpoints #639

mkanal opened this issue May 14, 2024 · 16 comments
Assignees
Labels
3 - Maintenance & Improvements (EDC & EDC API) Improvements policy_store Issues regarding the IRS policy store. R24.8 spill_over Issues which are not finished yet

Comments

@mkanal
Copy link
Contributor

mkanal commented May 14, 2024

As business app Trace-X
I want use filter, sorting, pagination for GET endpoints
so that we could visualize the data in a sufficient way

Links

Hints / Details

  • ...

Acceptance Criteria

  • policy store GET endpoints supporting GET /irs/policies
    • filtering on attributes [BPN, validUntil, policyId, createdOn, action,]
      • For filtering on attribute action first permission entry in array is used
    • sorting on attributes [BPN, validUntil, policyId, createdOn, action,] asc, desc, default sorting is BPN asc
      • For sorting on attribute action first permission entry in array is used
    • pagination min 1 / max 1000
  • Update Insomnia
  • Update documentation
  • Update tests

Out of Scope

  • sorting on attributes [constraint,]
  • filter on attribute [constraint]
@mkanal mkanal added this to IRS May 14, 2024
@mkanal mkanal moved this to next in IRS May 14, 2024
@mkanal mkanal moved this from next to backlog in IRS May 14, 2024
@mkanal mkanal moved this from backlog to inbox in IRS May 14, 2024
@dsmf
Copy link
Contributor

dsmf commented Jun 5, 2024

relates to #561

ds-jhartmann pushed a commit to ds-jhartmann/item-relationship-service that referenced this issue Jun 13, 2024
…se-tractusx#209-aas-3.0.0-is-implemented-in-irs-api-swagger-docu

feat(irs):[eclipse-tractusx#209] Update IRS API Swagger documentation to match AAS 3.0.0
@mkanal mkanal moved this from inbox to backlog in IRS Jun 21, 2024
@mkanal mkanal added 3 - Maintenance & Improvements (EDC & EDC API) Improvements policy_store Issues regarding the IRS policy store. labels Jun 21, 2024
@mkanal mkanal moved this from backlog to next in IRS Jun 26, 2024
@dsmf
Copy link
Contributor

dsmf commented Jun 30, 2024

@mkanal:
The current implementation GET /irs/policies returns a map of policies, not a list (because BPN is not part of the policy entity itself). See the following result:

{
	"BPNL1234567890AB": [
		... policies ...
	]
}

How should the paging work here?
Returning Page<Policy> would not transfer the information to which BPN it belongs.
Returning Map<BPN, Page<Policy>> would convey the BPN information, but this feels wrong either and probably isn't what is needed.

Brainstorming options for harmonizing the BPN policy relationship with paging:

  1. Add BPN as an attribute to Policy and return Page<Policy>>. (This seems to me to be the best option, as this would be the default way of paging and thus the easiest option to understand. But: Are we allowed to extend the policy structure in this way?)
  2. Return Page<Policy>, add another endpoint that can retrieve the BPNs for a list of policyIds (returning Map<BPN, List<policyId>>.
  3. Return a wrapper structure that encloses Page<Policy> and a Map<BPN, List<policyId>> to also transmit the BPN policy relationship (without needing additional queries).
  4. Any other ideas?

@dsmf dsmf added the DISCUSSION_NEEDED This ticket needs discussion within teammembers label Jun 30, 2024
ds-mwesener added a commit that referenced this issue Jul 1, 2024
…ssage-for-policies

feature: #639 rework exception messages for policy handling
@dsmf dsmf moved this from next to wip in IRS Jul 1, 2024
@dsmf dsmf self-assigned this Jul 1, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 2, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 2, 2024
@dsmf
Copy link
Contributor

dsmf commented Jul 2, 2024

discussed with @ds-mwesener:
we add bpn on the same level as validUntil and return a paged list instead of map

dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 2, 2024
…wn service in order to avoid PolicyStoreService becoming a god-class
@dsmf
Copy link
Contributor

dsmf commented Jul 2, 2024

@mkanal: @ds-mwesener said they need multi-sort and multi-filter (with flexible sort operators). Single-sort is no problem. Maybe multi-sort can be implemented within the estimation too, but multi-filter goes far beyond the acceptance criteria in this story and cannot be implemented within the estimation.

Example requests to show how their multi-sort and multi-filter are designed:

multi-sort:

https://traceability.dev.demo.catena-x.net/api/assets/as-built
    ?page=0&size=50
    &sort=id,asc
    &sort=idShort,asc

multi-filter:

https://traceability.dev.demo.catena-x.net/api/assets/as-built
    ?filter=semanticDataModel%2CEQUAL%2CBATCH%2COR
    &filter=semanticDataModel%2CEQUAL%2CSERIALPART%2COR'

suggestion: leave out the filter in this story completely and add new PBI(s) for multi-sort and multi-filter.

@mkanal
Copy link
Contributor Author

mkanal commented Jul 2, 2024

@dsmf please include multi-sort within this story. I will create a story with multi-filter. #750

dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 2, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 3, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 3, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 3, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 3, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 3, 2024
…vements

still missing:
- filtering for validUntil and createdOn
- documentation, further / adjustment of tests, see TODOs with eclipse-tractusx#639
@dsmf
Copy link
Contributor

dsmf commented Jul 19, 2024

Thanks, @mkanal. I'll update the documentation and add some handling for the date format exeption to map to a BAD_REQUEST with a more user friendly message instead.

dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 19, 2024
- harmonize description of GET /irs/policies and /irs/policies/paged
- describe supported attributes in filter and sort
- document supported search operators and value format
- document default and max page size
@dsmf
Copy link
Contributor

dsmf commented Jul 19, 2024

PR for documentation improvement

#830

PR for date format exception handling

#831

PR for improvement of IrsApplicationTests.generatedOpenApiMatchesContract

(because I noticed during documentation improvement above that the ignores seem to be obsolete).
#832

dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 19, 2024
…andling concerning invalid date format in search parameters
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 19, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 19, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 19, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 19, 2024
… by preserving the cause in exception handling
ds-jhartmann added a commit that referenced this issue Jul 23, 2024
chore(documentation): [#639] improve documentation
ds-jhartmann added a commit that referenced this issue Jul 23, 2024
chore(exception-handling): [#639] improve exception handling concerni…
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 23, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 23, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 23, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 23, 2024
@dsmf dsmf mentioned this issue Jul 23, 2024
2 tasks
@dsmf
Copy link
Contributor

dsmf commented Jul 23, 2024

PR to support any ISO date in date search filters for createdOn and validUntil

#844

dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 23, 2024
dsmf added a commit to dsmf/tx-item-relationship-service that referenced this issue Jul 23, 2024
…T /irs/policies`

(in future the paged endpoint should be used)
@dsmf
Copy link
Contributor

dsmf commented Jul 23, 2024

PR for deprecation note for old endpoint GET /irs/policies

#845

grafik

@mkanal mkanal added the spill_over Issues which are not finished yet label Jul 23, 2024
ds-jhartmann added a commit that referenced this issue Jul 23, 2024
…d-endpoint

chore(documentation): [#639] deprecation note for `GET /irs/policies`
@dsmf dsmf moved this from wip to test in IRS Jul 23, 2024
@dsmf
Copy link
Contributor

dsmf commented Jul 23, 2024

deployed to DEV:

  • deprecation note for old endpoint GET /irs/policies
  • date filters support any ISO date now, not just yyyy-MM-dd

grafik

@mkanal mkanal moved this from test to done in IRS Jul 23, 2024
@mkanal
Copy link
Contributor Author

mkanal commented Jul 23, 2024

LGFM. PO acceptance in behalf of @jzbmw

@mkanal mkanal closed this as completed Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Maintenance & Improvements (EDC & EDC API) Improvements policy_store Issues regarding the IRS policy store. R24.8 spill_over Issues which are not finished yet
Projects
Status: done
Development

No branches or pull requests

3 participants