feat: v1 / v2 구분 패키지 반영

dev
minuk926 3 years ago
parent 47008f2111
commit 0a5e2859a4

@ -2,7 +2,7 @@ package com.xit;
//import com.xit.core.config.ignore.DataJdbcConfig; //import com.xit.core.config.ignore.DataJdbcConfig;
import com.xit.core.api.CustomBeanNameGenerator; import com.xit.core.config.support.CustomBeanNameGenerator;
import com.xit.core.oauth2.config.properties.AppProperties; import com.xit.core.oauth2.config.properties.AppProperties;
import com.xit.core.oauth2.config.properties.CorsProperties; import com.xit.core.oauth2.config.properties.CorsProperties;
import com.xit.core.util.Checks; import com.xit.core.util.Checks;

@ -0,0 +1,81 @@
package com.xit.biz.ctgy.v2.controller;
import com.xit.biz.ctgy.dto.BoardDto;
import com.xit.biz.ctgy.service.IBoardService;
import com.xit.core.annotation.Secured;
import com.xit.core.annotation.SecurityPolicy;
import com.xit.core.api.IRestResponse;
import com.xit.core.api.RestResponse;
import com.xit.core.util.AssertUtils;
import com.xit.core.util.Checks;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Nonnull;
@Tag(name = "BoardController", description = "게시글 관리")
@RestController
@RequestMapping("/api/v2/ctgy/board")
@Validated
@RequiredArgsConstructor
public class BoardController {
private final IBoardService service;
// TODO :: 파라메터 정의 필요
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "게시글 목록 조회" , description = "게시글 목록 조회")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "ciTitle", description = "제목", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "ciName", description = "이름", required = false, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"),
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
})
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findMinCivBoard680s(
@Parameter(hidden = true)
final BoardDto dto,
@Parameter(hidden = true)
final Pageable pageable) {
return RestResponse.of(service.findAll(dto, pageable));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "게시글 조회수 증가" , description = "게시글 조회수 증가")
@Parameters({
@Parameter(in = ParameterIn.PATH, name = "ciCode", description = "게시글번호", required = true, example = "18"),
})
@PutMapping(value = "/hit/{ciCode}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> modifyByCiCode(@PathVariable final Long ciCode) {
return RestResponse.of(service.modifyByCiCode(ciCode));
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "게시글 등록" , description = "게시글 등록")
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> saveBoard(BoardDto dto) {
service.saveBoard(dto);
return RestResponse.of(HttpStatus.OK);
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "게시글 삭제", description = "게시글 삭제")
@PostMapping(value = "/{ciCode}")
public ResponseEntity<? extends IRestResponse> removeBoard(@PathVariable @Nonnull final Long ciCode) {
AssertUtils.isTrue(!Checks.isEmpty(ciCode), "게시글이 선택되지 않았습니다.");
service.removeBoard(ciCode);
return RestResponse.of(HttpStatus.OK);
}
}

@ -1,4 +1,4 @@
package com.xit.core.api; package com.xit.core.config.support;
import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanDefinitionRegistry;

@ -76,6 +76,16 @@ public class SpringDocApiConfig {
.build(); .build();
} }
@Bean
public GroupedOpenApi ctgyBizApiV2() {
return GroupedOpenApi.builder()
.group("1-2. Ctgy-biz-API-v2")
.pathsToMatch(
"/api/v2/ctgy/**"
)
.build();
}
@Bean @Bean
public GroupedOpenApi authorizeApi() { public GroupedOpenApi authorizeApi() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()

Loading…
Cancel
Save