diff --git a/src/main/java/ai/softeer/caecae/global/controller/HealthTestController.java b/src/main/java/ai/softeer/caecae/global/controller/HealthTestController.java new file mode 100644 index 0000000..5b1838c --- /dev/null +++ b/src/main/java/ai/softeer/caecae/global/controller/HealthTestController.java @@ -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> healthTest() { + return ResponseEntity.ok(new SuccessResponse<>(1000,"api health test에 성공했습니다.","health test v1")); + } + +} + diff --git a/src/main/java/ai/softeer/caecae/global/dto/response/BaseResponse.java b/src/main/java/ai/softeer/caecae/global/dto/response/BaseResponse.java new file mode 100644 index 0000000..d9952ef --- /dev/null +++ b/src/main/java/ai/softeer/caecae/global/dto/response/BaseResponse.java @@ -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; +} diff --git a/src/main/java/ai/softeer/caecae/global/dto/response/ErrorResponse.java b/src/main/java/ai/softeer/caecae/global/dto/response/ErrorResponse.java new file mode 100644 index 0000000..265e29f --- /dev/null +++ b/src/main/java/ai/softeer/caecae/global/dto/response/ErrorResponse.java @@ -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); + } + +} diff --git a/src/main/java/ai/softeer/caecae/global/dto/response/SuccessResponse.java b/src/main/java/ai/softeer/caecae/global/dto/response/SuccessResponse.java new file mode 100644 index 0000000..24e12bb --- /dev/null +++ b/src/main/java/ai/softeer/caecae/global/dto/response/SuccessResponse.java @@ -0,0 +1,22 @@ +package ai.softeer.caecae.global.dto.response; + +import lombok.Builder; +import lombok.Getter; + +@Getter +public class SuccessResponse 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; + } +} diff --git a/src/main/java/ai/softeer/caecae/global/entity/TimeStampEntity.java b/src/main/java/ai/softeer/caecae/global/entity/TimeStampEntity.java new file mode 100644 index 0000000..20aee84 --- /dev/null +++ b/src/main/java/ai/softeer/caecae/global/entity/TimeStampEntity.java @@ -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; +} diff --git a/src/test/java/ai/softeer/caecae/CaecaeApplicationTests.java b/src/test/java/ai/softeer/caecae/CaecaeApplicationTests.java index a88f16f..6c89729 100644 --- a/src/test/java/ai/softeer/caecae/CaecaeApplicationTests.java +++ b/src/test/java/ai/softeer/caecae/CaecaeApplicationTests.java @@ -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() { +// } +// +//}