11package oncoding .concoder .controller ;
22
3+ import java .io .IOException ;
34import java .util .List ;
45import java .util .UUID ;
56import lombok .RequiredArgsConstructor ;
7+ import lombok .extern .slf4j .Slf4j ;
68import oncoding .concoder .dto .CategoryDto ;
79import oncoding .concoder .dto .LevelDto ;
810import oncoding .concoder .dto .ProblemDto ;
1416import oncoding .concoder .service .ProblemService ;
1517import org .springframework .http .MediaType ;
1618import org .springframework .web .bind .annotation .GetMapping ;
19+ import org .springframework .web .bind .annotation .PostMapping ;
1720import org .springframework .web .bind .annotation .RequestMapping ;
1821import org .springframework .web .bind .annotation .RequestParam ;
1922import org .springframework .web .bind .annotation .RestController ;
2023
24+ @ Slf4j
2125@ RestController
2226@ RequestMapping (value = "/problems" , produces = MediaType .APPLICATION_JSON_VALUE )
2327@ RequiredArgsConstructor
@@ -30,6 +34,16 @@ public class ProblemController {
3034 private final LevelDtoMapper levelDtoMapper ;
3135 private final ProblemDtoMapper problemDtoMapper ;
3236
37+ @ PostMapping ("/crawling" )
38+ public void createProblems () {
39+ try {
40+ problemService .createProblems ();
41+ }
42+ catch (IOException e ) {
43+ log .info (e .getMessage ());
44+ }
45+ }
46+
3347 @ GetMapping ("/categories" )
3448 public List <CategoryDto .Response > getCategories () {
3549 return categoryDtoMapper .toResponseList (categoryService .getCategories ());
0 commit comments