캐릭터 챗봇 #338
| @@ -1,6 +1,7 @@ | ||||
| package kr.co.vividnext.sodalive.admin.chat | ||||
|  | ||||
| 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.dto.ChatCharacterBannerListPageResponse | ||||
| import kr.co.vividnext.sodalive.admin.chat.dto.ChatCharacterBannerRegisterRequest | ||||
| @@ -27,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController | ||||
| import org.springframework.web.multipart.MultipartFile | ||||
|  | ||||
| @RestController | ||||
| @RequestMapping("/api/admin/chat/banner") | ||||
| @RequestMapping("/admin/chat/banner") | ||||
| @PreAuthorize("hasRole('ADMIN')") | ||||
| class AdminChatBannerController( | ||||
|     private val bannerService: ChatCharacterBannerService, | ||||
| @@ -91,7 +92,11 @@ class AdminChatBannerController( | ||||
|         @RequestParam(defaultValue = "20") size: Int | ||||
|     ) = run { | ||||
|         val pageable = adminCharacterService.createDefaultPageRequest(page, size) | ||||
|         val response = adminCharacterService.searchCharacters(searchTerm, pageable, imageHost) | ||||
|         val pageResult = adminCharacterService.searchCharacters(searchTerm, pageable, imageHost) | ||||
|         val response = ChatCharacterSearchListPageResponse( | ||||
|             totalCount = pageResult.totalElements, | ||||
|             content = pageResult.content | ||||
|         ) | ||||
|  | ||||
|         ApiResponse.ok(response) | ||||
|     } | ||||
|   | ||||
| @@ -8,23 +8,23 @@ import kr.co.vividnext.sodalive.chat.character.ChatCharacter | ||||
| data class ChatCharacterSearchResponse( | ||||
|     val id: Long, | ||||
|     val name: String, | ||||
|     val description: String, | ||||
|     val mbti: String?, | ||||
|     val imagePath: String?, | ||||
|     val tags: List<String> | ||||
|     val imagePath: String? | ||||
| ) { | ||||
|     companion object { | ||||
|         fun from(character: ChatCharacter, imageHost: String): ChatCharacterSearchResponse { | ||||
|             val tags = character.tagMappings.map { it.tag.tag } | ||||
|  | ||||
|             return ChatCharacterSearchResponse( | ||||
|                 id = character.id!!, | ||||
|                 name = character.name, | ||||
|                 description = character.description, | ||||
|                 mbti = character.mbti, | ||||
|                 imagePath = character.imagePath?.let { "$imageHost/$it" }, | ||||
|                 tags = tags | ||||
|                 imagePath = character.imagePath?.let { "$imageHost/$it" } | ||||
|             ) | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * 캐릭터 검색 결과 페이지 응답 DTO | ||||
|  */ | ||||
| data class ChatCharacterSearchListPageResponse( | ||||
|     val totalCount: Long, | ||||
|     val content: List<ChatCharacterSearchResponse> | ||||
| ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user