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

Create report mutation #186

Merged
merged 22 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e7e7351
Send Date with milliseconds for getUploads.
mtammineni Sep 11, 2024
eb1a528
Create Report Mutation
mtammineni Sep 11, 2024
6444ed9
Promoting event-sink-reader from spikes into development
mtammineni Sep 11, 2024
ff51355
Add test configuration for running the unit tests from gradle
mtammineni Sep 12, 2024
2caf485
Update graphql-service-ci.yml
uek3-cdc Sep 12, 2024
b3365ed
Update graphql-service-ci.yml
mtammineni Sep 12, 2024
95dec1b
Add source directories to gradle build
mtammineni Sep 12, 2024
6796c6f
Get latest
mtammineni Sep 12, 2024
33edf6a
Update graphql-service-ci.yml
mtammineni Sep 12, 2024
ad6ef39
Merge branch 'develop' of https://github.com/CDCgov/data-exchange-pro…
mtammineni Sep 12, 2024
ced0dc0
Merge branch 'develop' into create-report-mutation
mtammineni Sep 12, 2024
a500d7c
Handle different types of content. Add class headers. Add function he…
mtammineni Sep 20, 2024
9fd37df
Add description headers. Create enums for the different content types…
mtammineni Sep 20, 2024
28fd0c6
Remove event-sink-reader from this commit
mtammineni Sep 20, 2024
d787262
Updated source sets for tests
mtammineni Sep 20, 2024
950fe39
Update graphql-service-ci.yml
mtammineni Sep 20, 2024
5a92c90
Code refactoring
mtammineni Sep 23, 2024
4fba376
Merge remote-tracking branch 'origin/create-report-mutation' into cre…
mtammineni Sep 23, 2024
3fc8b5a
Code refactoring
mtammineni Sep 23, 2024
5f35a43
Exception handling
mtammineni Sep 24, 2024
46a224f
Revert the changes for exception handling at the top level.
mtammineni Sep 24, 2024
8737e4d
Refactor Report Mutations
mtammineni Sep 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/graphql-service-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Run Gradle Test
run: ./gradlew test
run: ./gradlew test
35 changes: 31 additions & 4 deletions pstatus-graphql-ktor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ dependencies {
testImplementation "io.ktor:ktor-server-tests-jvm:$ktor_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"

// testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
// testImplementation 'org.mockito:mockito-core:4.6.1'
// testImplementation 'org.mockito:mockito-junit-jupiter:4.6.1'

testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.1"
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.8.1"
testImplementation "org.mockito:mockito-core:4.5.1"
Expand Down Expand Up @@ -108,4 +104,35 @@ jib {
}
}

test {

// Discover and execute JUnit Platform-based (JUnit 5, JUnit Jupiter) tests
// JUnit 5 has the ability to execute JUnit 4 tests as well
useJUnitPlatform()

//Change this to "true" if we want to execute unit tests
systemProperty("isTestEnvironment", "false")

// Set the test classpath, if required
}

sourceSets {
main {
java {
srcDir 'src/kotlin'
}
resources {
srcDir 'src/resources'
}
}
test {
java {
srcDir 'src/kotlin'
}
resources {
srcDir 'src/resources'
}
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fun KoinApplication.loadKoinModules(environment: ApplicationEnvironment): KoinAp
// Create a CosmosDB config that can be dependency injected (for health checks)
single(createdAtStart = true) { CosmosConfiguration(uri, authKey) }
}

return modules(listOf(cosmosModule))
}

Expand All @@ -34,15 +35,20 @@ fun main(args: Array<String>) {
}

fun Application.module() {
graphQLModule()
configureRouting()

install(Koin) {
loadKoinModules(environment)
}
graphQLModule()
configureRouting()

install(ContentNegotiation) {
jackson()
}




// See https://opensource.expediagroup.com/graphql-kotlin/docs/schema-generator/writing-schemas/scalars
RuntimeWiring.newRuntimeWiring().scalar(ExtendedScalars.Date)
}
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")
}
}
}
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
)
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
)
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
)
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
)
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
)
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
)
Loading
Loading