From aaeb4a648e067a87b92e5ec6a387e0cb2c83c8ef Mon Sep 17 00:00:00 2001 From: capDoYeonLee Date: Sun, 13 Oct 2024 20:55:30 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=95=84=ED=84=B0=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=20=EC=8B=9C=20member=20=ED=95=84=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/filter/application/service/FilterService.java | 5 +++-- .../filter/application/usecase/CreateFilterUsecase.java | 2 +- .../example/demo/filter/presentation/FilterController.java | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) 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 f3e17849..7d5d5894 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 @@ -37,9 +37,9 @@ public class FilterService implements private final FilterResponseConverter responseConverter; - @Override + @Transactional - public CreateFilterResponse createFilter(final CreateFilterRequest request) { + public CreateFilterResponse createFilter(final CreateFilterRequest request, final Long memberId) { FilterModel model = requestConverter.from(request); FilterEntity entity = entityConverter.toEntity(model); FilterEntity save = filterRepository.save(entity); @@ -48,6 +48,7 @@ public CreateFilterResponse createFilter(final CreateFilterRequest request) { @Override public List getFilter() { + // 필터를 조회할 때, 모든 데이터에서 param memberId와 같은 데이터만 조회하자 List model = filterEntitiesByAll(); return responseConverter.toAllModel(model); } 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 index 5161f3bd..0c4d566e 100644 --- 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 @@ -4,5 +4,5 @@ import com.example.demo.filter.application.dto.CreateFilterResponse; public interface CreateFilterUsecase { - CreateFilterResponse createFilter(CreateFilterRequest request); + CreateFilterResponse createFilter(CreateFilterRequest request, Long memberId); } 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 f2b6dece..8dbe3e44 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 @@ -1,5 +1,6 @@ package com.example.demo.filter.presentation; +import com.example.demo.auth.application.support.Member; import com.example.demo.common.presentation.response.ApiResponse; import com.example.demo.common.presentation.response.ApiResponseBody; import com.example.demo.common.presentation.response.ApiResponseGenerator; @@ -30,8 +31,9 @@ public class FilterController { @PostMapping public ApiResponse> createFilter( - @RequestBody CreateFilterRequest request) { - CreateFilterResponse response = createFilterUsecase.createFilter(request); + @RequestBody CreateFilterRequest request, + Long memberId) { + CreateFilterResponse response = createFilterUsecase.createFilter(request, memberId); return ApiResponseGenerator.success(response, HttpStatus.OK, MessageCode.CREATE); }