Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

APS-2021: Cas1 offender entity. #3091

Merged
merged 1 commit into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package uk.gov.justice.digital.hmpps.approvedpremisesapi.jpa.entity.cas1

import jakarta.persistence.Entity
import jakarta.persistence.Id
import jakarta.persistence.Table
import java.time.OffsetDateTime
import java.util.UUID

@Entity
@Table(name = "cas1_offenders")
data class Cas1OffenderEntity(
@Id
val id: UUID,
val crn: String,
val nomsNumber: String?,
/**
* The offender name. This should only be used for search purposes (i.e. SQL)
* If returning the offender name to the user, use the [OffenderService], which
* will consider any LAO restrictions
*/
val name: String,
val tier: String?,
val createdAt: OffsetDateTime,
val lastUpdatedAt: OffsetDateTime,

)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CREATE TABLE cas1_offenders (
id UUID NOT NULL ,
crn TEXT NOT NULL ,
noms_number TEXT,
tier TEXT,
Copy link
Contributor

Choose a reason for hiding this comment

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

for the tier can we please use the custom collation specified in APS-1782. I've tried this locally, hopefully it works via flyway SQL:

CREATE COLLATION cas1_tier (provider = icu, locale = 'en-GB', 
rules = $$ 
& ' ' <*a-z <*A-Z < 9 < 8 < 7 < 6 < 5 < 4 < 3 < 2 < 1 < 0 
$$);

CREATE TABLE collation_test(
 value text NULL COLLATE "cas1_tier"
);

name TEXT NOT NULL ,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
last_updated_at TIMESTAMP WITH TIME ZONE NOT NULL,
PRIMARY KEY (id)
);
Loading