generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into dev-feature-notifications-workflow-orches…
…trator-graphql
- Loading branch information
Showing
63 changed files
with
3,089 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run Gradle Test | ||
run: ./gradlew test | ||
run: ./gradlew test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...graphql-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/ReportContentType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package gov.cdc.ocio.processingstatusapi.models | ||
|
||
/** | ||
* Enumeration of the possible sort orders for queries. | ||
*/ | ||
enum class ReportContentType (val type: String){ | ||
JSON("application/json"), | ||
JSON_SHORT("json"), | ||
BASE64("base64"); | ||
|
||
companion object { | ||
fun fromString(type: String): ReportContentType { | ||
return values().find { it.type.equals(type, ignoreCase = true) } | ||
?: throw IllegalArgumentException("Unsupported content type: $type") | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/reports/inputs/DataInput.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package gov.cdc.ocio.processingstatusapi.models.reports.inputs | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
|
||
@GraphQLDescription("Input type for tags") | ||
data class DataInput( | ||
@GraphQLDescription("Tag key") | ||
val key: String, | ||
|
||
@GraphQLDescription("Tag value") | ||
val value: String | ||
) |
12 changes: 12 additions & 0 deletions
12
...ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/reports/inputs/IssueInput.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package gov.cdc.ocio.processingstatusapi.models.reports.inputs | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
|
||
@GraphQLDescription("Input type for issues") | ||
data class IssueInput( | ||
@GraphQLDescription("Issue code") | ||
val code: String? = null, | ||
|
||
@GraphQLDescription("Issue description") | ||
val description: String? = null | ||
) |
19 changes: 19 additions & 0 deletions
19
...ain/kotlin/gov/cdc/ocio/processingstatusapi/models/reports/inputs/MessageMetadataInput.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package gov.cdc.ocio.processingstatusapi.models.reports.inputs | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
import gov.cdc.ocio.processingstatusapi.models.submission.Aggregation | ||
|
||
@GraphQLDescription("Input type for message metadata") | ||
data class MessageMetadataInput( | ||
@GraphQLDescription("Unique Identifier for that message") | ||
val messageUUID: String? = null, | ||
|
||
@GraphQLDescription("MessageHash value") | ||
val messageHash: String? = null, | ||
|
||
@GraphQLDescription("Single or Batch message") | ||
val aggregation: Aggregation? = null, | ||
|
||
@GraphQLDescription("Message Index") | ||
val messageIndex: Int? = null | ||
) |
55 changes: 55 additions & 0 deletions
55
...tor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/reports/inputs/ReportInput.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package gov.cdc.ocio.processingstatusapi.models.reports.inputs | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
import java.time.OffsetDateTime | ||
|
||
@GraphQLDescription("Input type for creating or updating a report") | ||
data class ReportInput( | ||
@GraphQLDescription("Identifier of the report recorded by the database") | ||
val id: String? = null, | ||
|
||
@GraphQLDescription("Upload identifier this report belongs to") | ||
val uploadId: String? = null, | ||
|
||
@GraphQLDescription("Unique report identifier") | ||
val reportId: String? = null, | ||
|
||
@GraphQLDescription("Data stream ID") | ||
val dataStreamId: String? = null, | ||
|
||
@GraphQLDescription("Data stream route") | ||
val dataStreamRoute: String? = null, | ||
|
||
@GraphQLDescription("Date/time of when the upload was first ingested into the data-exchange") | ||
val dexIngestDateTime: OffsetDateTime? = null, | ||
|
||
@GraphQLDescription("Message metadata") | ||
val messageMetadata: MessageMetadataInput? = null, | ||
|
||
@GraphQLDescription("Stage info") | ||
val stageInfo: StageInfoInput? = null, | ||
|
||
@GraphQLDescription("Tags") | ||
val tags: List<TagInput>? = null, | ||
|
||
@GraphQLDescription("Data") | ||
val data: List<DataInput>? = null, | ||
|
||
@GraphQLDescription("Indicates the content type of the content; e.g. JSON, XML") | ||
val contentType: String? = null, | ||
|
||
@GraphQLDescription("Jurisdiction report belongs to; set to null if not applicable") | ||
val jurisdiction: String? = null, | ||
|
||
@GraphQLDescription("Sender ID this report belongs to; set to null if not applicable") | ||
val senderId: String? = null, | ||
|
||
@GraphQLDescription("Data Producer ID stated in the report; set to null if not applicable") | ||
val dataProducerId: String? = null, | ||
|
||
@GraphQLDescription("Content of the report. If the report is JSON then the content will be a map, otherwise, it will be a string") | ||
var content : String? = null, | ||
|
||
@GraphQLDescription("Timestamp when the report was recorded in the database") | ||
val timestamp: OffsetDateTime? = null | ||
) |
29 changes: 29 additions & 0 deletions
29
.../src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/reports/inputs/StageInfoInput.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package gov.cdc.ocio.processingstatusapi.models.reports.inputs | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
import gov.cdc.ocio.processingstatusapi.models.submission.Status | ||
import java.time.OffsetDateTime | ||
|
||
@GraphQLDescription("Input type for stage info") | ||
data class StageInfoInput( | ||
@GraphQLDescription("Service") | ||
val service: String? = null, | ||
|
||
@GraphQLDescription("Stage name a.k.a action") | ||
val action: String? = null, | ||
|
||
@GraphQLDescription("Version") | ||
val version: String? = null, | ||
|
||
@GraphQLDescription("Status- SUCCESS OR FAILURE") | ||
val status: Status? = null, | ||
|
||
@GraphQLDescription("Issues array") | ||
val issues: List<IssueInput>? = null, | ||
|
||
@GraphQLDescription("Start processing time") | ||
val startProcessingTime: OffsetDateTime? = null, | ||
|
||
@GraphQLDescription("End processing time") | ||
val endProcessingTime: OffsetDateTime? = null | ||
) |
12 changes: 12 additions & 0 deletions
12
...l-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/models/reports/inputs/TagInput.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package gov.cdc.ocio.processingstatusapi.models.reports.inputs | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
|
||
@GraphQLDescription("Input type for tags") | ||
data class TagInput( | ||
@GraphQLDescription("Tag key") | ||
val key: String, | ||
|
||
@GraphQLDescription("Tag value") | ||
val value: String | ||
) |
51 changes: 51 additions & 0 deletions
51
...graphql-ktor/src/main/kotlin/gov/cdc/ocio/processingstatusapi/mutations/ReportMutation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package gov.cdc.ocio.processingstatusapi.mutations | ||
|
||
import com.expediagroup.graphql.generator.annotations.GraphQLDescription | ||
import com.expediagroup.graphql.server.operations.Mutation | ||
import gov.cdc.ocio.processingstatusapi.exceptions.BadRequestException | ||
import gov.cdc.ocio.processingstatusapi.exceptions.ContentException | ||
import gov.cdc.ocio.processingstatusapi.models.reports.inputs.ReportInput | ||
import gov.cdc.ocio.processingstatusapi.services.ReportMutationService | ||
|
||
/** | ||
* ReportMutationService class handles GraphQL mutations for report creation and replacement. | ||
* | ||
* This service provides a single mutation operation to either create a new report or replace an | ||
* existing report in the system. It utilizes the ReportMutation class to perform the actual | ||
* upsert operation based on the provided input and action. | ||
* | ||
* Annotations: | ||
* - GraphQLDescription: Provides descriptions for the class and its methods for GraphQL documentation. | ||
* | ||
* Dependencies: | ||
* - ReportInput: Represents the input model for report data. | ||
*/ | ||
@GraphQLDescription("A Mutation Service to either create a new report or replace an existing report") | ||
class ReportMutation() : Mutation { | ||
|
||
/** | ||
* Upserts a report based on the provided input and action. | ||
* | ||
* This function serves as a GraphQL mutation to create a new report or replace an existing one. | ||
* It delegates the actual upsert logic to the ReportMutation class. | ||
* | ||
* @param input The ReportInput containing details of the report to be created or replaced. | ||
* @param action A string specifying the action to perform: "create" or "replace". | ||
* @return The result of the upsert operation, handled by the ReportMutation class. | ||
*/ | ||
@GraphQLDescription("Create upload") | ||
@Suppress("unused") | ||
@Throws(BadRequestException::class, ContentException::class, Exception::class) | ||
fun upsertReport( | ||
@GraphQLDescription( | ||
"*Report Input* to be created or updated:\n" | ||
) | ||
input: ReportInput, | ||
@GraphQLDescription( | ||
"*Action*: Can be one of the following values\n" | ||
+ "`create`: Create new report\n" | ||
+ "`replace`: Replace existing report\n" | ||
) | ||
action: String | ||
) = ReportMutationService().upsertReport(input, action) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.