fix(chat-character-image): 캐릭터 이미지 가격
- 이미지 단독 구매 가격과 메시지를 통한 구매 가겨으로 분리
This commit is contained in:
parent
c8841856c0
commit
8451cdfb80
|
@ -81,7 +81,8 @@ class AdminCharacterImageController(
|
|||
characterId = request.characterId,
|
||||
imagePath = imagePath,
|
||||
blurImagePath = blurImagePath,
|
||||
price = request.price,
|
||||
imagePriceCan = request.imagePriceCan,
|
||||
messagePriceCan = request.messagePriceCan,
|
||||
isAdult = request.isAdult,
|
||||
triggers = request.triggers ?: emptyList()
|
||||
)
|
||||
|
|
|
@ -7,7 +7,8 @@ import kr.co.vividnext.sodalive.chat.character.image.CharacterImage
|
|||
|
||||
data class RegisterCharacterImageRequest(
|
||||
@JsonProperty("characterId") val characterId: Long,
|
||||
@JsonProperty("price") val price: Long,
|
||||
@JsonProperty("imagePriceCan") val imagePriceCan: Long,
|
||||
@JsonProperty("messagePriceCan") val messagePriceCan: Long,
|
||||
@JsonProperty("isAdult") val isAdult: Boolean = false,
|
||||
@JsonProperty("triggers") val triggers: List<String>? = null
|
||||
)
|
||||
|
@ -26,7 +27,8 @@ data class UpdateCharacterImageOrdersRequest(
|
|||
data class AdminCharacterImageResponse(
|
||||
val id: Long,
|
||||
val characterId: Long,
|
||||
val price: Long,
|
||||
val imagePriceCan: Long,
|
||||
val messagePriceCan: Long,
|
||||
val isAdult: Boolean,
|
||||
val sortOrder: Int,
|
||||
val active: Boolean,
|
||||
|
@ -42,7 +44,8 @@ data class AdminCharacterImageResponse(
|
|||
return AdminCharacterImageResponse(
|
||||
id = entity.id!!,
|
||||
characterId = entity.chatCharacter.id!!,
|
||||
price = entity.price,
|
||||
imagePriceCan = entity.imagePriceCan,
|
||||
messagePriceCan = entity.messagePriceCan,
|
||||
isAdult = entity.isAdult,
|
||||
sortOrder = entity.sortOrder,
|
||||
active = entity.isActive,
|
||||
|
|
|
@ -21,8 +21,11 @@ class CharacterImage(
|
|||
// 블러 이미지 경로 (S3 key - free/public bucket)
|
||||
var blurImagePath: String,
|
||||
|
||||
// 가격 (메시지/이미지 통합 단일가 - 요구사항 범위)
|
||||
var price: Long = 0L,
|
||||
// 이미지 단독 구매 가격 (단위: can)
|
||||
var imagePriceCan: Long = 0L,
|
||||
|
||||
// 메시지를 통한 가격 (단위: can)
|
||||
var messagePriceCan: Long = 0L,
|
||||
|
||||
// 성인 이미지 여부 (본인인증 필요)
|
||||
var isAdult: Boolean = false,
|
||||
|
|
|
@ -24,13 +24,16 @@ class CharacterImageService(
|
|||
characterId: Long,
|
||||
imagePath: String,
|
||||
blurImagePath: String,
|
||||
price: Long,
|
||||
imagePriceCan: Long,
|
||||
messagePriceCan: Long,
|
||||
isAdult: Boolean,
|
||||
triggers: List<String>
|
||||
): CharacterImage {
|
||||
val character = characterRepository.findById(characterId)
|
||||
.orElseThrow { SodaException("캐릭터를 찾을 수 없습니다: $characterId") }
|
||||
|
||||
if (imagePriceCan < 0 || messagePriceCan < 0) throw SodaException("가격은 0 can 이상이어야 합니다.")
|
||||
|
||||
if (!character.isActive) throw SodaException("비활성화된 캐릭터에는 이미지를 등록할 수 없습니다: $characterId")
|
||||
|
||||
val nextOrder = (imageRepository.findMaxSortOrderByCharacterId(characterId)) + 1
|
||||
|
@ -38,7 +41,8 @@ class CharacterImageService(
|
|||
chatCharacter = character,
|
||||
imagePath = imagePath,
|
||||
blurImagePath = blurImagePath,
|
||||
price = price,
|
||||
imagePriceCan = imagePriceCan,
|
||||
messagePriceCan = messagePriceCan,
|
||||
isAdult = isAdult,
|
||||
sortOrder = nextOrder,
|
||||
isActive = true
|
||||
|
|
Loading…
Reference in New Issue