From 049cfda9c81d514704470d56481d7263effaae6a Mon Sep 17 00:00:00 2001 From: njw010528 <162092622+njw010528@users.noreply.github.com> Date: Mon, 6 May 2024 18:58:01 +0900 Subject: [PATCH 1/3] Project.java --- .../cnu/devlog_springboot/model/Project.java | 74 +++++++++++++++++-- 1 file changed, 66 insertions(+), 8 deletions(-) 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..838d9b0 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 @@ -4,22 +4,80 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; -import lombok.*; - import java.time.LocalDate; -@Getter -@Setter -@Entity(name = "projects") -@AllArgsConstructor -@NoArgsConstructor(access = AccessLevel.PROTECTED, force = true) +@Entity( + name = "projects" +) public class Project { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue( + strategy = GenerationType.IDENTITY + ) Integer id; String title; String summary; 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() { + } } From 3de6b916f16b5173c33dd214310af6d450fb1d34 Mon Sep 17 00:00:00 2001 From: njw010528 <162092622+njw010528@users.noreply.github.com> Date: Mon, 6 May 2024 18:58:29 +0900 Subject: [PATCH 2/3] ProjectRequest.java --- .../model/request/ProjectRequest.java | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) 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..61c6a1e 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 @@ -2,11 +2,32 @@ import java.time.LocalDate; -public record ProjectRequest( - String title, - String summary, - String contents, - LocalDate startDate, - LocalDate endDate -) { +public record ProjectRequest(String title, String summary, String contents, 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; + } } From 4680cc7b809c330cb381b2886792a1d8a601da37 Mon Sep 17 00:00:00 2001 From: njw010528 <162092622+njw010528@users.noreply.github.com> Date: Mon, 6 May 2024 18:59:23 +0900 Subject: [PATCH 3/3] ErrorResponse.java --- .../model/ErrorResponse.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/main/java/com/com/cnu/devlog_springboot/model/ErrorResponse.java 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..a4a6478 --- /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.response; + +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; + } +}