-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : 기본 응답을 위한 Base,success,error Response 객체 생성 (#8)
* feat : HttpResponse 반환을 위한 BaseResponse 추상클래스와 Success, Error Response 클래스 생성 (CC-96) * fix : ResponseEntity 내부에 객체를 반환할 시 406에러가 떠서 반환 객체에 Response 추가(CC-96) * refactor : httpMessage가 아닌 반환 값이 존재하지 않으므로 RestController를 사용하지 않음 (CC-96) * feat : Response 객체에 @Getter 추가 (CC-96) * feat : createdAt, updateAt 엔티티 컬럼 생성 (CC-96) * rename : health check api 디렉터리 변경 (CC-96) * test : 테스트코드 cicd test (CC-96) * [CC-83] Github Actions CI/CD 파일 작성, Create Dockerfile (#3) (#5) * chore : Github Actions CI/CD 설정 (CC-83) * chore : CI/CD 파일 application.yml 관련 내용 제거, Dockerfile 수정 (CC-83) * chore : CD 부분 도커 이미지 8080포트로 실행 (CC-83) * chore : PR과 PUSH에 따른 CI/CD 분리 (CC-83) * feat : S3 이미지 업로드 api 생성, IAM role을 활용한 ec2 권한 부여 (CC-90) (#6) * chore : 환경변수 관리를 위한 S3.yml을 깃 이그노어 * chore : 환경변수 관리를 위한 S3.yml을 깃 이그노어 * chore : 환경변수 관리를 위한 S3.yml을 깃 이그노어 (CC-90) * chore : 환경변수 관리를 위한 S3.yml을 깃 이그노어 (CC-90) * feat : 멀티파트 형태의 이미지를 받아 S3에 업로드하는 로직 및 컨트롤러 생성 (CC-90) * refactor : IAM role을 사용하여 ec2에 s3 접근 권한을 부여하도록 로직 수정 (CC-90) * del : 중복된 health test controller 삭제 (CC-96) --------- Co-authored-by: ikjunoh <put_data@naver.com>
- Loading branch information
Showing
6 changed files
with
86 additions
and
13 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/main/java/ai/softeer/caecae/global/controller/HealthTestController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package ai.softeer.caecae.global.controller; | ||
|
||
import ai.softeer.caecae.global.dto.response.SuccessResponse; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
|
||
@Controller | ||
public class HealthTestController { | ||
@GetMapping("/api/health") | ||
public ResponseEntity<SuccessResponse<String>> healthTest() { | ||
return ResponseEntity.ok(new SuccessResponse<>(1000,"api health test에 성공했습니다.","health test v1")); | ||
} | ||
|
||
} | ||
|
13 changes: 13 additions & 0 deletions
13
src/main/java/ai/softeer/caecae/global/dto/response/BaseResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package ai.softeer.caecae.global.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public abstract class BaseResponse { | ||
// 커스텀 응답 코드 종류 | ||
private int responseCode; | ||
// 응답 정보를 담은 메시지 | ||
private String message; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/ai/softeer/caecae/global/dto/response/ErrorResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ai.softeer.caecae.global.dto.response; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class ErrorResponse extends BaseResponse{ | ||
public ErrorResponse(int responseCode, String message) { | ||
super(responseCode, message); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/ai/softeer/caecae/global/dto/response/SuccessResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package ai.softeer.caecae.global.dto.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class SuccessResponse<T> extends BaseResponse { | ||
// httpResponse 를 통해 넘겨 줄 응답 데이터 | ||
private T data; | ||
|
||
// 응답코드, 메세지, 반환 데이터를 파라미터로 받는 생성자 | ||
public SuccessResponse(int responseCode, String message, T data) { | ||
super(responseCode, message); | ||
this.data = data; | ||
} | ||
|
||
// 코드 및 메시지를 설정하지 않은 생성자 | ||
public SuccessResponse(T data) { | ||
super(0, "요청 성공 기본 메시지 입니다."); | ||
this.data = data; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/ai/softeer/caecae/global/entity/TimeStampEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ai.softeer.caecae.global.entity; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
//TODO : JPA 의존성 설정 후 Audit, CreatedAt 등 어노테이션 설정 | ||
public abstract class TimeStampEntity { | ||
// 엔티티가 생성된 시간 | ||
private LocalDateTime createdAt; | ||
// 엔티티가 업데이트된 시간 | ||
private LocalDateTime updatedAt; | ||
} |
26 changes: 13 additions & 13 deletions
26
src/test/java/ai/softeer/caecae/CaecaeApplicationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package ai.softeer.caecae; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
@SpringBootTest | ||
class CaecaeApplicationTests { | ||
|
||
@Test | ||
void contextLoads() { | ||
} | ||
|
||
} | ||
//package ai.softeer.caecae; | ||
// | ||
//import org.junit.jupiter.api.Test; | ||
//import org.springframework.boot.test.context.SpringBootTest; | ||
// | ||
//@SpringBootTest | ||
//class CaecaeApplicationTests { | ||
// | ||
// @Test | ||
// void contextLoads() { | ||
// } | ||
// | ||
//} |