-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCommonCodeController.java
More file actions
33 lines (25 loc) · 1.11 KB
/
CommonCodeController.java
File metadata and controls
33 lines (25 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.kernel360.commoncode.controller;
import com.kernel360.commoncode.dto.CommonCodeDto;
import com.kernel360.commoncode.service.CommonCodeService;
import com.kernel360.response.ApiResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import static com.kernel360.commoncode.code.CommonCodeBusinessCode.GET_COMMON_CODE_SUCCESS;
@RestController
@RequiredArgsConstructor
@RequestMapping("/commoncode")
public class CommonCodeController {
private final CommonCodeService commonCodeService;
//
@GetMapping("/{codeName}")
public ResponseEntity<ApiResponse<List<CommonCodeDto>>> getCommonCode (@PathVariable String codeName){
//
List<CommonCodeDto> codes = commonCodeService.getCodes(codeName);
return ApiResponse.toResponseEntity(GET_COMMON_CODE_SUCCESS, codes);
}
}