diff --git a/src/main/java/com/com/cnu/devlog_springboot/model/ErrorResponse.java b/src/main/java/com/com/cnu/devlog_springboot/model/ErrorResponse.java new file mode 100644 index 0000000..d4a02fa --- /dev/null +++ b/src/main/java/com/com/cnu/devlog_springboot/model/ErrorResponse.java @@ -0,0 +1,26 @@ +package com.com.cnu.devlog_springboot.model; + +public record ErrorResponse(String title, Integer status, Integer code, String instance) { + public ErrorResponse(String title, Integer status, Integer code, String instance) { + this.title = title; + this.status = status; + this.code = code; + this.instance = instance; + } + + public String title() { + return this.title; + } + + public Integer status() { + return this.status; + } + + public Integer code() { + return this.code; + } + + public String instance() { + return this.instance; + } +} diff --git a/src/main/java/com/com/cnu/devlog_springboot/model/Project.java b/src/main/java/com/com/cnu/devlog_springboot/model/Project.java index 29d0b72..b8661b3 100644 --- a/src/main/java/com/com/cnu/devlog_springboot/model/Project.java +++ b/src/main/java/com/com/cnu/devlog_springboot/model/Project.java @@ -22,4 +22,65 @@ public class Project { String contents; LocalDate startDate; LocalDate endDate; + + public Integer getId() { + return this.id; + } + + public String getTitle() { + return this.title; + } + + public String getSummary() { + return this.summary; + } + + public String getContents() { + return this.contents; + } + + public LocalDate getStartDate() { + return this.startDate; + } + + public LocalDate getEndDate() { + return this.endDate; + } + + public void setId(final Integer id) { + this.id = id; + } + + public void setTitle(final String title) { + this.title = title; + } + + public void setSummary(final String summary) { + this.summary = summary; + } + + public void setContents(final String contents) { + this.contents = contents; + } + + public void setStartDate(final LocalDate startDate) { + this.startDate = startDate; + } + + public void setEndDate(final LocalDate endDate) { + this.endDate = endDate; + } + + public Project(final Integer id, final String title, final String summary, final String contents, final LocalDate startDate, final LocalDate endDate) { + this.id = id; + this.title = title; + this.summary = summary; + this.contents = contents; + this.startDate = startDate; + this.endDate = endDate; + } + + protected Project() { + } } + diff --git a/src/main/java/com/com/cnu/devlog_springboot/model/request/ProjectRequest.java b/src/main/java/com/com/cnu/devlog_springboot/model/request/ProjectRequest.java index 2ae3a17..a004e3a 100644 --- a/src/main/java/com/com/cnu/devlog_springboot/model/request/ProjectRequest.java +++ b/src/main/java/com/com/cnu/devlog_springboot/model/request/ProjectRequest.java @@ -9,4 +9,31 @@ public record ProjectRequest( LocalDate startDate, LocalDate endDate ) { + public ProjectRequest(String title, String summary, String contents, LocalDate startDate, LocalDate endDate) { + this.title = title; + this.summary = summary; + this.contents = contents; + this.startDate = startDate; + this.endDate = endDate; + } + + public String title() { + return this.title; + } + + public String summary() { + return this.summary; + } + + public String contents() { + return this.contents; + } + + public LocalDate startDate() { + return this.startDate; + } + + public LocalDate endDate() { + return this.endDate; + } } diff --git a/src/main/java/com/com/cnu/devlog_springboot/type/ErrorCode.java b/src/main/java/com/com/cnu/devlog_springboot/type/ErrorCode.java new file mode 100644 index 0000000..c6fa206 --- /dev/null +++ b/src/main/java/com/com/cnu/devlog_springboot/type/ErrorCode.java @@ -0,0 +1,26 @@ +package com.com.cnu.devlog_springboot.type; + +import lombok.Getter; +import org.springframework.http.HttpStatus; + +@Getter +public enum ErrorCode { + POST_NOT_FOUND( + HttpStatus.NOT_FOUND, + 4000, + "해당 게시글을 찾을 수 없습니다." + ), PROJECT_NOT_FOUND( + HttpStatus.NOT_FOUND, + 404, + "해당 프로젝트를 찾을 수 없습니다." + ); + private final HttpStatus httpStatus; + private final Integer errorCode; + private final String description; + + ErrorCode(HttpStatus httpStatus, Integer errorCode, String description) { + this.httpStatus = httpStatus; + this.errorCode = errorCode; + this.description = description; + } +} \ No newline at end of file