generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 1
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
APS-884: Future Manager creates out-of-service bed record from "v2 manage" #1964
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
edavey
force-pushed
the
APS-884-create-oosb
branch
4 times, most recently
from
July 4, 2024 17:45
1928f95
to
784f588
Compare
edavey
changed the title
APS-884: Create out of service bed record
APS-884: Manager creates out of service bed record from "v2 manage"
Jul 4, 2024
edavey
changed the title
APS-884: Manager creates out of service bed record from "v2 manage"
APS-884: Future Manager creates out-of-service bed record from "v2 manage"
Jul 4, 2024
edavey
force-pushed
the
APS-884-create-oosb
branch
from
July 4, 2024 17:53
784f588
to
14336a1
Compare
richpjames
approved these changes
Jul 5, 2024
richpjames
approved these changes
Jul 5, 2024
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.
LGTM once the int tests are passing :)
edavey
force-pushed
the
APS-884-create-oosb
branch
from
July 8, 2024 09:59
14336a1
to
a8e58ed
Compare
We rename OutOfService date fields: - outOfServiceFrom -> startDate - outOfServiceTo -> endDate to line up with the actual fields implemented at the API, see [OpenAPI spec][]. --- This commit includes a change to the `errors.json` translation file which converts field and error keys sent by the API to human error messages which map to form fields in the DOM -- to which we need to apply error styling. The system of "translating" validation errors messages sent from the API works like this ([see validation error code in the API][]): 1. FROM THE ENTITY LAYER For validation errors raised from the entity level, by virtue of a field being non-nullable, the `propertyName` is automatically used as the field key e.g. ``` data: { "title": "Bad Request", "status": 400, "detail": "There is a problem with your request", "invalid-params": [ { "propertyName": "$.endDate", "errorType": "empty" }, ] } ``` 2. FROM THE SERVICE LAYER PROBLEM: HOW TO DISTINGUISH BETWEEN `foo.notes` and `bar.notes`? Where we have custom validations which are not set at the db level we can set a bespoke `propertyName` -- but this won't allow us to have consistent and unique propertyNames e.g. for 3 entities which all have a `notes` property - `LostBedNotes` - `OutOfServiceBedNotes` - `AnOtherEntityNotes` [OpenAPI spec]: https://approved-premises-api-dev.hmpps.service.justice.gov.uk/swagger-ui/index.html?urls.primaryName=CAS1%20API#/out-of-service%20beds/post_premises__premisesId__out_of_service_beds [validation error code in the API]: https://github.com/ministryofjustice/hmpps-approved-premises-api/blob/79ed9528719e6829cbac5ecd2a46ce3e21390e72/src/main/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/results/ValidatableActionResult.kt#L6-L27
edavey
force-pushed
the
APS-884-create-oosb
branch
from
July 8, 2024 16:34
a8e58ed
to
3fa2be1
Compare
We're going to render different HREFs in the bed "Manage" link depending on whether the logged in user has the FUTURE_MANAGER role. As a preliminary we pass in the "user" object without changing any behaviour.
The next commit will include redirection to the "v2" bed page (`/manage/premises/{premisesId}/bed/{bedId}`).
edavey
force-pushed
the
APS-884-create-oosb
branch
from
July 8, 2024 16:52
3fa2be1
to
a044fe6
Compare
We start a new `/e2e/tests/v2Manage.spec` file to compartmentalise these user journeys, starting with: > Future manager marks a bed as out of service in the V2 Manage area > > Given I am signed in as a future manager > And I am on the list of premises page > > When choose to view the detail of a particular premises > Then I should see the premises page > > When I choose to manage its beds > And I pick a particular bed to manage > Then I see the V2 Bed page > And I should be able to mark a bed as out of service > > When I fill in and submit the v2 Manage out-of-service-bed form > Then I am redirected back to the V2 bed page > And I see the success message on the 'history' pane of the bed page The differences in v2/v1 behaviour are achieved with: - a new `v2BedLink()` 'Manage (bed)' link used on the premises' bed list to link to the new v2 bed page - a new `v2BedActions()` widget which offers FUTURE_MANAGER the link to the new v2 "create out of service bed" form from the v2 bed page Also: the "Future manager creates V2 OOSB record" was duplicated in both: 1. `integration_tests/tests/v2Manage/beds.cy.ts` and 2. `integration_tests/tests/v2Manage/outOfServiceBeds.cy.ts` We delete [1].
This tidy up is unrelated to the PR so feel free to move or drop.
edavey
force-pushed
the
APS-884-create-oosb
branch
from
July 8, 2024 17:19
a044fe6
to
4f95a15
Compare
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.
This PR implements the "Future manager creates an out-of-service bed record" and incorporates: