Skip to content

Commit

Permalink
feat: 컨트롤러에 DB에서 캐릭터의 정보를 검색하기 위한 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yechan-kim committed Sep 3, 2024
1 parent 9a09aac commit 5ea880e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import site.dpbr.dsjs.domain.character.presentation.dto.request.CharacterOcidRequest;
import site.dpbr.dsjs.domain.character.presentation.dto.response.CharacterInfoResponse;
import site.dpbr.dsjs.domain.character.usecase.*;
import site.dpbr.dsjs.global.error.ErrorResponse;

Expand All @@ -26,6 +27,7 @@ public class CharacterController {
private final UploadAndFetchInfo uploadAndFetchInfo;
private final ExportCharacterListToExcel exportCharacterListToExcel;
private final ExportCharacterImages exportCharacterImages;
private final SearchCharacterInfo searchCharacterInfo;
private final FetchBasicInfoFromCharacterList fetchBasicInfoFromCharacterList;
private final FetchUnionInfoFromCharacterList fetchUnionInfoFromCharacterList;
private final FetchStatInfoFromCharacterList fetchStatInfoFromCharacterList;
Expand Down Expand Up @@ -82,6 +84,19 @@ public ResponseEntity<byte[]> exportCharacterImages(@RequestPart("file") Multipa
.body(exportCharacterImages.execute(file));
}

@Operation(summary = "캐릭터 정보 호출", description = "DB에 저장된 캐릭터 정보를 검색하여 DB에서 불러옵니다.")
@ApiResponses({
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "400", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "403", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@GetMapping(value = "/search")
public ResponseEntity<CharacterInfoResponse> searchCharacterInfo(@RequestParam String characterName) {
return ResponseEntity.ok(searchCharacterInfo.execute(characterName));
}

@Operation(summary = "캐릭터의 ocid 호출", description = "Nexon Open API를 통해 캐릭터의 ocid를 호출합니다.")
@ApiResponses({
@ApiResponse(responseCode = "200"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.requestMatchers("/admin/test-register", "/admin/login").permitAll() //관리자 로그인
.requestMatchers("admin/refresh").permitAll() // 토큰 재발급

.requestMatchers("/character/**").hasAuthority(Role.ROLE_ADMIN.getRole()) // 캐릭터 관리
.requestMatchers("/character/uploadAndFetch", "character/export-characters/**").hasAuthority(Role.ROLE_ADMIN.getRole()) // 캐릭터 정보 업로드 및 추출
.requestMatchers("/character/search").permitAll() // 캐릭터 정보 검색

.anyRequest().authenticated()
);
Expand Down

0 comments on commit 5ea880e

Please sign in to comment.