Skip to content

Commit

Permalink
[Reporting] add isInfractionProven prop
Browse files Browse the repository at this point in the history
  • Loading branch information
claire2212 committed May 23, 2024
1 parent 57514fb commit 24bbcb8
Show file tree
Hide file tree
Showing 17 changed files with 223 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ data class ReportingEntity(
val attachedEnvActionId: UUID? = null,
val updatedAtUtc: ZonedDateTime? = null,
val withVHFAnswer: Boolean? = null,
val isInfractionProven: Boolean,
) {
fun validate() {
when (sourceType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ data class CreateOrUpdateReportingDataInput(
val attachedEnvActionId: UUID? = null,
val updatedAtUtc: ZonedDateTime? = null,
val withVHFAnswer: Boolean? = null,
val isInfractionProven: Boolean,
) {
fun toReportingEntity(): ReportingEntity {
return ReportingEntity(
Expand Down Expand Up @@ -69,6 +70,7 @@ data class CreateOrUpdateReportingDataInput(
attachedEnvActionId = this.attachedEnvActionId,
updatedAtUtc = this.updatedAtUtc,
withVHFAnswer = this.withVHFAnswer,
isInfractionProven = this.isInfractionProven,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ data class ReportingDataOutput(
val controlStatus: ControlStatusEnum? = null,
val updatedAtUtc: ZonedDateTime? = null,
val withVHFAnswer: Boolean? = null,
val isInfractionProven: Boolean,
) {
companion object {
fun fromReportingDTO(
Expand Down Expand Up @@ -118,6 +119,7 @@ data class ReportingDataOutput(
controlStatus = dto.controlStatus,
updatedAtUtc = dto.reporting.updatedAtUtc,
withVHFAnswer = dto.reporting.withVHFAnswer,
isInfractionProven = dto.reporting.isInfractionProven,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ data class ReportingsDataOutput(
val attachedEnvActionId: UUID? = null,
val controlStatus: ControlStatusEnum? = null,
val withVHFAnswer: Boolean? = null,
val isInfractionProven: Boolean,
) {
companion object {
fun fromReportingDTO(
Expand Down Expand Up @@ -87,6 +88,7 @@ data class ReportingsDataOutput(
attachedEnvActionId = dto.reporting.attachedEnvActionId,
controlStatus = dto.controlStatus,
withVHFAnswer = dto.reporting.withVHFAnswer,
isInfractionProven = dto.reporting.isInfractionProven,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class ReportingModel(
val attachedEnvAction: EnvActionModel? = null,
@Column(name = "updated_at_utc") @UpdateTimestamp val updatedAtUtc: Instant? = null,
@Column(name = "with_vhf_answer") val withVHFAnswer: Boolean? = null,
@Column(name = "is_infraction_proven") val isInfractionProven: Boolean,
) {

fun toReporting() =
Expand Down Expand Up @@ -162,6 +163,7 @@ class ReportingModel(
attachedEnvActionId = attachedEnvAction?.id,
updatedAtUtc = updatedAtUtc?.atZone(UTC),
withVHFAnswer = withVHFAnswer,
isInfractionProven = isInfractionProven,
)

fun toReportingDTO(objectMapper: ObjectMapper) =
Expand Down Expand Up @@ -236,6 +238,7 @@ class ReportingModel(
attachedEnvAction = envActionReference,
updatedAtUtc = reporting.updatedAtUtc?.toInstant(),
withVHFAnswer = reporting.withVHFAnswer,
isInfractionProven = reporting.isInfractionProven,
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE public.reportings ADD COLUMN is_infraction_proven boolean NOT NULL DEFAULT TRUE;
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class CreateOrUpdateReportingUTests {
isDeleted = false,
updatedAtUtc = ZonedDateTime.now(),
openBy = "CDA",
isInfractionProven = true,
)
val reportingWithSemaphoreDTO =
ReportingDTO(
Expand All @@ -124,6 +125,7 @@ class CreateOrUpdateReportingUTests {
isDeleted = false,
updatedAtUtc = ZonedDateTime.now(),
openBy = "CDA",
isInfractionProven = true,
),
)
val reportingWithControlUnit =
Expand All @@ -147,6 +149,7 @@ class CreateOrUpdateReportingUTests {
isDeleted = false,
updatedAtUtc = ZonedDateTime.now(),
openBy = "CDA",
isInfractionProven = true,
)
val reportingWithControlUnitDTO =
ReportingDTO(
Expand All @@ -171,6 +174,7 @@ class CreateOrUpdateReportingUTests {
isDeleted = false,
updatedAtUtc = ZonedDateTime.now(),
openBy = "CDA",
isInfractionProven = true,
),
)

Expand Down Expand Up @@ -270,6 +274,7 @@ class CreateOrUpdateReportingUTests {
isDeleted = false,
updatedAtUtc = ZonedDateTime.now(),
openBy = "CDA",
isInfractionProven = true,
)

// When
Expand Down Expand Up @@ -319,6 +324,7 @@ class CreateOrUpdateReportingUTests {
isDeleted = false,
updatedAtUtc = ZonedDateTime.now(),
openBy = "CDA",
isInfractionProven = true,
)

// When
Expand Down Expand Up @@ -368,6 +374,7 @@ class CreateOrUpdateReportingUTests {
isDeleted = false,
updatedAtUtc = ZonedDateTime.now(),
openBy = "CDA",
isInfractionProven = true,
)

val reportingWithSemaphoreId =
Expand All @@ -390,6 +397,7 @@ class CreateOrUpdateReportingUTests {
isDeleted = false,
updatedAtUtc = ZonedDateTime.now(),
openBy = "CDA",
isInfractionProven = true,
)
val reportingWithoutSourceName =
ReportingEntity(
Expand All @@ -410,6 +418,7 @@ class CreateOrUpdateReportingUTests {
isDeleted = false,
updatedAtUtc = ZonedDateTime.now(),
openBy = "CDA",
isInfractionProven = true,
)

// When
Expand Down Expand Up @@ -496,6 +505,7 @@ class CreateOrUpdateReportingUTests {
attachedToMissionAtUtc = ZonedDateTime.parse("2022-01-15T04:50:09Z"),
detachedFromMissionAtUtc = null,
updatedAtUtc = ZonedDateTime.now(),
isInfractionProven = true,
)

// given(reportingRepository.save(reportingWithNewAttachedMission))
Expand Down Expand Up @@ -528,6 +538,7 @@ class CreateOrUpdateReportingUTests {
ZonedDateTime.parse("2023-08-15T04:50:09Z"),
detachedFromMissionAtUtc = null,
updatedAtUtc = ZonedDateTime.now(),
isInfractionProven = true,
),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ val FAKE_REPORTING =
attachedToMissionAtUtc = null,
detachedFromMissionAtUtc = null,
attachedEnvActionId = null,
isInfractionProven = true,
)

@ExtendWith(SpringExtension::class)
Expand Down
Loading

0 comments on commit 24bbcb8

Please sign in to comment.