Skip to content
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

Add basic auditing #27

Closed

Conversation

dhirajshettymoj
Copy link
Contributor

Add VisitOrderAllocationJob and VisitOrderPrisonAllocationJob for basic audit to audit basic details like job start and end times.

import jakarta.persistence.MappedSuperclass

@MappedSuperclass
abstract class AbstractIdEntity {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

copied this over from visit-scheduler

import java.time.LocalDateTime

@MappedSuperclass
abstract class AbstractReferenceEntity(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

copied this over from visit-scheduler

@@ -43,7 +43,7 @@ class StartVisitAllocationByPrisonController(
],
)
fun triggerVisitAllocationByPrison(): ResponseEntity<String> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we have a DTO here instead of a ResponseEntity. DTO can contain the id / reference, and you can still log to LOG.info the success message + id / reference, within the service

@Table(name = "VISIT_ORDER_ALLOCATION_PRISON_JOB")
class VisitOrderAllocationPrisonJob(
@Column(nullable = false)
val allocationJobReference: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need a reference? Or can we use the ID column to keep in theme with the rest of the service? A reference would be good if we're exposing it to end users etc, but I don't think we'll ever do this?

log.info("Total active prisons for visit allocation job = ${activePrisons.size}")

activePrisons.forEach {
sendSqsMessageForPrison(it.prisonCode)
val prisonCode = it.prisonCode
auditOrderAllocationPrisonJob(allocationJobReference, prisonCode)
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we create the job before it's run, should we do this at the end? What happens if a job is saved, but it errors / fails to complete?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants