Skip to content

Commit

Permalink
BR-63 update of model to use status instead of type
Browse files Browse the repository at this point in the history
BR-63 update of model to use status instead of type
  • Loading branch information
peter-bcl authored Mar 7, 2025
1 parent 447b0fb commit f1847af
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data class AddressEntity(
@Id
val id: UUID = UUID.randomUUID(),
val addressId: Long,
val type: String? = null,
val status: String? = null,
val buildingName: String? = null,
val addressNumber: String? = null,
val streetName: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty

data class Address(
val addressId: Long,
val type: String? = null,
val status: String? = null,
val buildingName: String? = null,
@JsonProperty("buildingNumber")
val addressNumber: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class BreachNoticeService(

private fun AddressEntity.toModel() = Address(
addressId = addressId,
type = type,
status = status,
buildingName = buildingName,
addressNumber = addressNumber,
streetName = streetName,
Expand All @@ -216,7 +216,7 @@ class BreachNoticeService(

private fun Address.toEntity(existingEntity: AddressEntity? = null) = existingEntity?.copy(
addressId = addressId,
type = type,
status = status,
buildingName = buildingName,
addressNumber = addressNumber,
streetName = streetName,
Expand All @@ -226,7 +226,7 @@ class BreachNoticeService(
postcode = postcode,
) ?: AddressEntity(
addressId = addressId,
type = type,
status = status,
buildingName = buildingName,
addressNumber = addressNumber,
streetName = streetName,
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/db/migration/V1_4__address_status.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE public.address RENAME COLUMN type to status;
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class BreachNoticeCrudTests : IntegrationTestBase() {
completedDate = LocalDateTime.now(),
offenderAddress = Address(
addressId = 25,
type = "ENDO",
status = "ENDO",
buildingName = "MOO",
),
replyAddress = null,
Expand Down Expand Up @@ -129,7 +129,7 @@ class BreachNoticeCrudTests : IntegrationTestBase() {
completedDate = LocalDateTime.now(),
offenderAddress = Address(
addressId = 25,
type = "ENDO",
status = "ENDO",
buildingName = "MOO",
),
replyAddress = null,
Expand Down

0 comments on commit f1847af

Please sign in to comment.