Repository navigation
[scd] Extract resolve subscription - #1800
Conversation
2f27564 to
a216bf0
Compare
mickmis
left a comment
There was a problem hiding this comment.
I opened #1800 but kept removePreviousImplicitSubscription outside of it to avoid having 2 return bool values.
FWIW I think it's perfectly fine to have two return bool values in this case, and abstracts well (or better, at least) the extraction of the subscription data. This could be encapsulated in a ad-hoc struct if that makes you nervous. But up to you that's more of a nit (except for the duplication of previousSubIsBeingReplaced as mentioned in a comment).
| validParams *validOIRParams, | ||
| ) (*scdmodels.Subscription, bool, error) { | ||
| var err error | ||
| previousSubIsBeingReplaced := previousSub != nil && validParams.SubscriptionID != previousSub.ID |
There was a problem hiding this comment.
This is now duplicated. Either pass previousSubIsBeingReplaced as argument, or return removePreviousImplicitSubscription out of this function (moving the block // Determine if the previous subscription ... inside this function).
Co-authored-by: Mickaël Misbach <mickael.misbach@orbitalize.com>
Following feedback on #1797, this PR extracts the subscription resolving logic for put oir reference requests.