Skip to content

Commit

Permalink
Shuffle some packages
Browse files Browse the repository at this point in the history
  • Loading branch information
mattupstate committed Dec 9, 2023
1 parent 92cbb9f commit db55c5d
Show file tree
Hide file tree
Showing 24 changed files with 53 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import com.acme.ktor.server.logging.logger
import com.acme.ktor.server.validation.RequestBodyValidationException
import com.acme.ktor.server.validation.RequestDecodingException
import com.acme.ktor.server.validation.getUnderlyingCause
import com.acme.web.api.json.hal.HalLink
import com.acme.web.api.json.hal.VndError
import com.acme.web.api.json.HalLink
import com.acme.web.api.json.VndError
import com.acme.web.api.json.respondVndError
import com.acme.web.api.json.toVndError
import io.ktor.http.HttpStatusCode
import io.ktor.server.application.ApplicationCall
import io.ktor.server.request.uri
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.acme.web.api

import com.acme.ktor.server.logging.logger
import com.acme.web.api.scheduling.ktor.scheduling
import com.acme.web.api.scheduling.scheduling
import io.ktor.http.ContentType
import io.ktor.server.application.Application
import io.ktor.server.application.call
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.acme.web.api.json.hal
package com.acme.web.api.json

import com.acme.serialization.URIAsStringSerializer
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.acme.web.api.json.hal
package com.acme.web.api.json

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.acme.web.api
package com.acme.web.api.json

import com.acme.ktor.server.validation.RequestBodyValidationException
import com.acme.web.api.json.hal.VndError
import com.acme.web.api.toJsonPointer
import io.ktor.http.ContentType
import io.ktor.http.HttpStatusCode
import io.ktor.server.application.ApplicationCall
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.acme.ktor.server.logging.StructuredLogging
import com.acme.ktor.server.validation.RequestBodyValidationException
import com.acme.ktor.server.validation.RequestDecodingException
import com.acme.ktor.server.validation.RequestValidation
import com.acme.web.api.json.respondVndError
import com.acme.web.api.security.PrincipalNotFoundException
import com.acme.web.api.security.UnauthorizedAccessException
import io.ktor.http.ContentType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.acme.web.api.scheduling.ktor
package com.acme.web.api.scheduling

import com.acme.core.MessageBus
import com.acme.ktor.server.validation.receiveAndValidate
Expand All @@ -9,15 +9,10 @@ import com.acme.scheduling.MarkAppointmentUnattendedCommand
import com.acme.scheduling.SchedulingUnitOfWork
import com.acme.web.api.authenticatedUser
import com.acme.web.api.defaultIdGenerator
import com.acme.web.api.scheduling.CreateAppointmentCommandRequest
import com.acme.web.api.scheduling.CreateClientCommandRequest
import com.acme.web.api.scheduling.CreatePracticeCommandRequest
import com.acme.web.api.scheduling.CreatePractitionerCommandRequest
import com.acme.web.api.scheduling.json.AppointmentCollectionResource
import com.acme.web.api.scheduling.json.ClientCollectionResource
import com.acme.web.api.scheduling.json.PracticeCollectionResource
import com.acme.web.api.scheduling.json.PractitionerCollectionResource
import com.acme.web.api.scheduling.toCommand
import com.acme.web.api.security.AccessControlService
import io.ktor.http.HttpStatusCode
import io.ktor.server.application.ApplicationCall
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.acme.web.api.scheduling.data
package com.acme.web.api.scheduling

import com.acme.scheduling.Appointment
import com.acme.scheduling.AppointmentAttendedEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.acme.web.api.scheduling.json

import com.acme.web.api.json.hal.HalLink
import com.acme.web.api.json.HalLink
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.acme.web.api.scheduling.json

import com.acme.web.api.json.hal.HalLink
import com.acme.web.api.json.HalLink
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.acme.web.api.scheduling.json

import com.acme.web.api.json.hal.HalLink
import com.acme.web.api.json.HalLink
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.acme.web.api.scheduling.json

import com.acme.web.api.json.hal.HalLink
import com.acme.web.api.json.HalLink
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.acme.web.api.scheduling.json

import com.acme.web.api.json.hal.HalLink
import com.acme.web.api.json.HalLink
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.acme.web.api.scheduling.json

import com.acme.web.api.json.hal.HalLink
import com.acme.web.api.json.HalLink
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.acme.web.api.scheduling.json

