From 4884095be9b6c2c0f23c17b51092ce4a0b3a079b Mon Sep 17 00:00:00 2001 From: capDoYeonLee Date: Tue, 23 Jul 2024 14:59:44 +0900 Subject: [PATCH 01/11] =?UTF-8?q?feat:=20filter=20=EC=83=9D=EC=84=B1=20con?= =?UTF-8?q?troller=20=EA=B8=B0=EB=8A=A5=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filter/presentation/FilterController.java | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 BE/error/src/main/java/com/example/demo/filter/presentation/FilterController.java diff --git a/BE/error/src/main/java/com/example/demo/filter/presentation/FilterController.java b/BE/error/src/main/java/com/example/demo/filter/presentation/FilterController.java new file mode 100644 index 00000000..f9ee1437 --- /dev/null +++ b/BE/error/src/main/java/com/example/demo/filter/presentation/FilterController.java @@ -0,0 +1,58 @@ +package com.example.demo.filter.presentation; + +import com.example.demo.common.presentation.response.ApiResponse; +import com.example.demo.common.presentation.response.ApiResponseBody; +import com.example.demo.common.presentation.response.ApiResponseGenerator; +import com.example.demo.common.presentation.response.MessageCode; +import com.example.demo.filter.application.dto.CreateFilterRequest; +import com.example.demo.filter.application.dto.CreateFilterResponse; +import com.example.demo.schedule.application.dto.CreateScheduleResponse; +import com.example.demo.schedule.application.usecase.CreateFilterUsecase; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/filter") +public class FilterController { + + private final CreateFilterUsecase createFilterUsecase; + + @PostMapping + public ApiResponse> createFilter( + @RequestBody CreateFilterRequest request) { + CreateFilterResponse response = createFilterUsecase.createFilter(request); + return ApiResponseGenerator.success(response, HttpStatus.OK, MessageCode.CREATE); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + +} From 6008f81aa38c7f1694d5097dd1cc61866b9882c5 Mon Sep 17 00:00:00 2001 From: capDoYeonLee Date: Tue, 23 Jul 2024 15:00:17 +0900 Subject: [PATCH 02/11] =?UTF-8?q?feat:=20=ED=95=84=ED=84=B0=20entity=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/filter/persistence/FilterEntity.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 BE/error/src/main/java/com/example/demo/filter/persistence/FilterEntity.java diff --git a/BE/error/src/main/java/com/example/demo/filter/persistence/FilterEntity.java b/BE/error/src/main/java/com/example/demo/filter/persistence/FilterEntity.java new file mode 100644 index 00000000..bc432e09 --- /dev/null +++ b/BE/error/src/main/java/com/example/demo/filter/persistence/FilterEntity.java @@ -0,0 +1,30 @@ +package com.example.demo.filter.persistence; + +import com.example.demo.common.persistence.BaseEntity; +import jakarta.persistence.*; +import lombok.*; +import lombok.experimental.SuperBuilder; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + + +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@ToString +@Entity +@SuperBuilder(toBuilder = true) +@Table(name = "filter") +@EntityListeners(AuditingEntityListener.class) +public class FilterEntity extends BaseEntity { + + @Id + @GeneratedValue + @Column(nullable = false) + private Long filterId; + + @Column(nullable = false) + private String filterName; + + @Column(nullable = false) + private String filterColor; +} From 3d9ba189c5d2a37a2692cf0eb245ae2aaced8d3c Mon Sep 17 00:00:00 2001 From: capDoYeonLee Date: Tue, 23 Jul 2024 15:00:34 +0900 Subject: [PATCH 03/11] =?UTF-8?q?feat:=20filter=20repository=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/filter/persistence/FilterRepository.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 BE/error/src/main/java/com/example/demo/filter/persistence/FilterRepository.java diff --git a/BE/error/src/main/java/com/example/demo/filter/persistence/FilterRepository.java b/BE/error/src/main/java/com/example/demo/filter/persistence/FilterRepository.java new file mode 100644 index 00000000..17529180 --- /dev/null +++ b/BE/error/src/main/java/com/example/demo/filter/persistence/FilterRepository.java @@ -0,0 +1,9 @@ +package com.example.demo.filter.persistence; + +import com.example.demo.schedule.persistence.ScheduleEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface FilterRepository extends JpaRepository { +} From b748001ce4c8db7467da38411e7ef4f144417077 Mon Sep 17 00:00:00 2001 From: capDoYeonLee Date: Tue, 23 Jul 2024 15:01:20 +0900 Subject: [PATCH 04/11] =?UTF-8?q?feat:=20filter=20=EC=83=9D=EC=84=B1=20dto?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/dto/CreateFilterRequest.java | 18 ++++++++++++++++++ .../application/dto/CreateFilterResponse.java | 17 +++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 BE/error/src/main/java/com/example/demo/filter/application/dto/CreateFilterRequest.java create mode 100644 BE/error/src/main/java/com/example/demo/filter/application/dto/CreateFilterResponse.java diff --git a/BE/error/src/main/java/com/example/demo/filter/application/dto/CreateFilterRequest.java b/BE/error/src/main/java/com/example/demo/filter/application/dto/CreateFilterRequest.java new file mode 100644 index 00000000..a1bdc887 --- /dev/null +++ b/BE/error/src/main/java/com/example/demo/filter/application/dto/CreateFilterRequest.java @@ -0,0 +1,18 @@ +package com.example.demo.filter.application.dto; + + +import com.example.demo.common.support.dto.AbstractDto; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Builder(toBuilder = true) +public class CreateFilterRequest implements AbstractDto { + private Long filterId; + private String filterName; + private String filterColor; +} diff --git a/BE/error/src/main/java/com/example/demo/filter/application/dto/CreateFilterResponse.java b/BE/error/src/main/java/com/example/demo/filter/application/dto/CreateFilterResponse.java new file mode 100644 index 00000000..b5fb7e63 --- /dev/null +++ b/BE/error/src/main/java/com/example/demo/filter/application/dto/CreateFilterResponse.java @@ -0,0 +1,17 @@ +package com.example.demo.filter.application.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + + +@Getter +@AllArgsConstructor +@NoArgsConstructor +@Builder(toBuilder = true) +public class CreateFilterResponse { + private Long filterId; +} + + From 4e8c93c18964d5acd71a21ae6f02f6ab8e8f5f09 Mon Sep 17 00:00:00 2001 From: capDoYeonLee Date: Tue, 23 Jul 2024 15:02:04 +0900 Subject: [PATCH 05/11] =?UTF-8?q?feat:=20filter=20=EC=83=9D=EC=84=B1=20con?= =?UTF-8?q?verter=20=EA=B8=B0=EB=8A=A5=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../converter/FilterEntityConverter.java | 28 +++++++++++++++++++ .../converter/FilterRequestConverter.java | 28 +++++++++++++++++++ .../converter/FilterResponseConverter.java | 13 +++++++++ 3 files changed, 69 insertions(+) create mode 100644 BE/error/src/main/java/com/example/demo/filter/application/model/converter/FilterEntityConverter.java create mode 100644 BE/error/src/main/java/com/example/demo/filter/application/model/converter/FilterRequestConverter.java create mode 100644 BE/error/src/main/java/com/example/demo/filter/application/model/converter/FilterResponseConverter.java diff --git a/BE/error/src/main/java/com/example/demo/filter/application/model/converter/FilterEntityConverter.java b/BE/error/src/main/java/com/example/demo/filter/application/model/converter/FilterEntityConverter.java new file mode 100644 index 00000000..4f704dac --- /dev/null +++ b/BE/error/src/main/java/com/example/demo/filter/application/model/converter/FilterEntityConverter.java @@ -0,0 +1,28 @@ +package com.example.demo.filter.application.model.converter; + +import com.example.demo.common.support.converter.AbstractEntityConverter; +import com.example.demo.filter.application.model.FilterModel; +import com.example.demo.filter.persistence.FilterEntity; +import org.springframework.stereotype.Component; + +@Component +public class FilterEntityConverter implements AbstractEntityConverter { + + @Override + public FilterModel from(FilterEntity source) { + return FilterModel.builder() + .filterId(source.getFilterId()) + .filterName(source.getFilterName()) + .filterColor(source.getFilterColor()) + .build(); + } + + @Override + public FilterEntity toEntity(FilterModel source) { + return FilterEntity.builder() + .filterId(source.getFilterId()) + .filterName(source.getFilterName()) + .filterColor(source.getFilterColor()) + .build(); + } +} diff --git a/BE/error/src/main/java/com/example/demo/filter/application/model/converter/FilterRequestConverter.java b/BE/error/src/main/java/com/example/demo/filter/application/model/converter/FilterRequestConverter.java new file mode 100644 index 00000000..eb9051cb --- /dev/null +++ b/BE/error/src/main/java/com/example/demo/filter/application/model/converter/FilterRequestConverter.java @@ -0,0 +1,28 @@ +package com.example.demo.filter.application.model.converter; + +import com.example.demo.common.support.converter.AbstractDtoConverter; +import com.example.demo.filter.application.dto.CreateFilterRequest; +import com.example.demo.filter.application.dto.CreateFilterResponse; +import com.example.demo.filter.application.model.FilterModel; +import com.example.demo.schedule.application.model.ScheduleModel; +import org.springframework.stereotype.Component; + +@Component +public class FilterRequestConverter implements AbstractDtoConverter { + + + @Override + public FilterModel from(CreateFilterRequest source) { + return FilterModel.builder() + .filterId(source.getFilterId()) + .filterName(source.getFilterName()) + .filterColor(source.getFilterColor()) + .build(); + } + + + + + + +} diff --git a/BE/error/src/main/java/com/example/demo/filter/application/model/converter/FilterResponseConverter.java b/BE/error/src/main/java/com/example/demo/filter/application/model/converter/FilterResponseConverter.java new file mode 100644 index 00000000..4db57377 --- /dev/null +++ b/BE/error/src/main/java/com/example/demo/filter/application/model/converter/FilterResponseConverter.java @@ -0,0 +1,13 @@ +package com.example.demo.filter.application.model.converter; + +import com.example.demo.filter.application.dto.CreateFilterResponse; +import org.springframework.stereotype.Component; + +@Component +public class FilterResponseConverter { + + public CreateFilterResponse from(Long filterId) { + return CreateFilterResponse.builder().filterId(filterId).build(); + } + +} From 87e97ae04d2a19d2a2b69eae8888dbcc718fcc33 Mon Sep 17 00:00:00 2001 From: capDoYeonLee Date: Tue, 23 Jul 2024 15:02:27 +0900 Subject: [PATCH 06/11] =?UTF-8?q?feat:=20filter=20model=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filter/application/model/FilterModel.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 BE/error/src/main/java/com/example/demo/filter/application/model/FilterModel.java diff --git a/BE/error/src/main/java/com/example/demo/filter/application/model/FilterModel.java b/BE/error/src/main/java/com/example/demo/filter/application/model/FilterModel.java new file mode 100644 index 00000000..249a211f --- /dev/null +++ b/BE/error/src/main/java/com/example/demo/filter/application/model/FilterModel.java @@ -0,0 +1,15 @@ +package com.example.demo.filter.application.model; + +import com.example.demo.common.support.AbstractModel; +import lombok.*; + +@Getter +@ToString +@AllArgsConstructor +@NoArgsConstructor +@Builder(toBuilder = true) +public class FilterModel implements AbstractModel { + private Long filterId; + private String filterName; + private String filterColor; +} From dac99e46d5d057f28a35d3609ca52e74e133306d Mon Sep 17 00:00:00 2001 From: capDoYeonLee Date: Tue, 23 Jul 2024 15:02:55 +0900 Subject: [PATCH 07/11] =?UTF-8?q?feat:=20filter=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EC=84=9C=EB=B9=84=EC=8A=A4=20=EA=B8=B0=EB=8A=A5=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/service/FilterService.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 BE/error/src/main/java/com/example/demo/filter/application/service/FilterService.java diff --git a/BE/error/src/main/java/com/example/demo/filter/application/service/FilterService.java b/BE/error/src/main/java/com/example/demo/filter/application/service/FilterService.java new file mode 100644 index 00000000..9bb08bd3 --- /dev/null +++ b/BE/error/src/main/java/com/example/demo/filter/application/service/FilterService.java @@ -0,0 +1,34 @@ +package com.example.demo.filter.application.service; + +import com.example.demo.filter.application.dto.CreateFilterRequest; +import com.example.demo.filter.application.dto.CreateFilterResponse; +import com.example.demo.filter.application.model.FilterModel; +import com.example.demo.filter.application.model.converter.FilterEntityConverter; +import com.example.demo.filter.application.model.converter.FilterRequestConverter; +import com.example.demo.filter.application.model.converter.FilterResponseConverter; +import com.example.demo.filter.persistence.FilterEntity; +import com.example.demo.filter.persistence.FilterRepository; +import com.example.demo.schedule.application.usecase.CreateFilterUsecase; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class FilterService implements CreateFilterUsecase { + + private final FilterRepository filterRepository; + private final FilterRequestConverter requestConverter; + private final FilterEntityConverter entityConverter; + private final FilterResponseConverter responseConverter; + + + @Override + public CreateFilterResponse createFilter(CreateFilterRequest request) { + FilterModel model = requestConverter.from(request); + FilterEntity entity = entityConverter.toEntity(model); + FilterEntity save = filterRepository.save(entity); + return responseConverter.from(save.getFilterId()); + } +} From edbc4fb2f3cb737fe787e598a4f1e2dfc7c04742 Mon Sep 17 00:00:00 2001 From: capDoYeonLee Date: Tue, 23 Jul 2024 15:04:12 +0900 Subject: [PATCH 08/11] =?UTF-8?q?feat:=20create=20filter=20usecase=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 --- .../filter/application/usecase/CreateFilterUsecase.java | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 BE/error/src/main/java/com/example/demo/filter/application/usecase/CreateFilterUsecase.java diff --git a/BE/error/src/main/java/com/example/demo/filter/application/usecase/CreateFilterUsecase.java b/BE/error/src/main/java/com/example/demo/filter/application/usecase/CreateFilterUsecase.java new file mode 100644 index 00000000..5161f3bd --- /dev/null +++ b/BE/error/src/main/java/com/example/demo/filter/application/usecase/CreateFilterUsecase.java @@ -0,0 +1,8 @@ +package com.example.demo.filter.application.usecase; + +import com.example.demo.filter.application.dto.CreateFilterRequest; +import com.example.demo.filter.application.dto.CreateFilterResponse; + +public interface CreateFilterUsecase { + CreateFilterResponse createFilter(CreateFilterRequest request); +} From 4362cd1555490cc0ec6796d172eaac567f441ab5 Mon Sep 17 00:00:00 2001 From: capDoYeonLee Date: Tue, 23 Jul 2024 15:08:27 +0900 Subject: [PATCH 09/11] =?UTF-8?q?fix:=20CreateFilterUsecase=20path=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/demo/filter/application/service/FilterService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE/error/src/main/java/com/example/demo/filter/application/service/FilterService.java b/BE/error/src/main/java/com/example/demo/filter/application/service/FilterService.java index 9bb08bd3..5cee9196 100644 --- a/BE/error/src/main/java/com/example/demo/filter/application/service/FilterService.java +++ b/BE/error/src/main/java/com/example/demo/filter/application/service/FilterService.java @@ -8,7 +8,7 @@ import com.example.demo.filter.application.model.converter.FilterResponseConverter; import com.example.demo.filter.persistence.FilterEntity; import com.example.demo.filter.persistence.FilterRepository; -import com.example.demo.schedule.application.usecase.CreateFilterUsecase; +import com.example.demo.filter.application.usecase.CreateFilterUsecase; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; From 2c6f0f82a776a0e53a7204d064808ac8edaaa266 Mon Sep 17 00:00:00 2001 From: capDoYeonLee Date: Tue, 23 Jul 2024 15:12:46 +0900 Subject: [PATCH 10/11] =?UTF-8?q?fix:=20CreateFilterUsecase=20path=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/demo/filter/presentation/FilterController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BE/error/src/main/java/com/example/demo/filter/presentation/FilterController.java b/BE/error/src/main/java/com/example/demo/filter/presentation/FilterController.java index f9ee1437..1d71a6db 100644 --- a/BE/error/src/main/java/com/example/demo/filter/presentation/FilterController.java +++ b/BE/error/src/main/java/com/example/demo/filter/presentation/FilterController.java @@ -6,8 +6,7 @@ import com.example.demo.common.presentation.response.MessageCode; import com.example.demo.filter.application.dto.CreateFilterRequest; import com.example.demo.filter.application.dto.CreateFilterResponse; -import com.example.demo.schedule.application.dto.CreateScheduleResponse; -import com.example.demo.schedule.application.usecase.CreateFilterUsecase; +import com.example.demo.filter.application.usecase.CreateFilterUsecase; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.PostMapping; From 0b5f9ca197d570efd0dea0a6ab7fd9310b7f9c13 Mon Sep 17 00:00:00 2001 From: capDoYeonLee Date: Tue, 23 Jul 2024 15:28:19 +0900 Subject: [PATCH 11/11] =?UTF-8?q?fix:=20=EC=9E=84=EC=8B=9C=20=ED=95=84?= =?UTF-8?q?=ED=84=B0=20=EC=83=9D=EC=84=B1=20=ED=86=A0=ED=81=B0=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/demo/auth/application/config/LoginConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BE/error/src/main/java/com/example/demo/auth/application/config/LoginConfig.java b/BE/error/src/main/java/com/example/demo/auth/application/config/LoginConfig.java index 0e0ce860..8be16e27 100644 --- a/BE/error/src/main/java/com/example/demo/auth/application/config/LoginConfig.java +++ b/BE/error/src/main/java/com/example/demo/auth/application/config/LoginConfig.java @@ -26,7 +26,7 @@ public void addInterceptors(InterceptorRegistry registry) { registry .addInterceptor(memberAuthInterceptor()) .addPathPatterns("/api/**") - .excludePathPatterns("/api/auth/**", "/api/calendar/public/**"); + .excludePathPatterns("/api/auth/**", "/api/calendar/public/**", "/api/filter"); registry .addInterceptor(reissueAuthInterceptor()) .addPathPatterns("/auth/reissue")