Skip to content

Commit

Permalink
14350: update submission to be agnostic of steps (#14951)
Browse files Browse the repository at this point in the history
* Move common idea config to repo route

* 14350: DB tests for submission history

* Move kotlin style config to root of project

* fixup! 14350: DB tests for submission history

* 14359: make the submission history unaware of the steps

* fixup! 14359: make the submission history unaware of the steps

* fixup! 14359: make the submission history unaware of the steps

* 14359: update location header in report function

* fixup! 14359: make the submission history unaware of the steps

* fixup! 14359: update location header in report function

* fixup! Merge branch 'master' into platform/kalish/14350-update-submission-to-be-agnostic-of-steps

* fixup! 14359: make the submission history unaware of the steps

* fixup! 14359: make the submission history unaware of the steps

* fixup! 14359: make the submission history unaware of the steps

* fixup! 14359: make the submission history unaware of the steps

* fixup! 14359: make the submission history unaware of the steps

* PR feedback
  • Loading branch information
mkalish authored Jul 12, 2024
1 parent ded8dbb commit f7fe95e
Show file tree
Hide file tree
Showing 18 changed files with 853 additions and 1,372 deletions.
25 changes: 25 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions prime-router/src/main/kotlin/azure/DatabaseAccess.kt
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ class DatabaseAccess(val create: DSLContext) : Logging {
txn: DataAccessTransaction? = null,
): CovidResultMetadata? {
val ctx = if (txn != null) DSL.using(txn) else create
return ctx.selectFrom(Tables.COVID_RESULT_METADATA)
.where(Tables.COVID_RESULT_METADATA.MESSAGE_ID.eq(messageID.toString()))
return ctx.selectFrom(COVID_RESULT_METADATA)
.where(COVID_RESULT_METADATA.MESSAGE_ID.eq(messageID.toString()))
.fetchOne()
?.into(CovidResultMetadata::class.java)
}
Expand Down Expand Up @@ -476,11 +476,11 @@ class DatabaseAccess(val create: DSLContext) : Logging {
): List<DetailedActionLog> {
val ctx = if (txn != null) DSL.using(txn) else create
return ctx
.selectFrom(Tables.ACTION_LOG)
.selectFrom(ACTION_LOG)
.where(
Tables.ACTION_LOG.REPORT_ID.eq(reportId)
.and(Tables.ACTION_LOG.TRACKING_ID.eq(trackingId))
.and(Tables.ACTION_LOG.TYPE.eq(type))
ACTION_LOG.REPORT_ID.eq(reportId)
.and(ACTION_LOG.TRACKING_ID.eq(trackingId))
.and(ACTION_LOG.TYPE.eq(type))
)
.limit(100)
.fetchInto(DetailedActionLog::class.java)
Expand Down Expand Up @@ -1280,8 +1280,8 @@ class DatabaseAccess(val create: DSLContext) : Logging {
// todo: migrate away from the covid test data which is legacy
// we are going to have a more generic full elr table that we want to use
// instead, but for now we need to maintain the older covid result metadata table
DatabaseAccess.saveTestData(actionHistory.elrMetaDataRecords, txn)
DatabaseAccess.saveCovidTestData(actionHistory.covidResultMetadataRecords, txn)
saveTestData(actionHistory.elrMetaDataRecords, txn)
saveCovidTestData(actionHistory.covidResultMetadataRecords, txn)

// generate lineage records
actionHistory.generateLineages()
Expand Down Expand Up @@ -1347,8 +1347,8 @@ class DatabaseAccess(val create: DSLContext) : Logging {
/**
* Inserts the provided [actionLog] using [txn] as the data context.
*/
private fun insertActionLog(actionLog: ActionLog, txn: Configuration) {
val detailRecord = DSL.using(txn).newRecord(Tables.ACTION_LOG, actionLog)
fun insertActionLog(actionLog: ActionLog, txn: Configuration) {
val detailRecord = DSL.using(txn).newRecord(ACTION_LOG, actionLog)
detailRecord.store()
}

Expand Down
6 changes: 4 additions & 2 deletions prime-router/src/main/kotlin/azure/ReportFunction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ class ReportFunction(
workflowEngine.recordAction(actionHistory)

check(actionHistory.action.actionId > 0)
val submission = SubmissionsFacade.instance.findDetailedSubmissionHistory(actionHistory.action)
val submission = workflowEngine.db.transactReturning { txn ->
SubmissionsFacade.instance.findDetailedSubmissionHistory(txn, null, actionHistory.action)
}

val response = request.createResponseBuilder(httpStatus)
.header(HttpHeaders.CONTENT_TYPE, "application/json")
Expand All @@ -236,7 +238,7 @@ class ReportFunction(
.header(
HttpHeaders.LOCATION,
request.uri.resolve(
"/api/history/${sender.organizationName}/submissions/${actionHistory.action.actionId}"
"/api/waters/report/${submission?.reportId}/history"
).toString()
)
.build()
Expand Down
7 changes: 7 additions & 0 deletions prime-router/src/main/kotlin/history/ReportHistory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import gov.cdc.prime.router.ActionLogScope
import gov.cdc.prime.router.ErrorCode
import gov.cdc.prime.router.ItemActionLogDetail
import gov.cdc.prime.router.Topic
import gov.cdc.prime.router.azure.db.enums.TaskAction
import java.time.OffsetDateTime
import java.util.UUID

Expand Down Expand Up @@ -77,6 +78,12 @@ data class DetailedReport(
val itemCountBeforeQualFilter: Int?,
@JsonIgnore
val receiverHasTransport: Boolean,
@JsonIgnore
val transportResult: String?,
@JsonIgnore
val downloadedBy: String?,
@JsonIgnore
val nextAction: TaskAction?,
)

/**
Expand Down
Loading

0 comments on commit f7fe95e

Please sign in to comment.