1- package scanner .controller ;
1+ package scanner .checklist . controller ;
22
33import io .swagger .annotations .ApiImplicitParam ;
44import io .swagger .annotations .ApiImplicitParams ;
55import io .swagger .annotations .ApiOperation ;
66import lombok .RequiredArgsConstructor ;
7-
7+ import scanner .checklist .dto .CheckListDetailDto ;
8+ import scanner .checklist .dto .CheckListModifyDto ;
9+ import scanner .checklist .dto .CheckListSimpleDto ;
10+ import scanner .checklist .service .CheckListService ;
11+ import scanner .common .dto .CommonResponse ;
12+ import scanner .common .enums .Language ;
13+
14+ import org .springframework .lang .Nullable ;
815import org .springframework .web .bind .annotation .*;
916
10- import scanner .dto .rule .CheckListDetailDto ;
11- import scanner .dto .rule .CheckListModifyDto ;
12- import scanner .dto .rule .CheckListSimpleDto ;
13- import scanner .dto .CommonResponse ;
14- import scanner .service .rule .CheckListService ;
15-
1617@ ApiOperation ("Checklist API. Checklist is same as Rule." )
1718@ RestController
1819@ RequestMapping ("/api/v1/checklist" )
@@ -23,18 +24,17 @@ public class CheckListController {
2324
2425 @ ApiOperation (value = "Retrieve Checklist" , notes = "Retrieve all checklists. You can use Search" , response = CommonResponse .class )
2526 @ ApiImplicitParams ({
26- @ ApiImplicitParam (name = "Authorization" , paramType = "header" , value = "Access Token" , required = true , dataTypeClass = String .class ),
27- @ ApiImplicitParam (name = "rule" , paramType = "query" , value = "Checklist(rule) ID. It's Option." , required = false , dataTypeClass = String .class , example = "CKV_NCP_1" )})
27+ @ ApiImplicitParam (name = "Authorization" , paramType = "header" , value = "Access Token" , required = true , dataTypeClass = String .class )})
2828 @ GetMapping
29- public CommonResponse <CheckListSimpleDto .Response > checkLists (@ RequestParam ( "rule" ) String ruleId ) {
30- CheckListSimpleDto .Response dto = checkListService .getCheckLists (ruleId );
29+ public CommonResponse <CheckListSimpleDto .Response > checkLists () {
30+ CheckListSimpleDto .Response dto = checkListService .getCheckLists (null );
3131
3232 return new CommonResponse <>(dto );
3333 }
3434
3535 @ ApiOperation (value = "Create Custom Checklist" , notes = "Create custom new checklist from origin." , response = CommonResponse .class )
3636 @ ApiImplicitParams ({
37- @ ApiImplicitParam (name = "Authorization" , paramType = "header" , value = "Access Token" , required = true , dataTypeClass = String .class ), })
37+ @ ApiImplicitParam (name = "Authorization" , paramType = "header" , value = "Access Token" , required = true , dataTypeClass = String .class )})
3838 @ PostMapping
3939 public CommonResponse <CheckListDetailDto .Detail > addCheckList (CheckListDetailDto .Detail data ) {
4040 CheckListDetailDto .Detail dto = checkListService .addCheckListDetails (data );
@@ -45,10 +45,12 @@ public CommonResponse<CheckListDetailDto.Detail> addCheckList(CheckListDetailDto
4545 @ ApiOperation (value = "Retrieve Checklist Details" , notes = "Retrieve checklists." , response = CommonResponse .class )
4646 @ ApiImplicitParams ({
4747 @ ApiImplicitParam (name = "Authorization" , paramType = "header" , value = "Access Token" , required = true , dataTypeClass = String .class ),
48- @ ApiImplicitParam (name = "ruleId" , paramType = "path" , value = "Checklist(rule) ID" , required = true , dataTypeClass = String .class , example = "CKV_NCP_1" )})
48+ @ ApiImplicitParam (name = "ruleId" , paramType = "path" , value = "Checklist(rule) ID" , required = true , dataTypeClass = String .class , example = "CKV_NCP_1" ),
49+ @ ApiImplicitParam (name = "lang" , paramType = "query" , value = "eng, kor" , required = false , dataTypeClass = String .class )})
4950 @ GetMapping ("/{ruleId}" )
50- public CommonResponse <CheckListDetailDto .Detail > checkListDetails (@ PathVariable String ruleId ) {
51- CheckListDetailDto .Detail dto = checkListService .getCheckListDetails (ruleId );
51+ public CommonResponse <CheckListDetailDto .Detail > checkListDetails (@ PathVariable String ruleId ,
52+ @ Nullable @ RequestParam String lang ) {
53+ CheckListDetailDto .Detail dto = checkListService .getCheckListDetails (ruleId , Language .of (lang ));
5254
5355 return new CommonResponse <>(dto );
5456 }
@@ -57,7 +59,7 @@ public CommonResponse<CheckListDetailDto.Detail> checkListDetails(@PathVariable
5759 @ ApiImplicitParams ({
5860 @ ApiImplicitParam (name = "Authorization" , paramType = "header" , value = "Access Token" , required = true , dataTypeClass = String .class ),
5961 @ ApiImplicitParam (name = "ruleId" , paramType = "path" , value = "ruleId." , required = true , dataTypeClass = String .class ),
60- @ ApiImplicitParam (paramType = "body" , value = "Modify ruleOnOff n to y, y to n" , required = true , dataTypeClass = CheckListModifyDto .Modifying .class )})
62+ @ ApiImplicitParam (name = "CheckListSimpleDto.Simple" , paramType = "body" , value = "Modify ruleOnOff n to y, y to n" , required = true , dataTypeClass = CheckListModifyDto .Modifying .class )})
6163 @ PatchMapping ("/{ruleId}" )
6264 public CommonResponse <CheckListSimpleDto .Simple > modifyCheckListDetails (@ PathVariable String ruleId ,
6365 @ RequestBody CheckListModifyDto .Modifying data ) {
@@ -70,7 +72,7 @@ public CommonResponse<CheckListSimpleDto.Simple> modifyCheckListDetails(@PathVar
7072 @ ApiImplicitParams ({
7173 @ ApiImplicitParam (name = "Authorization" , paramType = "header" , value = "Access Token" , required = true , dataTypeClass = String .class ),
7274 @ ApiImplicitParam (name = "ruleId" , paramType = "path" , value = "ruleId." , required = true , dataTypeClass = String .class ),
73- @ ApiImplicitParam (paramType = "body" , value = "Modify ruleOnOff n to y, y to n" , required = true , dataTypeClass = CheckListModifyDto .State .class )})
75+ @ ApiImplicitParam (name = "CheckListSimpleDto.Simple" , paramType = "body" , value = "Modify ruleOnOff n to y, y to n" , required = true , dataTypeClass = CheckListModifyDto .State .class )})
7476 @ PatchMapping ("/state/{ruleId}" )
7577 public CommonResponse <CheckListSimpleDto .Simple > modifyCheckListOnOff (@ PathVariable String ruleId ,
7678 @ RequestBody CheckListSimpleDto .Simple data ) {
@@ -82,11 +84,12 @@ public CommonResponse<CheckListSimpleDto.Simple> modifyCheckListOnOff(@PathVaria
8284 @ ApiOperation (value = "Reset Checklist" , notes = "Reset custom checklist to origin." , response = CommonResponse .class )
8385 @ ApiImplicitParams ({
8486 @ ApiImplicitParam (name = "Authorization" , paramType = "header" , value = "Access Token" , required = true , dataTypeClass = String .class ),
85- @ ApiImplicitParam (paramType = "body" , value = "Body need ruleId." , required = true , dataTypeClass = CheckListSimpleDto .Simple .class )})
87+ @ ApiImplicitParam (name = "CheckListSimpleDto.Simple" , paramType = "body" , value = "Body need ruleId." , required = true , dataTypeClass = CheckListSimpleDto .Simple .class )})
8688 @ PostMapping ("/state" )
8789 public CommonResponse <CheckListSimpleDto .Simple > resetCheckList (@ RequestBody CheckListSimpleDto .Simple data ) {
8890 CheckListSimpleDto .Simple dto = checkListService .resetCheckList (data );
8991
9092 return new CommonResponse <>(dto );
9193 }
9294}
95+
0 commit comments