Skip to content

Commit

Permalink
midlertidig simuler MANGLER_KOFUVI i dev
Browse files Browse the repository at this point in the history
  • Loading branch information
kenglxn committed Oct 12, 2023
1 parent f29cd9e commit b2c9a52
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package no.nav.arbeidsgiver.min_side.varslingstatus

import no.nav.arbeidsgiver.min_side.config.GittMiljø
import no.nav.arbeidsgiver.min_side.controller.AuthenticatedUserHolder
import no.nav.arbeidsgiver.min_side.services.altinn.AltinnService
import no.nav.arbeidsgiver.min_side.varslingstatus.VarslingStatusDto.Status
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController
Expand All @@ -13,8 +15,25 @@ class VarslingStatusController(
private val authenticatedUserHolder: AuthenticatedUserHolder,
private val altinnService: AltinnService,
private val repository: VarslingStatusRepository,
private val gittMiljø: GittMiljø,
) {

/**
* midlertidig simuler mangler kofuvi i dev da dette mangler.
* TODO: fjern før merge
*/
fun mapStatus(varslingStatus: VarslingStatus) = gittMiljø.resolve(
prod = {
varslingStatus
},
other = {
when(varslingStatus.status) {
Status.OK -> varslingStatus
else -> varslingStatus.copy(status = Status.MANGLER_KOFUVI)
}
},
)

@PostMapping("/api/varslingStatus/v1")
fun getVarslingStatus(@RequestBody requestBody: VarslingStatusRequest): VarslingStatus {
val virksomhetsnummer = requestBody.virksomhetsnummer
Expand All @@ -29,7 +48,7 @@ class VarslingStatusController(
)
}

return repository.varslingStatus(virksomhetsnummer = virksomhetsnummer)
return mapStatus(repository.varslingStatus(virksomhetsnummer = virksomhetsnummer))
}

data class VarslingStatusRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.ObjectMapper
import no.nav.arbeidsgiver.min_side.varslingstatus.VarslingStatusDto.Status
import org.apache.kafka.clients.consumer.ConsumerRecord
import org.springframework.context.annotation.Profile
import org.springframework.jdbc.core.JdbcTemplate
Expand Down Expand Up @@ -97,12 +98,12 @@ data class VarslingStatusDto @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) co
@param:JsonProperty("kvittertEventTimestamp") val eventTimestamp: Instant,
@param:JsonProperty("status") val status: Status,
@param:JsonProperty("version") val version: String,
)

enum class Status {
OK,
MANGLER_KOFUVI,
ANNEN_FEIL,
) {
enum class Status {
OK,
MANGLER_KOFUVI,
ANNEN_FEIL,
}
}


0 comments on commit b2c9a52

Please sign in to comment.