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

[scd] factor out parameter validation against previous OIR #1090

Merged

Conversation

Shastick
Copy link
Contributor

Moves the checks that compare the requesting manager to the one of the (possibly) existing OIR to a submethod.

Note the usage of stacktrace.GetCode(err) and stacktrace.PropagateWithCode(): I'm not sure we have a more elegant solution such as we had in #1089 if we want to avoid this.

Copy link
Contributor

@mickmis mickmis left a comment

Choose a reason for hiding this comment

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

LGTM - see the nit suggestion. LMK if you implement it or not so that I can merge or wait.

Copy link
Contributor

@mickmis mickmis left a comment

Choose a reason for hiding this comment

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

This time including the comment I'm talking about.

// On success, the version of the OIR is returned:
// - upon initial creation (if no previous OIR exists), it is 0
// - otherwise, it is the version of the previous OIR
func validateUpsertRequestAgainstPreviousOIRAndReturnVersion(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: do not return version from this function and just perform validation.
Determining version can then just be:

version := 0
if old != nil {
  version = int32(old.Version)
}

@Shastick Shastick force-pushed the oir-upsert-refactor-1-further-validation branch from 7c1f055 to 329993c Compare August 30, 2024 14:28
@mickmis mickmis merged commit 5e9aa75 into interuss:master Aug 30, 2024
6 checks passed
@mickmis mickmis deleted the oir-upsert-refactor-1-further-validation branch August 30, 2024 14:33
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.

2 participants