Skip to content

Commit

Permalink
Merge pull request #110 from 1e5i-Shark/dev
Browse files Browse the repository at this point in the history
dev -> main
  • Loading branch information
GiHoo authored Mar 13, 2024
2 parents c12eca4 + 770cbb8 commit fcdf4b7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
Expand All @@ -20,7 +21,7 @@ public class ProblemController implements ProblemControllerDoc {

@Override
@GetMapping("/problems/html")
public ProblemHtmlResponse getProblemHtml(@RequestBody @Valid ProblemFindRequest request) {
return bojProblemService.getProblemInfoHtml(request);
public ProblemHtmlResponse getProblemHtml(@RequestParam String problemLink) {
return bojProblemService.getProblemInfoHtml(problemLink);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public class BojProblemServiceImpl implements ProblemService {
private static final String CORRECT = "맞았습니다!!";

@Override
public ProblemHtmlResponse getProblemInfoHtml(ProblemFindRequest request) {
public ProblemHtmlResponse getProblemInfoHtml(String problemLink) {
try {
return ProblemHtmlResponse.of(
Jsoup.connect(request.getProblemLink()).get().outerHtml());
Jsoup.connect(problemLink).get().outerHtml());
} catch (IOException e) {
throw CrawlingAccessException.of(ProblemErrorCode.CRAWLING_NOT_ACCESS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public interface ProblemService {

ProblemHtmlResponse getProblemInfoHtml(ProblemFindRequest request);
ProblemHtmlResponse getProblemInfoHtml(String problemLink);

List<ProblemTestCaseResponse> getProblemTestCases(ProblemFindRequest request);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import ei.algobaroapi.domain.problem.dto.request.ProblemFindRequest;
import ei.algobaroapi.domain.problem.dto.response.ProblemHtmlResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "Problem", description = "문제 관련 API")
@SuppressWarnings("unused")
public interface ProblemControllerDoc {

@Operation(summary = "문제 정보 조회", description = "문제 사이트의 내용을 HTML로 가져옵니다.")
ProblemHtmlResponse getProblemHtml(ProblemFindRequest request);
@ApiResponse(responseCode = "200", description = "문제 정보 조회 성공")
ProblemHtmlResponse getProblemHtml(String problemLink);
}

0 comments on commit fcdf4b7

Please sign in to comment.