fix(chat-character): 관계 스키마 변경에 따라 엔티티/CRUD/응답 DTO 수정
- ChatCharacterRelationship 엔티티를 personName, relationshipName, description(TEXT), importance, relationshipType, currentStatus로 변경 - ChatCharacter.addRelationship 및 Service 메서드 시그니처를 새 스키마에 맞게 수정 - 등록/수정 플로우에서 relationships 매핑 로직 업데이트 - Admin 상세 응답 DTO(RelationshipResponse) 및 매핑 업데이트 - 전체 빌드 성공
This commit is contained in:
@@ -127,8 +127,23 @@ class ChatCharacter(
|
||||
}
|
||||
|
||||
// 관계 추가 헬퍼 메소드
|
||||
fun addRelationship(name: String, relationShip: String) {
|
||||
val relationship = ChatCharacterRelationship(name, relationShip, this)
|
||||
fun addRelationship(
|
||||
personName: String,
|
||||
relationshipName: String,
|
||||
description: String,
|
||||
importance: Int,
|
||||
relationshipType: String,
|
||||
currentStatus: String
|
||||
) {
|
||||
val relationship = ChatCharacterRelationship(
|
||||
personName,
|
||||
relationshipName,
|
||||
description,
|
||||
importance,
|
||||
relationshipType,
|
||||
currentStatus,
|
||||
this
|
||||
)
|
||||
relationships.add(relationship)
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package kr.co.vividnext.sodalive.chat.character
|
||||
|
||||
import kr.co.vividnext.sodalive.common.BaseEntity
|
||||
import javax.persistence.Column
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.FetchType
|
||||
import javax.persistence.JoinColumn
|
||||
@@ -12,8 +13,19 @@ import javax.persistence.ManyToOne
|
||||
|
||||
@Entity
|
||||
class ChatCharacterRelationship(
|
||||
var name: String,
|
||||
val relationShip: String,
|
||||
// 상대 인물 이름
|
||||
var personName: String,
|
||||
// 관계명 (예: 친구, 동료 등)
|
||||
var relationshipName: String,
|
||||
// 관계 설명
|
||||
@Column(columnDefinition = "TEXT")
|
||||
var description: String,
|
||||
// 중요도
|
||||
var importance: Int,
|
||||
// 관계 타입 (분류용)
|
||||
var relationshipType: String,
|
||||
// 현재 상태
|
||||
var currentStatus: String,
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "chat_character_id")
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package kr.co.vividnext.sodalive.chat.character.service
|
||||
|
||||
import kr.co.vividnext.sodalive.admin.chat.character.dto.ChatCharacterRelationshipRequest
|
||||
import kr.co.vividnext.sodalive.admin.chat.character.dto.ChatCharacterUpdateRequest
|
||||
import kr.co.vividnext.sodalive.chat.character.CharacterType
|
||||
import kr.co.vividnext.sodalive.chat.character.ChatCharacter
|
||||
@@ -372,8 +373,23 @@ class ChatCharacterService(
|
||||
* 캐릭터에 관계 추가
|
||||
*/
|
||||
@Transactional
|
||||
fun addRelationshipToChatCharacter(chatCharacter: ChatCharacter, name: String, relationShip: String) {
|
||||
chatCharacter.addRelationship(name, relationShip)
|
||||
fun addRelationshipToChatCharacter(
|
||||
chatCharacter: ChatCharacter,
|
||||
personName: String,
|
||||
relationshipName: String,
|
||||
description: String,
|
||||
importance: Int,
|
||||
relationshipType: String,
|
||||
currentStatus: String
|
||||
) {
|
||||
chatCharacter.addRelationship(
|
||||
personName,
|
||||
relationshipName,
|
||||
description,
|
||||
importance,
|
||||
relationshipType,
|
||||
currentStatus
|
||||
)
|
||||
saveChatCharacter(chatCharacter)
|
||||
}
|
||||
|
||||
@@ -402,7 +418,7 @@ class ChatCharacterService(
|
||||
memories: List<Triple<String, String, String>> = emptyList(),
|
||||
personalities: List<Pair<String, String>> = emptyList(),
|
||||
backgrounds: List<Pair<String, String>> = emptyList(),
|
||||
relationships: List<Pair<String, String>> = emptyList()
|
||||
relationships: List<ChatCharacterRelationshipRequest> = emptyList()
|
||||
): ChatCharacter {
|
||||
val chatCharacter = createChatCharacter(
|
||||
characterUUID = characterUUID,
|
||||
@@ -437,8 +453,15 @@ class ChatCharacterService(
|
||||
chatCharacter.addBackground(topic, description)
|
||||
}
|
||||
|
||||
relationships.forEach { (name, relationShip) ->
|
||||
chatCharacter.addRelationship(name, relationShip)
|
||||
relationships.forEach { rr ->
|
||||
chatCharacter.addRelationship(
|
||||
rr.personName,
|
||||
rr.relationshipName,
|
||||
rr.description,
|
||||
rr.importance,
|
||||
rr.relationshipType,
|
||||
rr.currentStatus
|
||||
)
|
||||
}
|
||||
|
||||
return saveChatCharacter(chatCharacter)
|
||||
@@ -536,8 +559,15 @@ class ChatCharacterService(
|
||||
|
||||
if (request.relationships != null) {
|
||||
chatCharacter.relationships.clear()
|
||||
request.relationships.forEach { relationship ->
|
||||
chatCharacter.addRelationship(relationship.name, relationship.relationShip)
|
||||
request.relationships.forEach { rr ->
|
||||
chatCharacter.addRelationship(
|
||||
rr.personName,
|
||||
rr.relationshipName,
|
||||
rr.description,
|
||||
rr.importance,
|
||||
rr.relationshipType,
|
||||
rr.currentStatus
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user