mirror of
https://github.com/Dannecron/spring-boot-demo.git
synced 2025-12-26 00:32:34 +03:00
create http package, move http classes to that package
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package com.example.demo.controllers
|
package com.example.demo.http.controllers
|
||||||
|
|
||||||
import com.example.demo.provider.html.renderProductTable
|
import com.example.demo.provider.html.renderProductTable
|
||||||
import org.springframework.web.bind.annotation.GetMapping
|
import org.springframework.web.bind.annotation.GetMapping
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.example.demo.controllers
|
package com.example.demo.http.controllers
|
||||||
|
|
||||||
import com.example.demo.exceptions.NotFoundException
|
import com.example.demo.http.exceptions.NotFoundException
|
||||||
import com.example.demo.exceptions.UnprocessableException
|
import com.example.demo.http.exceptions.UnprocessableException
|
||||||
import com.example.demo.requests.CreateProductRequest
|
import com.example.demo.http.requests.CreateProductRequest
|
||||||
import com.example.demo.responses.makeOkResponse
|
import com.example.demo.http.responses.makeOkResponse
|
||||||
import com.example.demo.services.ProductService
|
import com.example.demo.services.ProductService
|
||||||
import com.example.demo.services.kafka.exceptions.InvalidArgumentException
|
import com.example.demo.services.kafka.exceptions.InvalidArgumentException
|
||||||
import jakarta.validation.Valid
|
import jakarta.validation.Valid
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.example.demo.controllers
|
package com.example.demo.http.controllers
|
||||||
|
|
||||||
import com.example.demo.exceptions.NotFoundException
|
import com.example.demo.http.exceptions.NotFoundException
|
||||||
import com.example.demo.provider.ShopProvider
|
import com.example.demo.provider.ShopProvider
|
||||||
import jakarta.servlet.http.HttpServletResponse
|
import jakarta.servlet.http.HttpServletResponse
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.example.demo.exceptions
|
package com.example.demo.http.exceptions
|
||||||
|
|
||||||
import com.example.demo.responses.makeBadRequestResponse
|
import com.example.demo.http.responses.makeBadRequestResponse
|
||||||
import com.example.demo.responses.makeNotFoundResponse
|
import com.example.demo.http.responses.makeNotFoundResponse
|
||||||
import com.example.demo.responses.makeUnprocessableResponse
|
import com.example.demo.http.responses.makeUnprocessableResponse
|
||||||
import com.example.demo.responses.makeUnprocessableResponseWithErrors
|
import com.example.demo.http.responses.makeUnprocessableResponseWithErrors
|
||||||
import org.springframework.http.HttpStatus
|
import org.springframework.http.HttpStatus
|
||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
import org.springframework.http.converter.HttpMessageNotReadableException
|
import org.springframework.http.converter.HttpMessageNotReadableException
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
package com.example.demo.exceptions
|
package com.example.demo.http.exceptions
|
||||||
|
|
||||||
class NotFoundException: RuntimeException()
|
class NotFoundException: RuntimeException()
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
package com.example.demo.exceptions
|
package com.example.demo.http.exceptions
|
||||||
|
|
||||||
class UnprocessableException(override val message: String): RuntimeException(message)
|
class UnprocessableException(override val message: String): RuntimeException(message)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.example.demo.requests
|
package com.example.demo.http.requests
|
||||||
|
|
||||||
import jakarta.validation.constraints.Min
|
import jakarta.validation.constraints.Min
|
||||||
import jakarta.validation.constraints.NotBlank
|
import jakarta.validation.constraints.NotBlank
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.example.demo.responses
|
package com.example.demo.http.responses
|
||||||
|
|
||||||
data class BadRequestResponse(
|
data class BadRequestResponse(
|
||||||
val cause: String,
|
val cause: String,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.example.demo.responses
|
package com.example.demo.http.responses
|
||||||
|
|
||||||
open class BaseResponse(val status: ResponseStatus)
|
open class BaseResponse(val status: ResponseStatus)
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.example.demo.responses
|
package com.example.demo.http.responses
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.example.demo.responses
|
package com.example.demo.http.responses
|
||||||
|
|
||||||
import org.springframework.validation.ObjectError
|
import org.springframework.validation.ObjectError
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.example.demo.services
|
package com.example.demo.services
|
||||||
|
|
||||||
import com.example.demo.exceptions.NotFoundException
|
import com.example.demo.http.exceptions.NotFoundException
|
||||||
import com.example.demo.exceptions.UnprocessableException
|
import com.example.demo.http.exceptions.UnprocessableException
|
||||||
import com.example.demo.models.City
|
import com.example.demo.models.City
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.example.demo.services
|
package com.example.demo.services
|
||||||
|
|
||||||
import com.example.demo.exceptions.NotFoundException
|
import com.example.demo.http.exceptions.NotFoundException
|
||||||
import com.example.demo.exceptions.UnprocessableException
|
import com.example.demo.http.exceptions.UnprocessableException
|
||||||
import com.example.demo.models.City
|
import com.example.demo.models.City
|
||||||
import com.example.demo.provider.CityRepository
|
import com.example.demo.provider.CityRepository
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.example.demo.services
|
package com.example.demo.services
|
||||||
|
|
||||||
import com.example.demo.exceptions.NotFoundException
|
import com.example.demo.http.exceptions.NotFoundException
|
||||||
import com.example.demo.exceptions.UnprocessableException
|
import com.example.demo.http.exceptions.UnprocessableException
|
||||||
import com.example.demo.models.Product
|
import com.example.demo.models.Product
|
||||||
import com.example.demo.services.kafka.exceptions.InvalidArgumentException
|
import com.example.demo.services.kafka.exceptions.InvalidArgumentException
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.example.demo.services
|
package com.example.demo.services
|
||||||
|
|
||||||
import com.example.demo.exceptions.NotFoundException
|
import com.example.demo.http.exceptions.NotFoundException
|
||||||
import com.example.demo.exceptions.UnprocessableException
|
import com.example.demo.http.exceptions.UnprocessableException
|
||||||
import com.example.demo.models.Product
|
import com.example.demo.models.Product
|
||||||
import com.example.demo.provider.ProductRepository
|
import com.example.demo.provider.ProductRepository
|
||||||
import com.example.demo.services.kafka.Producer
|
import com.example.demo.services.kafka.Producer
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.example.demo.controllers
|
package com.example.demo.http.controllers
|
||||||
|
|
||||||
|
import com.example.demo.http.controllers.GreetingController
|
||||||
import org.hamcrest.core.StringContains
|
import org.hamcrest.core.StringContains
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
|
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package com.example.demo.controllers
|
package com.example.demo.http.controllers
|
||||||
|
|
||||||
|
import com.example.demo.http.controllers.ProductController
|
||||||
import com.example.demo.models.Product
|
import com.example.demo.models.Product
|
||||||
import com.example.demo.responses.ResponseStatus
|
import com.example.demo.http.responses.ResponseStatus
|
||||||
import com.example.demo.services.ProductService
|
import com.example.demo.services.ProductService
|
||||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||||
import org.hamcrest.Matchers.contains
|
import org.hamcrest.Matchers.contains
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.example.demo.controllers
|
package com.example.demo.http.controllers
|
||||||
|
|
||||||
|
import com.example.demo.http.controllers.ShopController
|
||||||
import com.example.demo.models.*
|
import com.example.demo.models.*
|
||||||
import com.example.demo.provider.ShopProvider
|
import com.example.demo.provider.ShopProvider
|
||||||
import org.mockito.kotlin.doReturn
|
import org.mockito.kotlin.doReturn
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.example.demo.services
|
package com.example.demo.services
|
||||||
|
|
||||||
import com.example.demo.BaseFeatureTest
|
import com.example.demo.BaseFeatureTest
|
||||||
import com.example.demo.exceptions.NotFoundException
|
import com.example.demo.http.exceptions.NotFoundException
|
||||||
import com.example.demo.exceptions.UnprocessableException
|
import com.example.demo.http.exceptions.UnprocessableException
|
||||||
import com.example.demo.models.Product
|
import com.example.demo.models.Product
|
||||||
import com.example.demo.provider.ProductRepository
|
import com.example.demo.provider.ProductRepository
|
||||||
import org.junit.jupiter.api.assertThrows
|
import org.junit.jupiter.api.assertThrows
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.example.demo.services
|
package com.example.demo.services
|
||||||
|
|
||||||
import com.example.demo.exceptions.NotFoundException
|
import com.example.demo.http.exceptions.NotFoundException
|
||||||
import com.example.demo.models.Product
|
import com.example.demo.models.Product
|
||||||
import com.example.demo.provider.ProductRepository
|
import com.example.demo.provider.ProductRepository
|
||||||
import com.example.demo.services.kafka.Producer
|
import com.example.demo.services.kafka.Producer
|
||||||
|
|||||||
Reference in New Issue
Block a user