import com.acme.web.api.json.hal.HalLink
import com.acme.web.api.json.HalLink
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.acme.web.api.scheduling.json

import com.acme.web.api.json.hal.HalLink
import com.acme.web.api.json.HalLink
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:OptIn(KtorExperimentalLocationsAPI::class)

package com.acme.web.api.scheduling.ktor
package com.acme.web.api.scheduling

import io.ktor.server.locations.KtorExperimentalLocationsAPI
import io.ktor.server.locations.Location
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@ import com.acme.scheduling.AppointmentUnattendedEvent
import com.acme.scheduling.ClientCreatedEvent
import com.acme.scheduling.PracticeCreatedEvent
import com.acme.scheduling.PractitionerCreatedEvent
import com.acme.web.api.scheduling.data.onAppointmentAttended
import com.acme.web.api.scheduling.data.onAppointmentCanceled
import com.acme.web.api.scheduling.data.onAppointmentCreated
import com.acme.web.api.scheduling.data.onAppointmentUnattended
import com.acme.web.api.scheduling.data.onClientCreated
import com.acme.web.api.scheduling.data.onPracticeCreated
import com.acme.web.api.scheduling.data.onPractitionerCreated
import com.acme.scheduling.schedulingMessageBus as baseSchedulingMessageBus
import com.acme.scheduling.schedulingMessageBus

val schedulingMessageBus = baseSchedulingMessageBus.copy().apply {
val webApiSchedulingMessageBus = schedulingMessageBus.copy().apply {
addEventHandler(
PracticeCreatedEvent::class to ::onPracticeCreated,
PractitionerCreatedEvent::class to ::onPractitionerCreated,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
@file:OptIn(KtorExperimentalLocationsAPI::class)

package com.acme.web.api.scheduling.ktor
package com.acme.web.api.scheduling

import com.acme.scheduling.data.SchedulingJooqUnitOfWork
import com.acme.web.api.KetoConfiguration
import com.acme.web.api.scheduling.data.JooqSchedulingWebViews
import com.acme.web.api.scheduling.schedulingMessageBus
import com.acme.web.api.security.AccessControlService
import com.acme.web.api.security.KtorOryKetoAccessControlService
import com.acme.web.api.security.keto.KtorOryKetoClient
Expand Down Expand Up @@ -36,7 +35,7 @@ fun Route.scheduling(jooqConfig: Configuration, accessControl: AccessControlServ
val schedulingWebViews = JooqSchedulingWebViews(jooqConfig)

authenticate {
schedulingCommands(schedulingMessageBus, accessControl, schedulingUnitOfWork, basePath)
schedulingCommands(webApiSchedulingMessageBus, accessControl, schedulingUnitOfWork, basePath)
schedulingQueries(schedulingWebViews, accessControl, basePath)
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
@file:OptIn(KtorExperimentalLocationsAPI::class)

package com.acme.web.api.scheduling.ktor
package com.acme.web.api.scheduling

import com.acme.web.api.authenticatedUser
import com.acme.web.api.json.hal.HalLink
import com.acme.web.api.json.HalLink
import com.acme.web.api.scheduling.data.SchedulingWebViews
import com.acme.web.api.scheduling.json.AppointmentResource
import com.acme.web.api.scheduling.json.ClientResource
import com.acme.web.api.scheduling.json.PracticeResource
import com.acme.web.api.scheduling.json.PractitionerResource
import com.acme.web.api.scheduling.toResource
import com.acme.web.api.security.AccessControlService
import com.acme.web.api.security.UnauthorizedAccessException
import io.ktor.http.HttpStatusCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package com.acme.web.api.core.ktor
package com.acme.web.api.json

import com.acme.ktor.server.validation.RequestBodyValidationException
import com.acme.web.api.json.hal.VndError
import com.acme.web.api.scheduling.constraintValidator
import com.acme.web.api.toVndError
import io.kotest.core.spec.style.ShouldSpec
import io.kotest.matchers.shouldBe
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Size

class RequestBodyValidationExceptionExtensionTest : ShouldSpec({
class VndErrorTest : ShouldSpec({

data class FakeBean(
@field:NotNull
Expand Down Expand Up @@ -42,8 +40,7 @@ class RequestBodyValidationExceptionExtensionTest : ShouldSpec({
)
)
)
)
)
))
}
}
})
Loading

0 comments on commit db55c5d

Please sign in to comment.