1
1
package oncoding .concoder .controller ;
2
2
3
+ import java .io .IOException ;
3
4
import java .util .List ;
4
5
import java .util .UUID ;
5
6
import lombok .RequiredArgsConstructor ;
7
+ import lombok .extern .slf4j .Slf4j ;
6
8
import oncoding .concoder .dto .CategoryDto ;
7
9
import oncoding .concoder .dto .LevelDto ;
8
10
import oncoding .concoder .dto .ProblemDto ;
14
16
import oncoding .concoder .service .ProblemService ;
15
17
import org .springframework .http .MediaType ;
16
18
import org .springframework .web .bind .annotation .GetMapping ;
19
+ import org .springframework .web .bind .annotation .PostMapping ;
17
20
import org .springframework .web .bind .annotation .RequestMapping ;
18
21
import org .springframework .web .bind .annotation .RequestParam ;
19
22
import org .springframework .web .bind .annotation .RestController ;
20
23
24
+ @ Slf4j
21
25
@ RestController
22
26
@ RequestMapping (value = "/problems" , produces = MediaType .APPLICATION_JSON_VALUE )
23
27
@ RequiredArgsConstructor
@@ -30,6 +34,16 @@ public class ProblemController {
30
34
private final LevelDtoMapper levelDtoMapper ;
31
35
private final ProblemDtoMapper problemDtoMapper ;
32
36
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
+
33
47
@ GetMapping ("/categories" )
34
48
public List <CategoryDto .Response > getCategories () {
35
49
return categoryDtoMapper .toResponseList (categoryService .getCategories ());
0 commit comments