create http package, move http classes to that package

This commit is contained in:
Denis Savosin
2024-10-02 12:05:21 +07:00
parent b89ee800ed
commit 16f43c6172
20 changed files with 38 additions and 35 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -1,3 +1,3 @@
package com.example.demo.exceptions package com.example.demo.http.exceptions
class NotFoundException: RuntimeException() class NotFoundException: RuntimeException()

View File

@@ -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)

View File

@@ -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

View File

@@ -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,

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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.*

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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