feat: add include filter support to the GET /api/v3/proposals endpoint#2641
feat: add include filter support to the GET /api/v3/proposals endpoint#2641jekabs-karklins wants to merge 4 commits intomasterfrom
Conversation
nitrosx
left a comment
There was a problem hiding this comment.
Currently proposal have only API v3 implementation.
In your code you are somehow mixing api v3 and v4 for proposal filters and relations.
I'm not sure i understand if it is needed.
In general we try to keep implementation for api v3 and v4 separate, so it will be easy to remove older implementation that are marked as obsolete.
| export type IProposalFilters<T, Y = null> = | ||
| | IProposalFiltersV3<T, Y> | ||
| | IProposalFiltersV4<T, Y>; |
There was a problem hiding this comment.
Can you clarify why you are mixing proposal filter v3 and v4?
There was a problem hiding this comment.
I was keeping it similar how it was done with the datasets.
src/datasets/interfaces/dataset-filters.interface.ts
Also there we have
export type IDatasetFilters<T, Y = null> =
| IDatasetFiltersV3<T, Y>
| IDatasetFiltersV4<T, Y>;
There was a problem hiding this comment.
I have kept now only the v3, becayse you correctly pointed out v4 is not there yet.. However I see no issues of moving relation expansion to the v4 once we have the base of /api/v4/proposals implemented.
| export type IProposalRelation = | ||
| | IProposalRelationV4<IProposalScopesV3> | ||
| | IProposalRelationV4; |
There was a problem hiding this comment.
Same as above, can you clarify why you are mixing api v3 and v4?
There was a problem hiding this comment.
And same here
|
I second to Max's comment, lookup should be v4 feature instead of exiting endpoint |
Sorry, not sure I follow, Do you suggest not to use V3 at all? |
Yes, we try to keep v3 endpoints as it is now with old implementation and deprecate them as soon as we are ready. |
Junjiequan
left a comment
There was a problem hiding this comment.
LFTM.
Ideally the include implmentation should be in the v4 endpoints exclusively, but for a temporary solution this works.
Description
Add
includefilter support to the GET /api/v3/proposals endpoint, allowing callers to request associated samples inline within a single query.Motivation
The proposals endpoint only supported simple find() queries with no relation expansion. We used to need to make separate requests to fetch samples belonging to a proposal. The dataset endpoint already supports this pattern via MongoDB aggregation $lookup stages - this change brings proposals to parity.
The following query now works
Fixes
SWAP-5421
Changes:
Tests included