Skip to content

Commit

Permalink
Fixed duplicate order creation, removed Enum values
Browse files Browse the repository at this point in the history
  • Loading branch information
MormonJesus69420 committed Aug 22, 2024
1 parent 8358367 commit 5e0a5fa
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 39 deletions.
8 changes: 2 additions & 6 deletions src/main/kotlin/no/nb/mlt/wls/core/data/HostName.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package no.nb.mlt.wls.core.data

enum class HostName(private val hostName: String) {
AXIELL("Axiell");

override fun toString(): String {
return hostName
}
enum class HostName {
AXIELL
}
36 changes: 12 additions & 24 deletions src/main/kotlin/no/nb/mlt/wls/order/model/Order.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,32 +88,20 @@ data class OrderReceiver(
val phoneNumber: String?
)

enum class OrderStatus(private val status: String) {
NOT_STARTED("Not started"),
IN_PROGRESS("In progress"),
COMPLETED("Completed"),
DELETED("Deleted");

override fun toString(): String {
return status
}
enum class OrderStatus {
NOT_STARTED,
IN_PROGRESS,
COMPLETED,
DELETED
}

enum class OrderLineStatus(private val status: String) {
NOT_STARTED("Not started"),
PICKED("Picked"),
FAILED("Failed");

override fun toString(): String {
return status
}
enum class OrderLineStatus {
NOT_STARTED,
PICKED,
FAILED
}

enum class OrderType(private val type: String) {
LOAN("Loan"),
DIGITIZATION("Digitization") ;

override fun toString(): String {
return type
}
enum class OrderType {
LOAN,
DIGITIZATION
}
10 changes: 2 additions & 8 deletions src/main/kotlin/no/nb/mlt/wls/order/payloads/SynqOrderPayload.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package no.nb.mlt.wls.order.payloads

import com.fasterxml.jackson.annotation.JsonFormat
import com.fasterxml.jackson.annotation.JsonValue
import jakarta.validation.constraints.Min
import no.nb.mlt.wls.core.data.HostName
import no.nb.mlt.wls.core.data.synq.SynqOwner
Expand Down Expand Up @@ -32,13 +31,8 @@ data class SynqOrderPayload(
val quantityOrdered: Double
)

enum class SynqOrderType(private val type: String) {
STANDARD("Standard");

@JsonValue
override fun toString(): String {
return type
}
enum class SynqOrderType {
STANDARD
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class OrderService(val db: OrderRepository, val synqService: SynqOrderService) {
throwIfInvalidPayload(payload)

val existingOrder =
db.findByHostNameAndHostOrderId(payload.hostName, payload.orderId)
db.findByHostNameAndHostOrderId(payload.hostName, payload.hostOrderId)
.timeout(Duration.ofSeconds(8))
.onErrorMap {
if (it is TimeoutException) {
Expand Down

0 comments on commit 5e0a5fa

Please sign in to comment.