Compare commits

..

No commits in common. "5129400a291f31b53d2e843e264aa8b8ca3fe881" and "b819df96561f9e8a353419c626ba510e841bee2b" have entirely different histories.

2 changed files with 12 additions and 17 deletions

View File

@ -1,7 +1,6 @@
package kr.co.vividnext.sodalive.admin.chat package kr.co.vividnext.sodalive.admin.chat
import com.amazonaws.services.s3.model.ObjectMetadata import com.amazonaws.services.s3.model.ObjectMetadata
import kr.co.vividnext.sodalive.admin.chat.character.dto.ChatCharacterSearchListPageResponse
import kr.co.vividnext.sodalive.admin.chat.character.service.AdminChatCharacterService import kr.co.vividnext.sodalive.admin.chat.character.service.AdminChatCharacterService
import kr.co.vividnext.sodalive.admin.chat.dto.ChatCharacterBannerListPageResponse import kr.co.vividnext.sodalive.admin.chat.dto.ChatCharacterBannerListPageResponse
import kr.co.vividnext.sodalive.admin.chat.dto.ChatCharacterBannerRegisterRequest import kr.co.vividnext.sodalive.admin.chat.dto.ChatCharacterBannerRegisterRequest
@ -28,7 +27,7 @@ import org.springframework.web.bind.annotation.RestController
import org.springframework.web.multipart.MultipartFile import org.springframework.web.multipart.MultipartFile
@RestController @RestController
@RequestMapping("/admin/chat/banner") @RequestMapping("/api/admin/chat/banner")
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
class AdminChatBannerController( class AdminChatBannerController(
private val bannerService: ChatCharacterBannerService, private val bannerService: ChatCharacterBannerService,
@ -92,11 +91,7 @@ class AdminChatBannerController(
@RequestParam(defaultValue = "20") size: Int @RequestParam(defaultValue = "20") size: Int
) = run { ) = run {
val pageable = adminCharacterService.createDefaultPageRequest(page, size) val pageable = adminCharacterService.createDefaultPageRequest(page, size)
val pageResult = adminCharacterService.searchCharacters(searchTerm, pageable, imageHost) val response = adminCharacterService.searchCharacters(searchTerm, pageable, imageHost)
val response = ChatCharacterSearchListPageResponse(
totalCount = pageResult.totalElements,
content = pageResult.content
)
ApiResponse.ok(response) ApiResponse.ok(response)
} }

View File

@ -8,23 +8,23 @@ import kr.co.vividnext.sodalive.chat.character.ChatCharacter
data class ChatCharacterSearchResponse( data class ChatCharacterSearchResponse(
val id: Long, val id: Long,
val name: String, val name: String,
val imagePath: String? val description: String,
val mbti: String?,
val imagePath: String?,
val tags: List<String>
) { ) {
companion object { companion object {
fun from(character: ChatCharacter, imageHost: String): ChatCharacterSearchResponse { fun from(character: ChatCharacter, imageHost: String): ChatCharacterSearchResponse {
val tags = character.tagMappings.map { it.tag.tag }
return ChatCharacterSearchResponse( return ChatCharacterSearchResponse(
id = character.id!!, id = character.id!!,
name = character.name, name = character.name,
imagePath = character.imagePath?.let { "$imageHost/$it" } description = character.description,
mbti = character.mbti,
imagePath = character.imagePath?.let { "$imageHost$it" },
tags = tags
) )
} }
} }
} }
/**
* 캐릭터 검색 결과 페이지 응답 DTO
*/
data class ChatCharacterSearchListPageResponse(
val totalCount: Long,
val content: List<ChatCharacterSearchResponse>
)