Skip to content

Commit

Permalink
Merge pull request #51 from FC-InnerCircle/refactor/store
Browse files Browse the repository at this point in the history
formatting
  • Loading branch information
devchanki authored Oct 10, 2024
2 parents f96a464 + 4f9571b commit fae3290
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package org.inner.circle.o2oserver.order.infrastructure.repository

import org.bson.types.ObjectId
import org.springframework.data.mongodb.repository.MongoRepository
import org.springframework.data.mongodb.repository.Query
import org.springframework.stereotype.Repository

@Repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@ class OrderCreateRequest {
data class OrderCreate(
@field:NotNull(message = "스토어 ID는 필수입니다.")
val storeId: Long,

@field:NotBlank(message = "스토어 이름은 필수입니다.")
val storeName: String,

@field:NotEmpty(message = "메뉴는 비어 있을 수 없습니다.")
val menus: List<MenuCreate>,

@field:Min(value = 0, message = "주문 금액은 0 이상이어야 합니다.")
val orderPrice: Long,

@field:Pattern(regexp = "CARD", message = "주문방식은 CARD만 가능합니다.")
val payment: String? = "CARD",

@field:Valid
val address: AddressCreate,
) {
Expand Down Expand Up @@ -77,58 +72,45 @@ class OrderCreateRequest {
data class MenuCreate(
@field:NotNull(message = "메뉴 ID는 필수입니다.")
val menuId: Long,

@field:NotBlank(message = "메뉴명은 필수입니다.")
val menuName: String,

@field:Min(value = 1, message = "메뉴 개수는 1 이상이어야 합니다.")
val menuCount: Int,

@field:Min(value = 0, message = "메뉴 금액은 0 이상이어야 합니다.")
val menuPrice: Long,

@field:NotEmpty(message = "옵션 그룹은 비어 있을 수 없습니다.")
val optionGroups: List<OptionGroupCreate>,
)

data class OptionGroupCreate(
@field:NotNull(message = "옵션 그룹 ID는 필수입니다.")
val optionGroupId: Long,

@field:NotBlank(message = "옵션 그룹 이름은 필수입니다.")
val optionGroupName: String,

@field:NotEmpty(message = "옵션은 비어 있을 수 없습니다.")
val options: List<OptionCreate>,
)

data class OptionCreate(
@field:NotNull(message = "옵션 상세 ID는 필수입니다.")
val optionId: Long,

@field:NotBlank(message = "옵션 상세 이름은 필수입니다.")
val optionName: String,

@field:Min(value = 0, message = "옵션 가격은 0 이상이어야 합니다.")
val optionPrice: Long,
)

data class AddressCreate(
@field:NotNull(message = "주소 ID는 필수입니다.")
val addressId: Long,

@field:NotBlank(message = "주소는 필수입니다.")
val address: String,

@field:NotBlank(message = "상세 주소는 필수입니다.")
val addressDetail: String,

@field:NotBlank(message = "우편번호는 필수입니다.")
val zipCode: String,

@field:DecimalMin(value = "0.0", message = "위도는 0.0 이상이어야 합니다.")
val latitude: Double,

@field:DecimalMin(value = "0.0", message = "경도는 0.0 이상이어야 합니다.")
val longitude: Double,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class OrderReviewRequest {
data class ReviewCreate(
@field:NotBlank(message = "리뷰 내용은 필수입니다.")
val content: String,

@field:Min(value = 0, message = "평점은 0 이상이어야 합니다.")
@field:Max(value = 5, message = "평점은 5 이하이어야 합니다.")
val rating: Double,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.inner.circle.o2oserver.store.domain.review

import java.time.LocalDateTime

class ReviewInfo(
review: Review,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ class StoreListCommand(
val latitude: Double,
val category: String?,
val keyword: String,
val pageable: Pageable
val pageable: Pageable,
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.inner.circle.o2oserver.store.domain.store.StoreListInfo
import org.inner.circle.o2oserver.store.domain.store.StoreReader
import org.inner.circle.o2oserver.store.domain.store.command.StoreListCommand
import org.inner.circle.o2oserver.store.infrastructure.repository.mongo.MongoRepository
import org.springframework.data.domain.PageRequest
import org.springframework.data.geo.Distance
import org.springframework.data.geo.Metrics
import org.springframework.data.geo.Point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class StoreController(
@PostMapping("")
fun storeList(
@Valid @RequestBody request: StoreListRequest,
bindingResult: BindingResult
bindingResult: BindingResult,
): CommonListResponse {
if (bindingResult.hasErrors()) {
throw RuntimeException(bindingResult.fieldErrors.joinToString { el -> el.defaultMessage.toString() })
Expand All @@ -61,7 +61,7 @@ class StoreController(
ReviewQueryObject(
storeId = storeId,
page = page,
limit = size?: 10,
limit = size ?: 10,
)

val reviews = reviewFacade.getStoreReviewList(queryObject)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package org.inner.circle.o2oserver.store.presentation.dto


import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Positive
import org.inner.circle.o2oserver.store.domain.review.ReviewInfo
import org.inner.circle.o2oserver.store.domain.store.command.StoreListCommand
Expand All @@ -27,21 +24,20 @@ data class CommonListResponse(
data class StoreListRequest(
@field:Positive(message = "위경도 값을 다시 확인해주세요") @Max(value = 38, message = "위경도 값을 다시 확인해주세요")
val latitude: Double,

@field:Positive(message = "위경도 값을 다시 확인해주세요") @Max(value = 129, message = "위경도 값을 다시 확인해주세요")
val longitude: Double,
val category: String?,
val page: Int = 0,
val size: Int = 10,
val keyword: String = "",
) {
fun toCommand():StoreListCommand {
fun toCommand(): StoreListCommand {
return StoreListCommand(
pageable = PageRequest.of(page, size),
longitude = longitude,
latitude = latitude,
category = category,
keyword = keyword
keyword = keyword,
)
}
}
Expand Down

0 comments on commit fae3290

Please sign in to comment.