Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

202202585 #66

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;
}
}
61 changes: 61 additions & 0 deletions src/main/java/com/com/cnu/devlog_springboot/model/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
26 changes: 26 additions & 0 deletions src/main/java/com/com/cnu/devlog_springboot/type/ErrorCode.java
Original file line number Diff line number Diff line change
@@ -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;
}
}