feat(original): 원작 도메인과 캐릭터를 연결하기 위해 각각 검색 API 추가
This commit is contained in:
@@ -70,6 +70,19 @@ class AdminChatCharacterController(
|
||||
ApiResponse.ok(response)
|
||||
}
|
||||
|
||||
/**
|
||||
* 캐릭터 검색(관리자)
|
||||
* - 이름/설명/MBTI/태그 기준 부분 검색, 활성 캐릭터만 대상
|
||||
* - 페이징 제거: 전체 목록 반환
|
||||
*/
|
||||
@GetMapping("/search")
|
||||
fun searchCharacters(
|
||||
@RequestParam("searchTerm") searchTerm: String
|
||||
) = run {
|
||||
val list = adminService.searchCharactersAll(searchTerm, imageHost)
|
||||
ApiResponse.ok(list)
|
||||
}
|
||||
|
||||
/**
|
||||
* 캐릭터 상세 정보 조회 API
|
||||
*
|
||||
|
||||
@@ -65,12 +65,7 @@ class AdminChatCharacterService(
|
||||
}
|
||||
|
||||
/**
|
||||
* 캐릭터 검색 (이름, 설명, MBTI, 태그 기반)
|
||||
*
|
||||
* @param searchTerm 검색어
|
||||
* @param pageable 페이징 정보
|
||||
* @param imageHost 이미지 호스트 URL
|
||||
* @return 검색된 캐릭터 목록 (페이징)
|
||||
* 캐릭터 검색 (이름, 설명, MBTI, 태그 기반) - 페이징 (기존 사용처 호환용)
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
fun searchCharacters(
|
||||
@@ -81,4 +76,20 @@ class AdminChatCharacterService(
|
||||
val characters = chatCharacterRepository.searchCharacters(searchTerm, pageable)
|
||||
return characters.map { ChatCharacterSearchResponse.from(it, imageHost) }
|
||||
}
|
||||
|
||||
/**
|
||||
* 캐릭터 검색 (이름, 설명, MBTI, 태그 기반) - 무페이징
|
||||
*
|
||||
* @param searchTerm 검색어
|
||||
* @param imageHost 이미지 호스트 URL
|
||||
* @return 검색된 캐릭터 목록 (전체)
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
fun searchCharactersAll(
|
||||
searchTerm: String,
|
||||
imageHost: String = ""
|
||||
): List<ChatCharacterSearchResponse> {
|
||||
val characters = chatCharacterRepository.searchCharactersNoPaging(searchTerm)
|
||||
return characters.map { ChatCharacterSearchResponse.from(it, imageHost) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +109,20 @@ class AdminOriginalWorkController(
|
||||
ApiResponse.ok(OriginalWorkPageResponse(totalCount = pageRes.totalElements, content = content))
|
||||
}
|
||||
|
||||
/**
|
||||
* 원작 검색(관리자)
|
||||
* - 제목/콘텐츠타입/카테고리 기준 부분 검색, 소프트 삭제 제외
|
||||
* - 페이징 제거: 전체 목록 반환
|
||||
*/
|
||||
@GetMapping("/search")
|
||||
fun search(
|
||||
@RequestParam("searchTerm") searchTerm: String
|
||||
) = run {
|
||||
val list = originalWorkService.searchOriginalWorksAll(searchTerm)
|
||||
val content = list.map { OriginalWorkResponse.from(it, imageHost) }
|
||||
ApiResponse.ok(content)
|
||||
}
|
||||
|
||||
/**
|
||||
* 원작 상세
|
||||
*/
|
||||
|
||||
@@ -89,6 +89,12 @@ class AdminOriginalWorkService(
|
||||
return originalWorkRepository.findByIsDeletedFalse(pageable)
|
||||
}
|
||||
|
||||
/** 원작 검색 (제목/콘텐츠타입/카테고리, 소프트 삭제 제외) - 무페이징 */
|
||||
@Transactional(readOnly = true)
|
||||
fun searchOriginalWorksAll(searchTerm: String): List<OriginalWork> {
|
||||
return originalWorkRepository.searchNoPaging(searchTerm)
|
||||
}
|
||||
|
||||
/** 원작에 기존 캐릭터들을 배정 */
|
||||
@Transactional
|
||||
fun assignCharacters(originalWorkId: Long, characterIds: List<Long>) {
|
||||
|
||||
Reference in New Issue
Block a user