Merge branch 'feat/dev_251201' of https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice into feat/dev_251201

This commit is contained in:
Moon
2025-12-16 09:20:09 +09:00
46 changed files with 462 additions and 11267 deletions

View File

@@ -161,8 +161,6 @@ public class GlobalExceptionHandler {
errorLog.getId());
}
@ResponseStatus(HttpStatus.UNPROCESSABLE_ENTITY)
@ExceptionHandler(DataIntegrityViolationException.class)
public ApiResponseDto<String> handlerDataIntegrityViolationException(
@@ -278,8 +276,8 @@ public class GlobalExceptionHandler {
String codeName = "";
switch (e.getField()) {
case USER_ID -> {
codeName = "DUPLICATE_DATA";
case EMPLOYEE_NO -> {
codeName = "DUPLICATE_EMPLOYEEID";
}
default -> {
codeName = "DUPLICATE_DATA";

View File

@@ -6,16 +6,30 @@ import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.servers.Server;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class OpenApiConfig {
@Value("${server.port}")
private String serverPort;
@Value("${spring.profiles.active:local}")
private String profile;
@Value("${swagger.dev-url:https://kamco.dev-api.gs.dabeeo.com}")
private String devUrl;
@Value("${swagger.prod-url:https://api.kamco.com}")
private String prodUrl;
@Bean
public OpenAPI kamcoOpenAPI() {
// 🔹 1) SecurityScheme 정의 (Bearer JWT)
// 1) SecurityScheme 정의 (Bearer JWT)
SecurityScheme bearerAuth =
new SecurityScheme()
.type(SecurityScheme.Type.HTTP)
@@ -24,12 +38,21 @@ public class OpenApiConfig {
.in(SecurityScheme.In.HEADER)
.name("Authorization");
// 🔹 2) SecurityRequirement (기본으로 BearerAuth 사용)
// 2) SecurityRequirement (기본으로 BearerAuth 사용)
SecurityRequirement securityRequirement = new SecurityRequirement().addList("BearerAuth");
// 🔹 3) Components 에 SecurityScheme 등록
// 3) Components 에 SecurityScheme 등록
Components components = new Components().addSecuritySchemes("BearerAuth", bearerAuth);
// profile 별 server url 분기
List<Server> servers = new ArrayList<>();
switch (profile) {
case "prod" -> servers.add(new Server().url(prodUrl).description("운영 서버"));
case "dev" -> servers.add(new Server().url(devUrl).description("개발 서버"));
default ->
servers.add(new Server().url("http://localhost:" + serverPort).description("로컬 개발 서버"));
}
return new OpenAPI()
.info(
new Info()
@@ -38,19 +61,10 @@ public class OpenApiConfig {
"KAMCO 변화 탐지 시스템 API 문서\n\n"
+ "이 API는 지리공간 데이터를 활용한 변화 탐지 시스템을 제공합니다.\n"
+ "GeoJSON 형식의 공간 데이터를 처리하며, PostgreSQL/PostGIS 기반으로 동작합니다.")
.version("v1.0.0")
// .contact(new Contact().name("KAMCO Development
// Team").email("dev@kamco.com").url("https://kamco.com"))
// .license(new License().name("Proprietary").url("https://kamco.com/license"))
)
.servers(
List.of(
new Server().url("http://localhost:8080").description("로컬 개발 서버"),
new Server().url("https://kamco.dev-api.gs.dabeeo.com").description("개발 서버")
// , new Server().url("https://api.kamco.com").description("운영 서버")
))
.components(new Components())
// 🔥 여기 한 줄이 "모든 API 기본적으로 BearerAuth 요구" 의미
.version("v1.0.0"))
.servers(servers)
// 만들어둔 components를 넣어야 함
.components(components)
.addSecurityItem(securityRequirement);
}
}

View File

@@ -69,6 +69,7 @@ public class SecurityConfig {
.requestMatchers(
"/api/auth/signin",
"/api/auth/refresh",
"/api/auth/logout",
"/swagger-ui/**",
"/api/members/*/password",
"/v3/api-docs/**")
@@ -99,7 +100,7 @@ public class SecurityConfig {
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration(); // CORS 객체 생성
config.setAllowedOriginPatterns(List.of("*")); // 도메인 허용
config.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS"));
config.setAllowedMethods(List.of("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"));
config.setAllowedHeaders(List.of("*")); // 헤더요청 Authorization, Content-Type, X-Custom-Header
config.setAllowCredentials(true); // 쿠키, Authorization 헤더, Bearer Token 등 자격증명 포함 요청을 허용할지 설정

View File

@@ -167,6 +167,7 @@ public class ApiResponseDto<T> {
LOGIN_ID_NOT_FOUND("아이디를 잘못 입력하셨습니다."),
LOGIN_PASSWORD_MISMATCH("비밀번호를 잘못 입력하셨습니다."),
LOGIN_PASSWORD_EXCEEDED("비밀번호 오류 횟수를 초과하여 이용하실 수 없습니다.\n로그인 오류에 대해 관리자에게 문의하시기 바랍니다."),
INACTIVE_ID("사용할 수 없는 계정입니다."),
INVALID_EMAIL_TOKEN(
"You can only reset your password within 24 hours from when the email was sent.\n"
+ "To reset your password again, please submit a new request through \"Forgot"