-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add make live validation #332
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Move the task status service (excluding the submission email status) from forms-admin to forms-api. This is a precursor to adding validation to the make_live endpoint.
Add the ready_for_live, missing_sections, and task_statuses attributes to the JSON returned when retrieving a form.
This uses the validation logic in the task status service to prevent a form being made live if it has missing mandatory sections. If the validation fails it returns the missing sections with a 403 Forbidden status code.
Make each status method private, and rename missing_sections to incomplete_tasks to be clearer about what the method does
jamie-o-wilkinson
force-pushed
the
add-make-live-validation
branch
from
September 18, 2023 10:58
ec5e7a5
to
7335175
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
jamie-o-wilkinson
changed the title
WIP Add make live validation
Add make live validation
Sep 19, 2023
thomasiles
approved these changes
Sep 19, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes things a lot simpler and it reads well. Nice one!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem does this pull request solve?
Currently we have validation in forms-admin that prevents making a form live until certain conditions are met. However the api will happily make a form live if those conditions aren’t met.
This PR adds an updated task status service from forms-admin, and uses it validate the status of mandatory tasks prior to making a form live. It also adds task status data to the form data itself.
Unfortunately the submission email status depends on data in the forms-admin db, so this isn't included in the validation. Instead the submission email check is still done in forms-admin, and is combined with the
incomplete_tasks
andtask_statuses
from forms-api.It would be great to hear other people's opinions on whether this refactor (in effect splitting the validation across forms-api and forms-admin) is preferable to duplicating the validation and removing the need to pass data back via the form object.
Trello card: https://trello.com/c/xEyusUhB
Things to consider when reviewing