SAS-620: DTR submission and outcome notes#314
Open
David (david-mcdowall) wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds optional free-text notes to the Duty To Refer (DTR) submission and outcome flows so they can be stored, retrieved, and displayed together on the referral view.
Changes:
- Extends the DTR API contract and persistence model with
submissionNoteandoutcomeNote. - Updates domain validation and mapping/transformer layers to carry the new fields through command → aggregate → entity → DTO.
- Adds migration and expands unit/integration test coverage for the new behaviour.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/test/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/integration/eligibility/response/GetEligibilityReponses.kt | Updates expected eligibility JSON to include the new note fields. |
| src/test/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/integration/dutytorefer/json/DutyToReferJson.kt | Extends test JSON builders/expected responses with submissionNote/outcomeNote. |
| src/test/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/integration/dutytorefer/DutyToReferControllerIT.kt | Adds integration tests around persisting/returning notes and ignoring blank notes. |
| query/src/test/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/query/unit/dutytorefer/DutyToReferTransformerTest.kt | Verifies query transformer maps note fields. |
| query/src/main/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/query/dutytorefer/DutyToReferTransformer.kt | Maps entity note columns to DTO. |
| mutation/src/test/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/mutation/unit/domain/aggregate/DutyToReferAggregateTest.kt | Adds unit coverage for note validation and applicability rules. |
| mutation/src/test/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/mutation/unit/application/mapper/DutyToReferMapperTest.kt | Verifies mapper carries note fields across snapshot/entity/DTO. |
| mutation/src/test/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/mutation/factories/DutyToReferSnapshotFactory.kt | Extends snapshot factory to include new note fields. |
| mutation/src/main/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/mutation/domain/exceptions/DutyToReferExceptions.kt | Introduces new domain exceptions for note applicability. |
| mutation/src/main/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/mutation/domain/aggregate/DutyToReferAggregate.kt | Adds note state to aggregate + validation rules and snapshot fields. |
| mutation/src/main/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/mutation/application/service/DutyToReferApplicationService.kt | Passes note fields into aggregate updates during create/update (create path needs a fix). |
| mutation/src/main/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/mutation/application/mapper/DutyToReferMapper.kt | Maps note fields between snapshot/entity/aggregate/DTO. |
| infrastructure/src/testFixtures/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/infrastructure/factories/DutyToReferEntityFactory.kt | Extends entity test factory with note fields. |
| infrastructure/src/main/resources/db/migration/V0032__add_notes_to_duty_to_refer.sql | Adds submission_note and outcome_note columns. |
| infrastructure/src/main/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/infrastructure/persistence/entity/DutyToReferEntity.kt | Adds entity fields for the new note columns. |
| common/src/main/kotlin/uk/gov/justice/digital/hmpps/singleaccommodationserviceapi/common/dtos/DutyToReferDto.kt | Extends command/DTO types to include submissionNote and outcomeNote. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
38
to
44
| aggregate.updateDutyToRefer( | ||
| localAuthorityAreaId = command.localAuthorityAreaId, | ||
| submissionDate = command.submissionDate, | ||
| referenceNumber = command.referenceNumber, | ||
| status = command.status, | ||
| submissionNote = command.submissionNote, | ||
| ) |
Contributor
Author
There was a problem hiding this comment.
this was intentional as outcomeNote should never be supplied or used during the create flow and is consistent with existing behaviour (withdrawlReason, outcomeReason etc)
016006f to
92413d9
Compare
f354adc to
37a2f4e
Compare
This file contains hidden or 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
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 adds support for accepting optional free-text notes during the DTR add submission and add outcome flow. As per the prototype, these notes can only be added during creating or updating a referral in SAS and should co-exist so they can be displayed together on the View Referral screen and updated at any time.
Changes
submissionNotefield/columnoutcomeNotefield/columnDutyToReferAggregate