Feat/aggregate provider states by consumers - #790
Conversation
There was a problem hiding this comment.
Should this logic live elsewhere, rather than the decorator?
Would it be better to have this performed as part of a db query.
Just thinking of performance reasons, with a large set of consumer pacts, for a given provider.
There was a problem hiding this comment.
I'm not entirely sure of previous patterns across the code base, but pagination might be one way to address that performance concern.
There was a problem hiding this comment.
Should we consider returning more information here.
Would it be useful for example, for the returned list in the api to contain the links to the latest pacts on the consumers main branch, which contain the provider states returned?
There was a problem hiding this comment.
A link might be a nice touch. Given it's just a template and doesn't require additional DB lookups it should be pretty speedy. But equally fairly straightforward to re-lookup using the HAL links so I think we could consider adding it later if people really need.
```
{
"providerStates" => [
{ "consumers" => ["Foo", "Foo2", "Foo3", "Foo4", "Foo5"], "name" => "product details", "params" => { "product_id" => "058925f7-1763-4dd9-a057-50ee265e33a0" } },
{ "consumers" => ["Waffle", "Waffle2"], "name" => "product list" },
{ "consumers" => ["Foo6"], "name" => "some other product list" }
]
}
```
a1ec14a to
1abf3f6
Compare
feat: group provider states by consumers
Fixes #789