From 08e5f908be22755f6b9ee0469f709d844de2dc37 Mon Sep 17 00:00:00 2001 From: Zena0128 <0128ja@gmail.com> Date: Sat, 17 Feb 2024 13:33:07 +0900 Subject: [PATCH 1/3] =?UTF-8?q?:sparkles:Feat:=20mainpage=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20DTO=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/mainpage/controller/.dummy | 0 .../domain/mainpage/domain/Category.java | 12 +++++ .../mainpage/dto/CategoryCreateDTO.java | 16 +++++++ .../domain/mainpage/dto/CategoryViewDTO.java | 14 ++++++ .../domain/mainpage/dto/DoCreateDTO.java | 21 +++++++++ .../domain/mainpage/dto/DoViewDTO.java | 33 ++++++++++++++ .../domain/mainpage/dto/MainPageDTO.java | 45 +++++++++++++++++++ .../domain/mainpage/dto/PlanCreateDTO.java | 22 +++++++++ .../domain/mainpage/dto/PlanViewDTO.java | 34 ++++++++++++++ .../domain/mainpage/dto/SeeCreateDTO.java | 15 +++++++ .../domain/mainpage/dto/SeeViewDTO.java | 25 +++++++++++ .../timetris/domain/mainpage/exception/.dummy | 0 12 files changed, 237 insertions(+) delete mode 100644 src/main/java/com/trendithon/timetris/domain/mainpage/controller/.dummy create mode 100644 src/main/java/com/trendithon/timetris/domain/mainpage/dto/CategoryCreateDTO.java create mode 100644 src/main/java/com/trendithon/timetris/domain/mainpage/dto/CategoryViewDTO.java create mode 100644 src/main/java/com/trendithon/timetris/domain/mainpage/dto/DoCreateDTO.java create mode 100644 src/main/java/com/trendithon/timetris/domain/mainpage/dto/DoViewDTO.java create mode 100644 src/main/java/com/trendithon/timetris/domain/mainpage/dto/MainPageDTO.java create mode 100644 src/main/java/com/trendithon/timetris/domain/mainpage/dto/PlanCreateDTO.java create mode 100644 src/main/java/com/trendithon/timetris/domain/mainpage/dto/PlanViewDTO.java create mode 100644 src/main/java/com/trendithon/timetris/domain/mainpage/dto/SeeCreateDTO.java create mode 100644 src/main/java/com/trendithon/timetris/domain/mainpage/dto/SeeViewDTO.java delete mode 100644 src/main/java/com/trendithon/timetris/domain/mainpage/exception/.dummy diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/controller/.dummy b/src/main/java/com/trendithon/timetris/domain/mainpage/controller/.dummy deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/domain/Category.java b/src/main/java/com/trendithon/timetris/domain/mainpage/domain/Category.java index 758b154..a8382d7 100644 --- a/src/main/java/com/trendithon/timetris/domain/mainpage/domain/Category.java +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/domain/Category.java @@ -1,6 +1,7 @@ package com.trendithon.timetris.domain.mainpage.domain; import com.trendithon.timetris.domain.login.domain.User; +import com.trendithon.timetris.domain.mainpage.dto.CategoryCreateDTO; import jakarta.persistence.*; import lombok.AccessLevel; import lombok.AllArgsConstructor; @@ -21,4 +22,15 @@ public class Category { @JoinColumn(name = "userId") private User user; + public Category(CategoryCreateDTO categoryCreateDTO, User user){ + this.name = categoryCreateDTO.getName(); + this.colorCode = categoryCreateDTO.getColorCode(); + this.user = user; + } + + public void updateCategory(String name, String colorCode){ + this.name = name; + this.colorCode = colorCode; + } + } diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/dto/CategoryCreateDTO.java b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/CategoryCreateDTO.java new file mode 100644 index 0000000..d4e34d4 --- /dev/null +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/CategoryCreateDTO.java @@ -0,0 +1,16 @@ +package com.trendithon.timetris.domain.mainpage.dto; + +import com.trendithon.timetris.domain.login.domain.User; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@AllArgsConstructor @NoArgsConstructor +public class CategoryCreateDTO { + + private String name; + private String colorCode; + private User user; + +} diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/dto/CategoryViewDTO.java b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/CategoryViewDTO.java new file mode 100644 index 0000000..f260046 --- /dev/null +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/CategoryViewDTO.java @@ -0,0 +1,14 @@ +package com.trendithon.timetris.domain.mainpage.dto; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@AllArgsConstructor @NoArgsConstructor +public class CategoryViewDTO { + + private String name; + private String colorCode; + +} diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/dto/DoCreateDTO.java b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/DoCreateDTO.java new file mode 100644 index 0000000..d43aa75 --- /dev/null +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/DoCreateDTO.java @@ -0,0 +1,21 @@ +package com.trendithon.timetris.domain.mainpage.dto; + +import com.trendithon.timetris.domain.mainpage.domain.Category; +import com.trendithon.timetris.domain.mainpage.domain.UserDate; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.time.LocalTime; + +@Getter +@AllArgsConstructor @NoArgsConstructor +public class DoCreateDTO { + + private String title; + private LocalTime startTime; + private LocalTime endTime; + private Category category; + private UserDate userDate; + +} diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/dto/DoViewDTO.java b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/DoViewDTO.java new file mode 100644 index 0000000..395f88c --- /dev/null +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/DoViewDTO.java @@ -0,0 +1,33 @@ +package com.trendithon.timetris.domain.mainpage.dto; + +import com.trendithon.timetris.domain.mainpage.domain.Category; +import com.trendithon.timetris.domain.mainpage.domain.Date; +import com.trendithon.timetris.domain.mainpage.domain.Do; +import com.trendithon.timetris.domain.mainpage.domain.UserDate; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.time.LocalTime; + +@Getter +@Builder +@AllArgsConstructor @NoArgsConstructor +public class DoViewDTO { + + private String title; + private LocalTime startTime; + private LocalTime endTime; + private Category category; + + public static DoViewDTO of(Do does){ + return DoViewDTO.builder() + .title(does.getTitle()) + .startTime(does.getStartTime()) + .endTime(does.getEndTime()) + .category(does.getCategory()) + .build(); + } + +} diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/dto/MainPageDTO.java b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/MainPageDTO.java new file mode 100644 index 0000000..d8208ed --- /dev/null +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/MainPageDTO.java @@ -0,0 +1,45 @@ +package com.trendithon.timetris.domain.mainpage.dto; + +import com.trendithon.timetris.domain.mainpage.domain.Do; +import com.trendithon.timetris.domain.mainpage.domain.Plan; +import com.trendithon.timetris.domain.mainpage.domain.See; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; +import java.util.stream.Collectors; + +@Getter +@AllArgsConstructor @NoArgsConstructor +public class MainPageDTO { + + List planViewDTOList; + List doViewDTOList; + List seeViewDTO; + + public static MainPageDTO from(List planList, List doList, List seeList){ + List planViewDTOS = planList.stream() + .map(PlanViewDTO::of) + .toList(); + List doViewDTOS = doList.stream() + .map(DoViewDTO::of) + .toList(); + List seeViewDTO1 = sesL; + + return new MainPageDTO(planViewDTOS, doViewDTOS, seeViewDTO1); + + } + + public static MainPageDTO from(List planList, List doList){ + List planViewDTOS = planList.stream() + .map(PlanViewDTO::of) + .toList(); + List doViewDTOS = doList.stream() + .map(DoViewDTO::of) + .toList(); + + } + + +} diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/dto/PlanCreateDTO.java b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/PlanCreateDTO.java new file mode 100644 index 0000000..cc3d331 --- /dev/null +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/PlanCreateDTO.java @@ -0,0 +1,22 @@ +package com.trendithon.timetris.domain.mainpage.dto; + +import com.trendithon.timetris.domain.mainpage.domain.Category; +import com.trendithon.timetris.domain.mainpage.domain.UserDate; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.time.LocalTime; + +@Getter +@AllArgsConstructor @NoArgsConstructor +public class PlanCreateDTO { + + private String title; + private LocalTime startTime; + private LocalTime endTime; + private boolean status; + private Category category; + private UserDate userDate; + +} diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/dto/PlanViewDTO.java b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/PlanViewDTO.java new file mode 100644 index 0000000..5ea4c26 --- /dev/null +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/PlanViewDTO.java @@ -0,0 +1,34 @@ +package com.trendithon.timetris.domain.mainpage.dto; + +import com.trendithon.timetris.domain.mainpage.domain.Category; +import com.trendithon.timetris.domain.mainpage.domain.Plan; +import com.trendithon.timetris.domain.mainpage.domain.UserDate; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.time.LocalTime; + +@Getter +@Builder +@AllArgsConstructor @NoArgsConstructor +public class PlanViewDTO { + + private String title; + private LocalTime startTime; + private LocalTime endTime; + private boolean status; + private Category category; + + public static PlanViewDTO of(Plan plan){ + return PlanViewDTO.builder() + .title(plan.getTitle()) + .startTime(plan.getStartTime()) + .endTime(plan.getEndTime()) + .status(plan.isStatus()) + .category(plan.getCategory()) + .build(); + } + +} diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/dto/SeeCreateDTO.java b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/SeeCreateDTO.java new file mode 100644 index 0000000..a7a5ce8 --- /dev/null +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/SeeCreateDTO.java @@ -0,0 +1,15 @@ +package com.trendithon.timetris.domain.mainpage.dto; + +import com.trendithon.timetris.domain.mainpage.domain.UserDate; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@AllArgsConstructor @NoArgsConstructor +public class SeeCreateDTO { + + private String content; + private UserDate userDate; + +} diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/dto/SeeViewDTO.java b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/SeeViewDTO.java new file mode 100644 index 0000000..e0c6f08 --- /dev/null +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/SeeViewDTO.java @@ -0,0 +1,25 @@ +package com.trendithon.timetris.domain.mainpage.dto; + +import com.trendithon.timetris.domain.mainpage.domain.Date; +import com.trendithon.timetris.domain.mainpage.domain.See; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.Optional; + +@Getter +@Builder +@AllArgsConstructor @NoArgsConstructor +public class SeeViewDTO { + + private String content; + + public static SeeViewDTO of(See see){ + return SeeViewDTO.builder() + .content(see.getContent()) + .build(); + } + +} diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/exception/.dummy b/src/main/java/com/trendithon/timetris/domain/mainpage/exception/.dummy deleted file mode 100644 index e69de29..0000000 From 344068d84c8b9f717b092335a0272f463ebe5010 Mon Sep 17 00:00:00 2001 From: Zena0128 <0128ja@gmail.com> Date: Sat, 17 Feb 2024 13:39:00 +0900 Subject: [PATCH 2/3] =?UTF-8?q?:poop:Fix:=20=EB=88=84=EB=9D=BD=EB=90=9C=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trendithon/timetris/domain/mainpage/dto/MainPageDTO.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/trendithon/timetris/domain/mainpage/dto/MainPageDTO.java b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/MainPageDTO.java index d8208ed..8783297 100644 --- a/src/main/java/com/trendithon/timetris/domain/mainpage/dto/MainPageDTO.java +++ b/src/main/java/com/trendithon/timetris/domain/mainpage/dto/MainPageDTO.java @@ -25,7 +25,9 @@ public static MainPageDTO from(List planList, List doList, List s List doViewDTOS = doList.stream() .map(DoViewDTO::of) .toList(); - List seeViewDTO1 = sesL; + List seeViewDTO1 = seeList.stream() + .map(SeeViewDTO::of) + .toList(); return new MainPageDTO(planViewDTOS, doViewDTOS, seeViewDTO1); From 66fcac84df952e1b9f80f2f83036d9b6c0c2f638 Mon Sep 17 00:00:00 2001 From: Zena0128 <0128ja@gmail.com> Date: Sat, 17 Feb 2024 13:39:51 +0900 Subject: [PATCH 3/3] =?UTF-8?q?:sparkles:Feat:=20ErrorStatus=20enum=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../timetris/global/exception/enums/ErrorStatus.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/trendithon/timetris/global/exception/enums/ErrorStatus.java b/src/main/java/com/trendithon/timetris/global/exception/enums/ErrorStatus.java index 6162450..10f3c48 100644 --- a/src/main/java/com/trendithon/timetris/global/exception/enums/ErrorStatus.java +++ b/src/main/java/com/trendithon/timetris/global/exception/enums/ErrorStatus.java @@ -14,7 +14,13 @@ public enum ErrorStatus { INVALID_TYPE_ERROR(HttpStatus.BAD_REQUEST, "COMMON400", "올바르지 않은 타입입니다."), ILLEGAL_ARGUMENT_ERROR(HttpStatus.BAD_REQUEST, "COMMON400", "필수 파라미터가 없습니다"), INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "COMMON500", "서버 오류가 발생했습니다. 잠시 후 다시 시도해주세요."), - INVALID_HTTP_METHOD(HttpStatus.METHOD_NOT_ALLOWED, "COMMON400", "잘못된 Http Method 요청입니다."); + INVALID_HTTP_METHOD(HttpStatus.METHOD_NOT_ALLOWED, "COMMON400", "잘못된 Http Method 요청입니다."), + NO_PERMISSION_ERROR(HttpStatus.BAD_REQUEST, "COMMOM400", "해당 유저에게 수정/삭제 권한이 없습니다."), + USER_NOT_FOUND_ERROR(HttpStatus.NOT_FOUND, "COMMOM400", "해당 유저를 찾을 수 없습니다."), + CATEGORY_NOT_FOUND_ERROR(HttpStatus.NOT_FOUND, "COMMOM400", "해당 카테고리를 찾을 수 없습니다."), + PLAN_NOT_FOUND_ERROR(HttpStatus.NOT_FOUND, "COMMOM400", "해당 plan을 찾을 수 없습니다."), + DO_NOT_FOUND_ERROR(HttpStatus.NOT_FOUND, "COMMOM400", "해당 do를 찾을 수 없습니다."), + SEE_NOT_FOUND_ERROR(HttpStatus.NOT_FOUND, "COMMOM400", "해당 see를 찾을 수 없습니다."),; private final HttpStatus httpStatus;