feat(gift): 선물 응답 DTO를 추가한다
This commit is contained in:
@@ -0,0 +1,275 @@
|
|||||||
|
package kr.co.vividnext.sodalive.v2.api.gift.dto
|
||||||
|
|
||||||
|
import kr.co.vividnext.sodalive.v2.gift.application.GiftApplicationResult
|
||||||
|
import kr.co.vividnext.sodalive.v2.gift.application.GiftCancellationResult
|
||||||
|
import kr.co.vividnext.sodalive.v2.gift.application.GiftDeliveryConfirmationResult
|
||||||
|
import kr.co.vividnext.sodalive.v2.gift.application.GiftDetailResult
|
||||||
|
import kr.co.vividnext.sodalive.v2.gift.application.GiftFormOptionsResult
|
||||||
|
import kr.co.vividnext.sodalive.v2.gift.application.GiftListResult
|
||||||
|
import kr.co.vividnext.sodalive.v2.gift.application.GiftRecipientAddressRegistrationResult
|
||||||
|
import kr.co.vividnext.sodalive.v2.gift.application.GiftReviewResult
|
||||||
|
import kr.co.vividnext.sodalive.v2.gift.application.GiftTrackingRegistrationResult
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
data class GiftFormOptionsResponse(
|
||||||
|
val sizes: List<GiftSizeOptionResponse>,
|
||||||
|
val categories: List<GiftCategoryOptionResponse>
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
fun from(result: GiftFormOptionsResult) = GiftFormOptionsResponse(
|
||||||
|
sizes = result.sizes.map {
|
||||||
|
GiftSizeOptionResponse(it.sizeCode.name, it.sizeName, it.basePriceCan, it.salePriceCan)
|
||||||
|
},
|
||||||
|
categories = result.categories.map {
|
||||||
|
GiftCategoryOptionResponse(it.categoryId, it.name, it.requiresDamageWaiver)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class GiftSizeOptionResponse(
|
||||||
|
val sizeCode: String,
|
||||||
|
val name: String,
|
||||||
|
val basePriceCan: Int,
|
||||||
|
val salePriceCan: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GiftCategoryOptionResponse(
|
||||||
|
val categoryId: Long,
|
||||||
|
val name: String,
|
||||||
|
val requiresDamageWaiver: Boolean
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GiftListResponse(
|
||||||
|
val totalCount: Long,
|
||||||
|
val items: List<GiftListItemResponse>,
|
||||||
|
val page: Int,
|
||||||
|
val size: Int,
|
||||||
|
val hasNext: Boolean
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
fun from(result: GiftListResult) = GiftListResponse(
|
||||||
|
totalCount = result.totalCount,
|
||||||
|
items = result.items.map {
|
||||||
|
GiftListItemResponse(
|
||||||
|
applicationNo = it.applicationNo,
|
||||||
|
direction = it.direction.name,
|
||||||
|
status = it.status.name,
|
||||||
|
statusName = it.statusName,
|
||||||
|
priceCan = it.priceCan,
|
||||||
|
categoryName = it.categoryName,
|
||||||
|
sizeName = it.sizeName,
|
||||||
|
createdAt = it.createdAt
|
||||||
|
)
|
||||||
|
},
|
||||||
|
page = result.page,
|
||||||
|
size = result.size,
|
||||||
|
hasNext = result.hasNext
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class GiftListItemResponse(
|
||||||
|
val applicationNo: String,
|
||||||
|
val direction: String,
|
||||||
|
val status: String,
|
||||||
|
val statusName: String,
|
||||||
|
val priceCan: Int,
|
||||||
|
val categoryName: String,
|
||||||
|
val sizeName: String,
|
||||||
|
val createdAt: LocalDateTime?
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GiftDetailResponse(
|
||||||
|
val applicationNo: String,
|
||||||
|
val direction: String,
|
||||||
|
val status: String,
|
||||||
|
val statusName: String,
|
||||||
|
val giftInfo: GiftDetailInfoResponse,
|
||||||
|
val senderInfo: GiftAddressResponse?,
|
||||||
|
val recipientAddress: GiftAddressResponse?,
|
||||||
|
val mailbox: GiftMailboxResponse?,
|
||||||
|
val trackingRequired: Boolean,
|
||||||
|
val recipientAddressRequired: Boolean,
|
||||||
|
val recipientAddressDeadlineAt: LocalDateTime?,
|
||||||
|
val delivery: GiftDeliveryInfoResponse,
|
||||||
|
val statusTimeline: List<GiftStatusTimelineResponse>
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
fun from(result: GiftDetailResult) = GiftDetailResponse(
|
||||||
|
applicationNo = result.applicationNo,
|
||||||
|
direction = result.direction.name,
|
||||||
|
status = result.status.name,
|
||||||
|
statusName = result.statusName,
|
||||||
|
giftInfo = GiftDetailInfoResponse(
|
||||||
|
recipientCreatorNickname = result.giftInfo.recipientCreatorNickname,
|
||||||
|
senderNickname = result.giftInfo.senderNickname,
|
||||||
|
sizeName = result.giftInfo.sizeName,
|
||||||
|
categoryName = result.giftInfo.categoryName,
|
||||||
|
applicationNo = result.giftInfo.applicationNo,
|
||||||
|
paidCan = result.giftInfo.paidCan,
|
||||||
|
tracking = result.giftInfo.tracking,
|
||||||
|
shippingRequestedAt = result.giftInfo.shippingRequestedAt
|
||||||
|
),
|
||||||
|
senderInfo = result.senderInfo?.let { GiftAddressResponse(it.name, it.phoneNumber, it.address) },
|
||||||
|
recipientAddress = result.recipientAddress?.let { GiftAddressResponse(it.name, it.phoneNumber, it.address) },
|
||||||
|
mailbox = result.mailbox?.let { GiftMailboxResponse(it.name, it.address, it.phoneNumber) },
|
||||||
|
trackingRequired = result.trackingRequired,
|
||||||
|
recipientAddressRequired = result.recipientAddressRequired,
|
||||||
|
recipientAddressDeadlineAt = result.recipientAddressDeadlineAt,
|
||||||
|
delivery = GiftDeliveryInfoResponse(
|
||||||
|
canceledAt = result.delivery.canceledAt,
|
||||||
|
undeliverableAt = result.delivery.undeliverableAt,
|
||||||
|
undeliverableReason = result.delivery.undeliverableReason
|
||||||
|
),
|
||||||
|
statusTimeline = result.statusTimeline.map {
|
||||||
|
GiftStatusTimelineResponse(it.status.name, it.statusName, it.occurredAt)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class GiftDetailInfoResponse(
|
||||||
|
val recipientCreatorNickname: String?,
|
||||||
|
val senderNickname: String?,
|
||||||
|
val sizeName: String,
|
||||||
|
val categoryName: String,
|
||||||
|
val applicationNo: String?,
|
||||||
|
val paidCan: Int?,
|
||||||
|
val tracking: String?,
|
||||||
|
val shippingRequestedAt: LocalDateTime?
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GiftAddressResponse(
|
||||||
|
val name: String,
|
||||||
|
val phoneNumber: String,
|
||||||
|
val address: String
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GiftMailboxResponse(
|
||||||
|
val name: String,
|
||||||
|
val address: String,
|
||||||
|
val phoneNumber: String
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GiftDeliveryInfoResponse(
|
||||||
|
val canceledAt: LocalDateTime?,
|
||||||
|
val undeliverableAt: LocalDateTime?,
|
||||||
|
val undeliverableReason: String?
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GiftStatusTimelineResponse(
|
||||||
|
val status: String,
|
||||||
|
val statusName: String,
|
||||||
|
val occurredAt: LocalDateTime?
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GiftApplicationResponse(
|
||||||
|
val applicationNo: String,
|
||||||
|
val status: String,
|
||||||
|
val statusName: String,
|
||||||
|
val priceCan: Int,
|
||||||
|
val trackingDeadlineAt: LocalDateTime
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
fun from(result: GiftApplicationResult) = GiftApplicationResponse(
|
||||||
|
applicationNo = result.applicationNo,
|
||||||
|
status = result.status.name,
|
||||||
|
statusName = result.statusName,
|
||||||
|
priceCan = result.priceCan,
|
||||||
|
trackingDeadlineAt = result.trackingDeadlineAt
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class GiftCancellationResponse(
|
||||||
|
val applicationNo: String,
|
||||||
|
val status: String,
|
||||||
|
val statusName: String,
|
||||||
|
val priceCan: Int,
|
||||||
|
val canceledAt: LocalDateTime
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
fun from(result: GiftCancellationResult) = GiftCancellationResponse(
|
||||||
|
applicationNo = result.applicationNo,
|
||||||
|
status = result.status.name,
|
||||||
|
statusName = result.statusName,
|
||||||
|
priceCan = result.priceCan,
|
||||||
|
canceledAt = result.canceledAt
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class GiftTrackingRegistrationResponse(
|
||||||
|
val applicationNo: String,
|
||||||
|
val status: String,
|
||||||
|
val statusName: String,
|
||||||
|
val courierCompanyName: String,
|
||||||
|
val trackingNumber: String,
|
||||||
|
val trackingRegisteredAt: LocalDateTime,
|
||||||
|
val recipientAddressDeadlineAt: LocalDateTime
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
fun from(result: GiftTrackingRegistrationResult) = GiftTrackingRegistrationResponse(
|
||||||
|
applicationNo = result.applicationNo,
|
||||||
|
status = result.status.name,
|
||||||
|
statusName = result.statusName,
|
||||||
|
courierCompanyName = result.courierCompanyName,
|
||||||
|
trackingNumber = result.trackingNumber,
|
||||||
|
trackingRegisteredAt = result.trackingRegisteredAt,
|
||||||
|
recipientAddressDeadlineAt = result.recipientAddressDeadlineAt
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class GiftRecipientAddressRegistrationResponse(
|
||||||
|
val applicationNo: String,
|
||||||
|
val status: String,
|
||||||
|
val statusName: String,
|
||||||
|
val recipientAddressRegisteredAt: LocalDateTime
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
fun from(result: GiftRecipientAddressRegistrationResult) = GiftRecipientAddressRegistrationResponse(
|
||||||
|
applicationNo = result.applicationNo,
|
||||||
|
status = result.status.name,
|
||||||
|
statusName = result.statusName,
|
||||||
|
recipientAddressRegisteredAt = result.recipientAddressRegisteredAt
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class GiftDeliveryConfirmationResponse(
|
||||||
|
val applicationNo: String,
|
||||||
|
val status: String,
|
||||||
|
val statusName: String,
|
||||||
|
val deliveredAt: LocalDateTime
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
fun from(result: GiftDeliveryConfirmationResult) = GiftDeliveryConfirmationResponse(
|
||||||
|
applicationNo = result.applicationNo,
|
||||||
|
status = result.status.name,
|
||||||
|
statusName = result.statusName,
|
||||||
|
deliveredAt = result.deliveredAt
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class GiftReviewResponse(
|
||||||
|
val reviewId: Long,
|
||||||
|
val applicationNo: String,
|
||||||
|
val rating: Int,
|
||||||
|
val keywords: List<String>,
|
||||||
|
val comment: String?,
|
||||||
|
val createdAt: LocalDateTime?
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
fun from(result: GiftReviewResult) = GiftReviewResponse(
|
||||||
|
reviewId = result.reviewId,
|
||||||
|
applicationNo = result.applicationNo,
|
||||||
|
rating = result.rating,
|
||||||
|
keywords = result.keywords,
|
||||||
|
comment = result.comment,
|
||||||
|
createdAt = result.createdAt
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user