diff options
| author | Paul-Christian Volkmer | 2024-04-29 10:11:25 +0200 |
|---|---|---|
| committer | Paul-Christian Volkmer | 2024-04-29 10:11:25 +0200 |
| commit | 5fcc24f915f0e91106b5890e81854720e9ead1a4 (patch) | |
| tree | fa5029d531b228561c405a6b629a145289d8b507 /src/main/kotlin/dev/dnpm | |
| parent | 3bd7239812bd17a30f7a812747790018f7ae96b5 (diff) | |
refactor: add additional constructors
Diffstat (limited to 'src/main/kotlin/dev/dnpm')
| -rw-r--r-- | src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt | 23 | ||||
| -rw-r--r-- | src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt | 24 |
2 files changed, 34 insertions, 13 deletions
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt b/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt index 976c333..79a3a5b 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt @@ -43,7 +43,28 @@ data class Request( var status: RequestStatus, var processedAt: Instant = Instant.now(), @Embedded.Nullable var report: Report? = null -) +) { + constructor( + uuid: String, + patientId: String, + pid: String, + fingerprint: String, + type: RequestType, + status: RequestStatus + ) : + this(null, uuid, patientId, pid, fingerprint, type, status, Instant.now()) + + constructor( + uuid: String, + patientId: String, + pid: String, + fingerprint: String, + type: RequestType, + status: RequestStatus, + processedAt: Instant + ) : + this(null, uuid, patientId, pid, fingerprint, type, status, processedAt) +} @JvmRecord data class Report( diff --git a/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt b/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt index bdf07cb..939af16 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt @@ -62,12 +62,12 @@ class RequestProcessor( requestService.save( Request( - uuid = requestId, - patientId = request.mtbFile.patient.id, - pid = pid, - fingerprint = fingerprint(request.mtbFile), - status = RequestStatus.UNKNOWN, - type = RequestType.MTB_FILE + requestId, + request.mtbFile.patient.id, + pid, + fingerprint(request.mtbFile), + RequestType.MTB_FILE, + RequestStatus.UNKNOWN ) ) @@ -117,12 +117,12 @@ class RequestProcessor( requestService.save( Request( - uuid = requestId, - patientId = patientPseudonym, - pid = patientId, - fingerprint = fingerprint(patientPseudonym), - status = RequestStatus.UNKNOWN, - type = RequestType.DELETE + requestId, + patientPseudonym, + patientId, + fingerprint(patientPseudonym), + RequestType.DELETE, + RequestStatus.UNKNOWN ) ) |
