-
Notifications
You must be signed in to change notification settings - Fork 3
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
Cas2bail/main #2641
base: main
Are you sure you want to change the base?
Cas2bail/main #2641
Conversation
Looks like this snuck in - src/main/kotlin/uk/gov/justice/digital/hmpps/approvedpremisesapi/controller/cas2bail/.keep. Could you please remove and add .keep to the .gitignore file |
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.
Hiya. I've done a first pass on this. You may want to ignore the comments where i'm suggesting code copied from CAS2 my want improving as i'm not sure what the agreed approach is here (e.g. remove use of deprecated functions)
@@ -67,7 +71,8 @@ logging: | |||
org.hibernate.SQL: DEBUG | |||
# Uncomment the two entries below to see SQL binding | |||
#org.hibernate.orm.jdbc.bind: TRACE | |||
#org.hibernate.type.descriptor.sql.BasicBinder: TRACE | |||
org.hibernate.type.descriptor.sql.BasicBinder: TRACE | |||
org.hibernate.type.descriptor.sql: tract |
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.
could you please revert this as it makes the logs quite noisy by default
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.
Yes done
( | ||
id UUID NOT NULL, | ||
application_id UUID, | ||
created_at TIMESTAMP WITHOUT TIME ZONE, |
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.
we use timestamptz everywhere so should do the same for all entries here
It's also not recommended by postgres - https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_timestamp_.28without_time_zone.29
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.
Yes done
@@ -1943,6 +1943,49 @@ components: | |||
- personName | |||
- crn | |||
- nomsNumber | |||
Cas2BailApplicationSummary: |
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 should go in cas2bail-schemas.yml?
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.
Agreed done
|
||
# GARETH above here | ||
|
||
# TOBY below here |
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.
?
@Service( | ||
"uk.gov.justice.digital.hmpps.approvedpremisesapi.controller.cas2bail" + | ||
".Cas2BailApplicationsController", | ||
) |
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.
because the class name is unique within the project, you shouldn't need to specify a value in the @service annotation
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.
Agreed done.
if (application.createdByUser.email != null) { | ||
emailNotificationService.sendCas2Email( | ||
recipientEmailAddress = application.createdByUser.email!!, | ||
templateId = notifyConfig.templates.cas2NoteAddedForReferrer, |
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.
are the existing cas2 email templates (defined in notify) going to be ok for cas2 bail?
return sanitisedData | ||
} | ||
return null | ||
} |
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.
code like this feels suitable for reuse instead of copy-pasting?
|
||
|
||
fun transformJpaToApi(jpa: Cas2BailApplicationEntity, personInfo: PersonInfoResult): Cas2Application { | ||
return Cas2Application( |
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.
just to confirm - we're reusing the Cas2Application API type for Cas2Bail?
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.
Currently yes but this will likely change
id UUID NOT NULL, | ||
application_id UUID, | ||
created_at TIMESTAMP WITHOUT TIME ZONE, | ||
body VARCHAR(255), |
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.
we should use text
it's not recommended to use VARCHAR - https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_varchar.28n.29_by_default
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.
Yes done.
id UUID NOT NULL, | ||
application_id UUID, | ||
created_at TIMESTAMP WITHOUT TIME ZONE, | ||
body VARCHAR(255), |
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.
can you please revise this file to match the Cas2 database types on equivalent tables? If you think they're wrong give me a shout and we can discuss
val newStatus = statusUpdate.status() | ||
val assessor = statusUpdate.assessor | ||
|
||
domainEventService.saveCas2ApplicationStatusUpdatedDomainEvent( |
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.
sanity check - are we ok with reusing existing CAS2 domain events for CAS2 bail applications?
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.
For now we are using them but we expect them to possibly change.
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 don't think this the approach we should be taking, copying and pasting wholesale with tweaks.
As far as i understood it the aim was to reuse the existing back end endpoints and DB for as much of the CAS2 bail with differentiators added as needed.
i don't understand the rationale behind the change in approach, other than to de risk CAS 2 HDC now - but is most likely a false economy.
I think by doing this we are incurring a large amount of technical debt which the internal team will have to pay down and dual maintain. I am keen for us to avoid that. I am not recommending we merge this at this stage until we've worked out the best way forward.
) | ||
|
||
) { | ||
is AuthorisableActionResult.NotFound -> null |
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.
my position is we shouldn't use deprecated code, and use the latest pattern we have. please can we do this?
No description provided.