Skip to content

Commit

Permalink
feat: 임의 크롤링 실행 위한 API 경로 추가
Browse files Browse the repository at this point in the history
- POST /api/problems/crawling
  • Loading branch information
binimini committed Jan 29, 2023
1 parent d203d9f commit 125fdef
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/oncoding/concoder/controller/ProblemController.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package oncoding.concoder.controller;

import java.io.IOException;
import java.util.List;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import oncoding.concoder.dto.CategoryDto;
import oncoding.concoder.dto.LevelDto;
import oncoding.concoder.dto.ProblemDto;
Expand All @@ -14,10 +16,12 @@
import oncoding.concoder.service.ProblemService;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping(value = "/problems", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
Expand All @@ -30,6 +34,16 @@ public class ProblemController {
private final LevelDtoMapper levelDtoMapper;
private final ProblemDtoMapper problemDtoMapper;

@PostMapping("/crawling")
public void createProblems() {
try {
problemService.createProblems();
}
catch (IOException e) {
log.info(e.getMessage());
}
}

@GetMapping("/categories")
public List<CategoryDto.Response> getCategories() {
return categoryDtoMapper.toResponseList(categoryService.getCategories());
Expand Down

0 comments on commit 125fdef

Please sign in to comment.