From 44442b678d51dcdc1a28ffffb3047caa341dc2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 16:31:53 +0900 Subject: [PATCH 01/17] =?UTF-8?q?refactor:=20=ED=86=A0=ED=81=B0=20?= =?UTF-8?q?=EC=9E=AC=EB=B0=9C=EA=B8=89=20=EC=95=A1=EC=84=B8=EC=8A=A4=20?= =?UTF-8?q?=ED=86=A0=ED=81=B0=20=EC=B6=94=EC=B6=9C=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20#124?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ReissueTokenController.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/java/poomasi/domain/auth/token/reissue/controller/ReissueTokenController.java b/src/main/java/poomasi/domain/auth/token/reissue/controller/ReissueTokenController.java index 43aeb0c8..f0ecadff 100644 --- a/src/main/java/poomasi/domain/auth/token/reissue/controller/ReissueTokenController.java +++ b/src/main/java/poomasi/domain/auth/token/reissue/controller/ReissueTokenController.java @@ -1,30 +1,33 @@ package poomasi.domain.auth.token.reissue.controller; - -import org.springframework.beans.factory.annotation.Autowired; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; -import org.springframework.security.access.annotation.Secured; -import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RestController; -import poomasi.domain.auth.security.userdetail.UserDetailsImpl; import poomasi.domain.auth.token.reissue.dto.ReissueRequest; import poomasi.domain.auth.token.reissue.dto.ReissueResponse; import poomasi.domain.auth.token.reissue.service.ReissueTokenService; -import poomasi.domain.member.entity.Member; +import poomasi.domain.auth.token.util.JwtUtil; @RestController +@RequiredArgsConstructor public class ReissueTokenController { - @Autowired - private ReissueTokenService reissueTokenService; + private final ReissueTokenService reissueTokenService; + private final JwtUtil jwtUtil; - @Secured({"ROLE_FARMER", "ROLE_CUSTOMER"}) @PostMapping("/api/reissue") - public ResponseEntity reissue(@AuthenticationPrincipal UserDetailsImpl userDetails, @RequestBody ReissueRequest reissueRequest){ - Member member = userDetails.getMember(); - return ResponseEntity.ok(reissueTokenService.reissueToken(member.getId(), reissueRequest)); + public ResponseEntity reissue(@RequestHeader(HttpHeaders.AUTHORIZATION) String authorizationHeader, + @RequestBody ReissueRequest reissueRequest){ + + String token = authorizationHeader.replace("Bearer ", ""); + + Long memberId = jwtUtil.getIdFromToken(token); + + return ResponseEntity.ok(reissueTokenService.reissueToken(memberId, reissueRequest)); } } From 0c6761947a999c01fc43ec4aab586b3904ec841c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 16:33:56 +0900 Subject: [PATCH 02/17] =?UTF-8?q?refactor:=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EB=B3=B8=EC=9D=B8=20=EC=A1=B0=ED=9A=8C=20=EA=B6=8C=ED=95=9C?= =?UTF-8?q?=EC=97=90=20=EA=B4=80=EB=A6=AC=EC=9E=90=EB=8F=84=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20#124?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/poomasi/domain/member/controller/MemberController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/poomasi/domain/member/controller/MemberController.java b/src/main/java/poomasi/domain/member/controller/MemberController.java index 8f057dba..f0b3e7b1 100644 --- a/src/main/java/poomasi/domain/member/controller/MemberController.java +++ b/src/main/java/poomasi/domain/member/controller/MemberController.java @@ -60,7 +60,7 @@ public ResponseEntity> getMembers(@PageableDefault(size = 1 } @GetMapping("/self") - @Secured({"ROLE_MEMBER", "ROLE_FARMER"}) + @Secured({"ROLE_MEMBER", "ROLE_FARMER", "ROLE_ADMIN"}) public ResponseEntity getSelfMember(@AuthenticationPrincipal UserDetailsImpl userDetails) { Member member = userDetails.getMember(); MemberResponse memberResponse = memberService.getMemberById(member.getId()); From abddbd94a7ad2b85ac2f1abba04f9834132a9fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 16:50:48 +0900 Subject: [PATCH 03/17] =?UTF-8?q?refactor:=20=EB=A9=A4=EB=B2=84=20?= =?UTF-8?q?=EA=B6=8C=ED=95=9C=20=EB=86=8D=EB=B6=80=EB=A1=9C=20=EC=A0=84?= =?UTF-8?q?=ED=99=98=20=EB=A1=9C=EC=A7=81=20=EA=B6=8C=ED=95=9C=EC=9D=84=20?= =?UTF-8?q?CUSTOMER=EB=A1=9C=20=EC=88=98=EC=A0=95=20#124?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/image/controller/ImageController.java | 10 +++++----- .../domain/member/controller/MemberController.java | 13 +++++++------ .../domain/member/service/MemberService.java | 4 +--- .../global/config/s3/S3PresignedUrlController.java | 4 ++-- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/main/java/poomasi/domain/image/controller/ImageController.java b/src/main/java/poomasi/domain/image/controller/ImageController.java index d9211481..26000941 100644 --- a/src/main/java/poomasi/domain/image/controller/ImageController.java +++ b/src/main/java/poomasi/domain/image/controller/ImageController.java @@ -22,7 +22,7 @@ public class ImageController { // 이미지 정보 저장 @PostMapping - @Secured({"ROLE_MEMBER", "ROLE_FARMER", "ROLE_ADMIN"}) + @Secured({"ROLE_CUSTOMER", "ROLE_FARMER", "ROLE_ADMIN"}) public ResponseEntity saveImageInfo(@AuthenticationPrincipal UserDetailsImpl userDetails, @RequestBody ImageRequest imageRequest) { Member member = userDetails.getMember(); Image savedImage = imageService.saveImage(member.getId(), imageRequest); @@ -31,7 +31,7 @@ public ResponseEntity saveImageInfo(@AuthenticationPrincipal UserDetailsImpl // 여러 이미지 정보 저장 @PostMapping("/multiple") - @Secured({"ROLE_MEMBER", "ROLE_FARMER", "ROLE_ADMIN"}) + @Secured({"ROLE_CUSTOMER", "ROLE_FARMER", "ROLE_ADMIN"}) public ResponseEntity> saveMultipleImages(@AuthenticationPrincipal UserDetailsImpl userDetails, @RequestBody List imageRequests) { Member member = userDetails.getMember(); List savedImages = imageService.saveMultipleImages(member.getId(), imageRequests); @@ -40,7 +40,7 @@ public ResponseEntity> saveMultipleImages(@AuthenticationPrincipal U // 특정 이미지 삭제 @DeleteMapping("/delete/{id}") - @Secured({"ROLE_MEMBER", "ROLE_FARMER", "ROLE_ADMIN"}) + @Secured({"ROLE_CUSTOMER", "ROLE_FARMER", "ROLE_ADMIN"}) public ResponseEntity deleteImage(@AuthenticationPrincipal UserDetailsImpl userDetails, @PathVariable Long id) { Member member = userDetails.getMember(); imageService.deleteImage(member.getId(), id); @@ -62,7 +62,7 @@ public ResponseEntity> getImagesByTypeAndReference(@PathVariable Ima // 이미지 정보 수정 @PutMapping("update/{id}") - @Secured({"ROLE_MEMBER", "ROLE_FARMER", "ROLE_ADMIN"}) + @Secured({"ROLE_CUSTOMER", "ROLE_FARMER", "ROLE_ADMIN"}) public ResponseEntity updateImageInfo(@AuthenticationPrincipal UserDetailsImpl userDetails, @PathVariable Long id, @RequestBody ImageRequest imageRequest) { @@ -72,7 +72,7 @@ public ResponseEntity updateImageInfo(@AuthenticationPrincipal UserDetailsImp } @PutMapping("/recover/{id}") - @Secured({"ROLE_MEMBER", "ROLE_FARMER", "ROLE_ADMIN"}) + @Secured({"ROLE_CUSTOMER", "ROLE_FARMER", "ROLE_ADMIN"}) public ResponseEntity recoverImage(@AuthenticationPrincipal UserDetailsImpl userDetails, @PathVariable Long id) { Member member = userDetails.getMember(); imageService.recoverImage(member.getId(), id); diff --git a/src/main/java/poomasi/domain/member/controller/MemberController.java b/src/main/java/poomasi/domain/member/controller/MemberController.java index f0b3e7b1..32d8bdf7 100644 --- a/src/main/java/poomasi/domain/member/controller/MemberController.java +++ b/src/main/java/poomasi/domain/member/controller/MemberController.java @@ -30,11 +30,12 @@ public ResponseEntity signUp(@RequestBody SignupRequest signupRe .signUp(signupRequest)); } - @PutMapping("/toFarmer/{memberId}") - @Secured("ROLE_ADMIN") - public ResponseEntity convertToFarmer(@PathVariable Long memberId, + @PutMapping("/toFarmer") + @Secured("ROLE_CUSTOMER") + public ResponseEntity convertToFarmer(@AuthenticationPrincipal UserDetailsImpl userDetails, @RequestBody FarmerQualificationRequest request) { - memberService.convertToFarmer(memberId, request.hasFarmerQualification()); + Member member = userDetails.getMember(); + memberService.convertToFarmer(member, request.hasFarmerQualification()); return ResponseEntity.noContent().build(); } @@ -60,7 +61,7 @@ public ResponseEntity> getMembers(@PageableDefault(size = 1 } @GetMapping("/self") - @Secured({"ROLE_MEMBER", "ROLE_FARMER", "ROLE_ADMIN"}) + @Secured({"ROLE_CUSTOMER", "ROLE_FARMER", "ROLE_ADMIN"}) public ResponseEntity getSelfMember(@AuthenticationPrincipal UserDetailsImpl userDetails) { Member member = userDetails.getMember(); MemberResponse memberResponse = memberService.getMemberById(member.getId()); @@ -68,7 +69,7 @@ public ResponseEntity getSelfMember(@AuthenticationPrincipal Use } @GetMapping("/summary/{memberId}") - @Secured({"ROLE_MEMBER", "ROLE_FARMER", "ROLE_ADMIN"}) + @Secured({"ROLE_CUSTOMER", "ROLE_FARMER", "ROLE_ADMIN"}) public ResponseEntity getMemberSummaryById(@PathVariable Long memberId) { MemberSummaryResponse memberSummaryResponse = memberService.getMemberSummary(memberId); return ResponseEntity.ok(memberSummaryResponse); diff --git a/src/main/java/poomasi/domain/member/service/MemberService.java b/src/main/java/poomasi/domain/member/service/MemberService.java index 9a9d51b2..6ea5669a 100644 --- a/src/main/java/poomasi/domain/member/service/MemberService.java +++ b/src/main/java/poomasi/domain/member/service/MemberService.java @@ -62,9 +62,7 @@ public Page getAllMembers(Pageable pageable) { } @Transactional - public void convertToFarmer(Long memberId, Boolean hasFarmerQualification) { - Member member = findMemberById(memberId); - + public void convertToFarmer(Member member, Boolean hasFarmerQualification) { if (member.isFarmer()) { throw new BusinessException(MEMBER_ALREADY_FARMER); } diff --git a/src/main/java/poomasi/global/config/s3/S3PresignedUrlController.java b/src/main/java/poomasi/global/config/s3/S3PresignedUrlController.java index 12c3ebe5..44f5e52b 100644 --- a/src/main/java/poomasi/global/config/s3/S3PresignedUrlController.java +++ b/src/main/java/poomasi/global/config/s3/S3PresignedUrlController.java @@ -15,14 +15,14 @@ public class S3PresignedUrlController { private final AwsProperties awsProperties; @GetMapping("/presigned-url-get") - @Secured({"ROLE_MEMBER", "ROLE_FARMER", "ROLE_ADMIN"}) + @Secured({"ROLE_CUSTOMER", "ROLE_FARMER", "ROLE_ADMIN"}) public ResponseEntity presignedUrlGet(@RequestParam String keyname) { String presignedGetUrl = s3PresignedUrlService.createPresignedGetUrl(awsProperties.getS3().getBucket(), keyname); return ResponseEntity.ok(presignedGetUrl); } @PostMapping("/presigned-url-put") - @Secured({"ROLE_MEMBER", "ROLE_FARMER", "ROLE_ADMIN"}) + @Secured({"ROLE_CUSTOMER", "ROLE_FARMER", "ROLE_ADMIN"}) public ResponseEntity presignedUrlPut(@RequestBody PresignedUrlPutRequest request) { String presignedPutUrl = s3PresignedUrlService.createPresignedPutUrl(awsProperties.getS3().getBucket(), request.keyPrefix(), request.metadata()); return ResponseEntity.ok(presignedPutUrl); From f5d3a9e9b828b38631f6f0fa2022dc3b2b28a588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 17:16:41 +0900 Subject: [PATCH 04/17] =?UTF-8?q?refactor:=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=20=EC=A0=9C=ED=95=9C=20=EA=B0=AF=EC=88=98=20=EC=83=81=EC=88=98?= =?UTF-8?q?=20=EC=B2=98=EB=A6=AC=20#124?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../poomasi/domain/image/service/ImageService.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/poomasi/domain/image/service/ImageService.java b/src/main/java/poomasi/domain/image/service/ImageService.java index eede9992..bb099c7a 100644 --- a/src/main/java/poomasi/domain/image/service/ImageService.java +++ b/src/main/java/poomasi/domain/image/service/ImageService.java @@ -26,6 +26,10 @@ @RequiredArgsConstructor @Transactional(readOnly = true) public class ImageService { + + private static final int DEFAULT_IMAGE_LIMIT = 5; + private static final int MEMBER_PROFILE_IMAGE_LIMIT = 1; + private final ImageRepository imageRepository; private final ImageOwnerValidatorFactory validatorFactory; private final MemberRepository memberRepository; @@ -83,8 +87,10 @@ private Image recoverImageOrThrow(Image existingImage, ImageRequest imageRequest } private void validateImageLimit(ImageRequest imageRequest) { - int imageLimit = 5; - if (imageRequest.type() == ImageType.MEMBER_PROFILE) imageLimit = 1; // 멤버 프로필 이미지는 한 장으로 제한 + int imageLimit = DEFAULT_IMAGE_LIMIT; + if (imageRequest.type() == ImageType.MEMBER_PROFILE) { + imageLimit = MEMBER_PROFILE_IMAGE_LIMIT; // 멤버 프로필 이미지는 한 장으로 제한 + } if (imageRepository.countByTypeAndReferenceIdAndDeletedAtIsNull(imageRequest.type(), imageRequest.referenceId()) >= imageLimit) { throw new BusinessException(IMAGE_LIMIT_EXCEED); From f6642973f88beaf92c32bdea6a943e0b3c4abbce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 17:38:35 +0900 Subject: [PATCH 05/17] =?UTF-8?q?refactor:=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=20=EC=84=9C=EB=B9=84=EC=8A=A4=EC=97=90=EC=84=9C=20=EB=A9=A4?= =?UTF-8?q?=EB=B2=84=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=EB=A5=BC=20=EC=9D=98=EC=A1=B4=20#124?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/image/service/ImageService.java | 8 ++--- .../dto/request/MemberProfileRequest.java | 11 +++++++ .../member/_profile/entity/MemberProfile.java | 3 ++ .../service/MemberProfileService.java | 30 +++++++++++++++++++ 4 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 src/main/java/poomasi/domain/member/_profile/dto/request/MemberProfileRequest.java create mode 100644 src/main/java/poomasi/domain/member/_profile/service/MemberProfileService.java diff --git a/src/main/java/poomasi/domain/image/service/ImageService.java b/src/main/java/poomasi/domain/image/service/ImageService.java index bb099c7a..bff0bf1d 100644 --- a/src/main/java/poomasi/domain/image/service/ImageService.java +++ b/src/main/java/poomasi/domain/image/service/ImageService.java @@ -10,7 +10,6 @@ import poomasi.domain.image.validation.ImageOwnerValidator; import poomasi.domain.image.validation.ImageOwnerValidatorFactory; import poomasi.domain.member._profile.entity.MemberProfile; -import poomasi.domain.member._profile.repository.MemberProfileRepository; import poomasi.domain.member.entity.Member; import poomasi.domain.member.repository.MemberRepository; import poomasi.global.error.BusinessException; @@ -33,7 +32,7 @@ public class ImageService { private final ImageRepository imageRepository; private final ImageOwnerValidatorFactory validatorFactory; private final MemberRepository memberRepository; - private final MemberProfileRepository memberProfileRepository; + private final MemberProfileService memberProfileService; @Transactional @@ -98,10 +97,9 @@ private void validateImageLimit(ImageRequest imageRequest) { } private void linkImageToMemberProfile(Long referenceId, Image savedImage) { - MemberProfile memberProfile = memberProfileRepository.findById(referenceId) - .orElseThrow(() -> new BusinessException(MEMBER_PROFILE_NOT_FOUND)); + MemberProfile memberProfile = memberProfileService.getMemberProfileById(referenceId); memberProfile.setProfileImage(savedImage); - memberProfileRepository.save(memberProfile); + memberProfileService.saveMemberProfile(memberProfile); } // 여러 이미지 저장 diff --git a/src/main/java/poomasi/domain/member/_profile/dto/request/MemberProfileRequest.java b/src/main/java/poomasi/domain/member/_profile/dto/request/MemberProfileRequest.java new file mode 100644 index 00000000..d1ff89c0 --- /dev/null +++ b/src/main/java/poomasi/domain/member/_profile/dto/request/MemberProfileRequest.java @@ -0,0 +1,11 @@ +package poomasi.domain.member._profile.dto.request; + +import poomasi.domain.member._profile.entity.MemberProfile; + +public record MemberProfileRequest(String name) { + public static MemberProfile toEntity(MemberProfileRequest memberProfileRequest){ + return new MemberProfile( + memberProfileRequest.name + ); + } +} diff --git a/src/main/java/poomasi/domain/member/_profile/entity/MemberProfile.java b/src/main/java/poomasi/domain/member/_profile/entity/MemberProfile.java index 10359311..9c1836ea 100644 --- a/src/main/java/poomasi/domain/member/_profile/entity/MemberProfile.java +++ b/src/main/java/poomasi/domain/member/_profile/entity/MemberProfile.java @@ -62,4 +62,7 @@ public MemberProfile() { this.name = "UNKNOWN"; // name not null 조건 때문에 임시로 넣었습니다. nullable도 true로 넣었는데 안 되네요 } + public MemberProfile(String name){ + this.name = name; + } } diff --git a/src/main/java/poomasi/domain/member/_profile/service/MemberProfileService.java b/src/main/java/poomasi/domain/member/_profile/service/MemberProfileService.java new file mode 100644 index 00000000..ad25beb3 --- /dev/null +++ b/src/main/java/poomasi/domain/member/_profile/service/MemberProfileService.java @@ -0,0 +1,30 @@ +package poomasi.domain.member._profile.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import poomasi.domain.member._profile.dto.request.MemberProfileRequest; +import poomasi.domain.member._profile.entity.MemberProfile; +import poomasi.domain.member._profile.repository.MemberProfileRepository; +import poomasi.global.error.BusinessException; + +import static poomasi.global.error.BusinessError.MEMBER_PROFILE_NOT_FOUND; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class MemberProfileService { + + private final MemberProfileRepository memberProfileRepository; + + public MemberProfile getMemberProfileById(Long id){ + return memberProfileRepository.findById(id) + .orElseThrow(() -> new BusinessException(MEMBER_PROFILE_NOT_FOUND)); + } + + @Transactional + public MemberProfile saveMemberProfile(MemberProfileRequest memberProfileRequest){ + MemberProfile memberProfile = MemberProfileRequest.toEntity(memberProfileRequest); + return memberProfileRepository.save(memberProfile); + } +} From bb5d8c24fee099520fbdfb58f13dafbe8e87f2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 17:43:25 +0900 Subject: [PATCH 06/17] =?UTF-8?q?fix:=20Bean=20=EB=AA=BB=20=EC=B0=BE?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0=20#124?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/image/repository/ImageRepository.java | 2 ++ .../poomasi/domain/image/service/ImageService.java | 1 + .../controller/MemberProfileController.java | 14 ++++++++++++++ .../repository/MemberProfileRepository.java | 2 ++ 4 files changed, 19 insertions(+) create mode 100644 src/main/java/poomasi/domain/member/_profile/controller/MemberProfileController.java diff --git a/src/main/java/poomasi/domain/image/repository/ImageRepository.java b/src/main/java/poomasi/domain/image/repository/ImageRepository.java index 2b82bad1..3c7162b5 100644 --- a/src/main/java/poomasi/domain/image/repository/ImageRepository.java +++ b/src/main/java/poomasi/domain/image/repository/ImageRepository.java @@ -1,12 +1,14 @@ package poomasi.domain.image.repository; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; import poomasi.domain.image.entity.Image; import poomasi.domain.image.entity.ImageType; import java.util.List; import java.util.Optional; +@Repository public interface ImageRepository extends JpaRepository { long countByTypeAndReferenceIdAndDeletedAtIsNull(ImageType type, Long referenceId); List findByTypeAndReferenceIdAndDeletedAtIsNull(ImageType type, Long referenceId); diff --git a/src/main/java/poomasi/domain/image/service/ImageService.java b/src/main/java/poomasi/domain/image/service/ImageService.java index bff0bf1d..cf72c618 100644 --- a/src/main/java/poomasi/domain/image/service/ImageService.java +++ b/src/main/java/poomasi/domain/image/service/ImageService.java @@ -10,6 +10,7 @@ import poomasi.domain.image.validation.ImageOwnerValidator; import poomasi.domain.image.validation.ImageOwnerValidatorFactory; import poomasi.domain.member._profile.entity.MemberProfile; +import poomasi.domain.member._profile.service.MemberProfileService; import poomasi.domain.member.entity.Member; import poomasi.domain.member.repository.MemberRepository; import poomasi.global.error.BusinessException; diff --git a/src/main/java/poomasi/domain/member/_profile/controller/MemberProfileController.java b/src/main/java/poomasi/domain/member/_profile/controller/MemberProfileController.java new file mode 100644 index 00000000..97de1cdf --- /dev/null +++ b/src/main/java/poomasi/domain/member/_profile/controller/MemberProfileController.java @@ -0,0 +1,14 @@ +package poomasi.domain.member._profile.controller; + +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import poomasi.domain.member._profile.service.MemberProfileService; + +@RestController +@RequiredArgsConstructor +@RequestMapping("api/member/profile") +public class MemberProfileController { + + private final MemberProfileService memberProfileService; +} diff --git a/src/main/java/poomasi/domain/member/_profile/repository/MemberProfileRepository.java b/src/main/java/poomasi/domain/member/_profile/repository/MemberProfileRepository.java index ee260f12..433f671c 100644 --- a/src/main/java/poomasi/domain/member/_profile/repository/MemberProfileRepository.java +++ b/src/main/java/poomasi/domain/member/_profile/repository/MemberProfileRepository.java @@ -1,7 +1,9 @@ package poomasi.domain.member._profile.repository; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; import poomasi.domain.member._profile.entity.MemberProfile; +@Repository public interface MemberProfileRepository extends JpaRepository { } \ No newline at end of file From 99deee95a2fcbd01a8b2d8e72df59f7a1a2b7456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 17:48:06 +0900 Subject: [PATCH 07/17] =?UTF-8?q?refactor:=20reissueToken=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=EB=A1=9C=EC=A7=81=20=EC=9D=B8=EC=9E=90=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20#124?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../token/refreshtoken/service/RefreshTokenService.java | 1 - .../token/reissue/controller/ReissueTokenController.java | 8 ++------ .../auth/token/reissue/service/ReissueTokenService.java | 4 +++- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/poomasi/domain/auth/token/refreshtoken/service/RefreshTokenService.java b/src/main/java/poomasi/domain/auth/token/refreshtoken/service/RefreshTokenService.java index c7111a58..5673353a 100644 --- a/src/main/java/poomasi/domain/auth/token/refreshtoken/service/RefreshTokenService.java +++ b/src/main/java/poomasi/domain/auth/token/refreshtoken/service/RefreshTokenService.java @@ -1,7 +1,6 @@ package poomasi.domain.auth.token.refreshtoken.service; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/src/main/java/poomasi/domain/auth/token/reissue/controller/ReissueTokenController.java b/src/main/java/poomasi/domain/auth/token/reissue/controller/ReissueTokenController.java index f0ecadff..24f80ba0 100644 --- a/src/main/java/poomasi/domain/auth/token/reissue/controller/ReissueTokenController.java +++ b/src/main/java/poomasi/domain/auth/token/reissue/controller/ReissueTokenController.java @@ -10,24 +10,20 @@ import poomasi.domain.auth.token.reissue.dto.ReissueRequest; import poomasi.domain.auth.token.reissue.dto.ReissueResponse; import poomasi.domain.auth.token.reissue.service.ReissueTokenService; -import poomasi.domain.auth.token.util.JwtUtil; @RestController @RequiredArgsConstructor public class ReissueTokenController { private final ReissueTokenService reissueTokenService; - private final JwtUtil jwtUtil; @PostMapping("/api/reissue") public ResponseEntity reissue(@RequestHeader(HttpHeaders.AUTHORIZATION) String authorizationHeader, @RequestBody ReissueRequest reissueRequest){ - String token = authorizationHeader.replace("Bearer ", ""); + String accessToken = authorizationHeader.replace("Bearer ", ""); - Long memberId = jwtUtil.getIdFromToken(token); - - return ResponseEntity.ok(reissueTokenService.reissueToken(memberId, reissueRequest)); + return ResponseEntity.ok(reissueTokenService.reissueToken(accessToken, reissueRequest)); } } diff --git a/src/main/java/poomasi/domain/auth/token/reissue/service/ReissueTokenService.java b/src/main/java/poomasi/domain/auth/token/reissue/service/ReissueTokenService.java index 89b379e5..b0b21182 100644 --- a/src/main/java/poomasi/domain/auth/token/reissue/service/ReissueTokenService.java +++ b/src/main/java/poomasi/domain/auth/token/reissue/service/ReissueTokenService.java @@ -18,7 +18,9 @@ public class ReissueTokenService { private final RefreshTokenService refreshTokenService; // 토큰 재발급 - public ReissueResponse reissueToken(Long memberId, ReissueRequest reissueRequest) { + public ReissueResponse reissueToken(String accessToken, ReissueRequest reissueRequest) { + Long memberId = jwtUtil.getIdFromToken(accessToken); + String refreshToken = reissueRequest.refreshToken(); Long requestMemberId = jwtUtil.getIdFromToken(refreshToken); From d8a987d29f792d03a00701fe56db1199fc06cde8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 20:51:25 +0900 Subject: [PATCH 08/17] =?UTF-8?q?fix:=20=EC=98=A4=EB=A5=98=20=EC=9D=BC?= =?UTF-8?q?=EB=8B=A8=20=ED=95=B4=EA=B2=B0=20#124?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/_profile/service/MemberProfileService.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/poomasi/domain/member/_profile/service/MemberProfileService.java b/src/main/java/poomasi/domain/member/_profile/service/MemberProfileService.java index ad25beb3..6e1f4d1c 100644 --- a/src/main/java/poomasi/domain/member/_profile/service/MemberProfileService.java +++ b/src/main/java/poomasi/domain/member/_profile/service/MemberProfileService.java @@ -23,8 +23,7 @@ public MemberProfile getMemberProfileById(Long id){ } @Transactional - public MemberProfile saveMemberProfile(MemberProfileRequest memberProfileRequest){ - MemberProfile memberProfile = MemberProfileRequest.toEntity(memberProfileRequest); + public MemberProfile saveMemberProfile(MemberProfile memberProfile){ return memberProfileRepository.save(memberProfile); } } From f7b354078dfa944175c70f21d6e904a82e9a1975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 21:19:55 +0900 Subject: [PATCH 09/17] =?UTF-8?q?feat:=20=EA=B3=A0=EA=B0=9D,=20=EB=86=8D?= =?UTF-8?q?=EB=B6=80=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=20=EC=83=9D=EC=84=B1=20#82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_profile/entity/CustomerProfile.java | 21 +++++++++ .../member/_profile/entity/FarmerProfile.java | 45 +++++++++++++++++++ .../member/_profile/entity/MemberProfile.java | 14 +----- .../repository/MemberProfileRepository.java | 10 +++++ 4 files changed, 78 insertions(+), 12 deletions(-) create mode 100644 src/main/java/poomasi/domain/member/_profile/entity/CustomerProfile.java create mode 100644 src/main/java/poomasi/domain/member/_profile/entity/FarmerProfile.java diff --git a/src/main/java/poomasi/domain/member/_profile/entity/CustomerProfile.java b/src/main/java/poomasi/domain/member/_profile/entity/CustomerProfile.java new file mode 100644 index 00000000..e18930cc --- /dev/null +++ b/src/main/java/poomasi/domain/member/_profile/entity/CustomerProfile.java @@ -0,0 +1,21 @@ +package poomasi.domain.member._profile.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.DiscriminatorValue; +import jakarta.persistence.Entity; + +@Entity +@DiscriminatorValue("CUSTOMER") +public class CustomerProfile extends MemberProfile{ + @Column(nullable = true, length = 255) + private String address; + + @Column(nullable = true, length = 255) + private String addressDetail; + + @Column(nullable=true, length=255) + private Long coordinateX; + + @Column(nullable=true, length=255) + private Long coordinateY; +} diff --git a/src/main/java/poomasi/domain/member/_profile/entity/FarmerProfile.java b/src/main/java/poomasi/domain/member/_profile/entity/FarmerProfile.java new file mode 100644 index 00000000..a28b21fe --- /dev/null +++ b/src/main/java/poomasi/domain/member/_profile/entity/FarmerProfile.java @@ -0,0 +1,45 @@ +package poomasi.domain.member._profile.entity; + +import jakarta.persistence.*; + +import java.util.List; + +@Entity +@DiscriminatorValue("FARMER") +public class FarmerProfile extends MemberProfile{ + @Column(nullable = true, length = 100, unique = true) + private String storeName; + + @Column(nullable = true, length = 100) + private String storeAddress; + + @Column(nullable = true, length = 100) + private String storeAddressDetail; + + @Column(nullable=true, length=100) + private Long storeCoordinateX; + + @Column(nullable=true, length=100) + private Long storeCoordinateY; + + @Column(nullable = true, length = 100, unique = true) + private String farmName; + + @Column(nullable = true, length = 100) + private String farmAddress; + + @Column(nullable = true, length = 100) + private String farmAddressDetail; + + @Column(nullable=true, length=100) + private Long farmCoordinateX; + + @Column(nullable=true, length=100) + private Long farmCoordinateY; + + @ElementCollection + @CollectionTable(name = "business_registration_numbers", joinColumns = @JoinColumn(name = "farmer_profile_id")) + @Column(nullable = true, length=255) + private List businessRegistrationNumbers; + +} diff --git a/src/main/java/poomasi/domain/member/_profile/entity/MemberProfile.java b/src/main/java/poomasi/domain/member/_profile/entity/MemberProfile.java index 9c1836ea..c40cec72 100644 --- a/src/main/java/poomasi/domain/member/_profile/entity/MemberProfile.java +++ b/src/main/java/poomasi/domain/member/_profile/entity/MemberProfile.java @@ -12,6 +12,8 @@ @Table(name = "member_profile") @AllArgsConstructor @Builder +@Inheritance(strategy = InheritanceType.JOINED) +@DiscriminatorColumn(name = "profile_type") public class MemberProfile { @Id @@ -24,18 +26,6 @@ public class MemberProfile { @Column(nullable = true, length = 20) private String phoneNumber; - @Column(nullable = true, length = 255) - private String address; - - @Column(nullable = true, length = 255) - private String addressDetail; - - @Column(nullable=true, length=255) - private Long coordinateX; - - @Column(nullable=true, length=255) - private Long coordinateY; - @Column(nullable = false) @Builder.Default private boolean isBanned = false; diff --git a/src/main/java/poomasi/domain/member/_profile/repository/MemberProfileRepository.java b/src/main/java/poomasi/domain/member/_profile/repository/MemberProfileRepository.java index 433f671c..f59a2490 100644 --- a/src/main/java/poomasi/domain/member/_profile/repository/MemberProfileRepository.java +++ b/src/main/java/poomasi/domain/member/_profile/repository/MemberProfileRepository.java @@ -1,9 +1,19 @@ package poomasi.domain.member._profile.repository; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; +import poomasi.domain.member._profile.entity.FarmerProfile; import poomasi.domain.member._profile.entity.MemberProfile; +import java.util.Optional; + @Repository public interface MemberProfileRepository extends JpaRepository { + + // FarmerProfile 타입만 조회 +// @Query("SELECT p FROM FarmerProfile p WHERE p.farmName = :farmName") +// Optional findFarmerByFarmName(@Param("farmName") String farmName); + } \ No newline at end of file From 26cfd3b4058918659cc80e9c08bca1915313402f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 21:38:19 +0900 Subject: [PATCH 10/17] =?UTF-8?q?refactor:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EC=8B=9C=20name=EB=8F=84=20=EB=B0=9B=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20#82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/_profile/entity/MemberProfile.java | 8 -------- .../member/_profile/service/MemberProfileService.java | 1 - .../domain/member/dto/request/SignupRequest.java | 2 +- .../member/dto/response/MemberSummaryResponse.java | 2 +- .../java/poomasi/domain/member/entity/Member.java | 11 +++++------ .../poomasi/domain/member/service/MemberService.java | 3 ++- 6 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/main/java/poomasi/domain/member/_profile/entity/MemberProfile.java b/src/main/java/poomasi/domain/member/_profile/entity/MemberProfile.java index c40cec72..af2b5849 100644 --- a/src/main/java/poomasi/domain/member/_profile/entity/MemberProfile.java +++ b/src/main/java/poomasi/domain/member/_profile/entity/MemberProfile.java @@ -20,9 +20,6 @@ public class MemberProfile { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; - @Column(nullable = true, length = 50) - private String name; - @Column(nullable = true, length = 20) private String phoneNumber; @@ -49,10 +46,5 @@ public void prePersist() { } public MemberProfile() { - this.name = "UNKNOWN"; // name not null 조건 때문에 임시로 넣었습니다. nullable도 true로 넣었는데 안 되네요 - } - - public MemberProfile(String name){ - this.name = name; } } diff --git a/src/main/java/poomasi/domain/member/_profile/service/MemberProfileService.java b/src/main/java/poomasi/domain/member/_profile/service/MemberProfileService.java index 6e1f4d1c..3f88b3c4 100644 --- a/src/main/java/poomasi/domain/member/_profile/service/MemberProfileService.java +++ b/src/main/java/poomasi/domain/member/_profile/service/MemberProfileService.java @@ -3,7 +3,6 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import poomasi.domain.member._profile.dto.request.MemberProfileRequest; import poomasi.domain.member._profile.entity.MemberProfile; import poomasi.domain.member._profile.repository.MemberProfileRepository; import poomasi.global.error.BusinessException; diff --git a/src/main/java/poomasi/domain/member/dto/request/SignupRequest.java b/src/main/java/poomasi/domain/member/dto/request/SignupRequest.java index 447bdf9b..85bbe7ab 100644 --- a/src/main/java/poomasi/domain/member/dto/request/SignupRequest.java +++ b/src/main/java/poomasi/domain/member/dto/request/SignupRequest.java @@ -1,4 +1,4 @@ package poomasi.domain.member.dto.request; -public record SignupRequest(String email, String password) { +public record SignupRequest(String name, String email, String password) { } diff --git a/src/main/java/poomasi/domain/member/dto/response/MemberSummaryResponse.java b/src/main/java/poomasi/domain/member/dto/response/MemberSummaryResponse.java index 9691eab0..f57c1bfa 100644 --- a/src/main/java/poomasi/domain/member/dto/response/MemberSummaryResponse.java +++ b/src/main/java/poomasi/domain/member/dto/response/MemberSummaryResponse.java @@ -6,7 +6,7 @@ public record MemberSummaryResponse(String name, Image profileImage) { public static MemberSummaryResponse fromEntity(Member member) { return new MemberSummaryResponse( - member.getMemberProfile().getName(), + member.getName(), member.getMemberProfile().getProfileImage() ); } diff --git a/src/main/java/poomasi/domain/member/entity/Member.java b/src/main/java/poomasi/domain/member/entity/Member.java index 4dc7828b..c975f4fd 100644 --- a/src/main/java/poomasi/domain/member/entity/Member.java +++ b/src/main/java/poomasi/domain/member/entity/Member.java @@ -24,6 +24,9 @@ public class Member { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; + @Column(nullable = true, length = 50) + private String name; + @Column(unique = true, nullable = true, length = 50) private String email; @@ -59,18 +62,14 @@ public class Member { @Column(nullable = true) private String farmerTierCode; - public Member(String email, String password, LoginType loginType, Role role) { + public Member(String name, String email, String password, LoginType loginType, Role role) { + this.name = name; this.email = email; this.password = password; this.loginType = loginType; this.role = role; } - public Member(String email, Role role) { - this.email = email; - this.role = role; - } - public void setMemberProfile(MemberProfile memberProfile) { this.memberProfile = memberProfile; if (memberProfile != null) { diff --git a/src/main/java/poomasi/domain/member/service/MemberService.java b/src/main/java/poomasi/domain/member/service/MemberService.java index 6ea5669a..3c6ac294 100644 --- a/src/main/java/poomasi/domain/member/service/MemberService.java +++ b/src/main/java/poomasi/domain/member/service/MemberService.java @@ -31,13 +31,14 @@ public class MemberService { @Description("카카오톡으로 먼저 회원가입이 되어 있는 경우, 계정 연동을 진행합니다. ") @Transactional public SignUpResponse signUp(SignupRequest signupRequest) { + String name = signupRequest.name(); String email = signupRequest.email(); String password = signupRequest.password(); memberRepository.findByEmail(email) .ifPresent(member -> { throw new BusinessException(DUPLICATE_MEMBER_EMAIL); }); - Member newMember = new Member(email, + Member newMember = new Member(name, email, passwordEncoder.encode(password), LoginType.LOCAL, ROLE_CUSTOMER); From e50d93008e7808b827c653e5b3641068c77bb933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 22:17:11 +0900 Subject: [PATCH 11/17] =?UTF-8?q?feat:=20Role=EB=B3=84=20Profile=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=20#82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/CommonProfileResponse.java | 22 +++++++++++ .../response/CustomerProfileResponse.java} | 16 +++----- .../dto/response/FarmerProfileResponse.java | 37 +++++++++++++++++++ .../dto/response/MemberProfileResponse.java | 18 +++++++++ .../_profile/entity/CustomerProfile.java | 2 + .../member/_profile/entity/FarmerProfile.java | 2 + .../member/dto/response/MemberResponse.java | 5 ++- .../member/dto/response/SignUpResponse.java | 2 +- .../domain/member/service/MemberService.java | 2 +- 9 files changed, 92 insertions(+), 14 deletions(-) create mode 100644 src/main/java/poomasi/domain/member/_profile/dto/response/CommonProfileResponse.java rename src/main/java/poomasi/domain/member/{dto/response/MemberProfileResponse.java => _profile/dto/response/CustomerProfileResponse.java} (53%) create mode 100644 src/main/java/poomasi/domain/member/_profile/dto/response/FarmerProfileResponse.java create mode 100644 src/main/java/poomasi/domain/member/_profile/dto/response/MemberProfileResponse.java diff --git a/src/main/java/poomasi/domain/member/_profile/dto/response/CommonProfileResponse.java b/src/main/java/poomasi/domain/member/_profile/dto/response/CommonProfileResponse.java new file mode 100644 index 00000000..9b896d70 --- /dev/null +++ b/src/main/java/poomasi/domain/member/_profile/dto/response/CommonProfileResponse.java @@ -0,0 +1,22 @@ +package poomasi.domain.member._profile.dto.response; + +import poomasi.domain.image.entity.Image; +import poomasi.domain.member._profile.entity.MemberProfile; + +import java.time.LocalDateTime; + +public record CommonProfileResponse( + String phoneNumber, + boolean isBanned, + LocalDateTime createdAt, + Image profileImage +) { + public static CommonProfileResponse fromEntity(MemberProfile profile) { + return new CommonProfileResponse( + profile.getPhoneNumber(), + profile.isBanned(), + profile.getCreatedAt(), + profile.getProfileImage() + ); + } +} diff --git a/src/main/java/poomasi/domain/member/dto/response/MemberProfileResponse.java b/src/main/java/poomasi/domain/member/_profile/dto/response/CustomerProfileResponse.java similarity index 53% rename from src/main/java/poomasi/domain/member/dto/response/MemberProfileResponse.java rename to src/main/java/poomasi/domain/member/_profile/dto/response/CustomerProfileResponse.java index d7ad6655..f96323d3 100644 --- a/src/main/java/poomasi/domain/member/dto/response/MemberProfileResponse.java +++ b/src/main/java/poomasi/domain/member/_profile/dto/response/CustomerProfileResponse.java @@ -1,29 +1,23 @@ -package poomasi.domain.member.dto.response; +package poomasi.domain.member._profile.dto.response; import poomasi.domain.image.entity.Image; -import poomasi.domain.member._profile.entity.MemberProfile; +import poomasi.domain.member._profile.entity.CustomerProfile; import java.time.LocalDateTime; -public record MemberProfileResponse( - String name, +public record CustomerProfileResponse( String phoneNumber, String address, String addressDetail, - Long coordinateX, - Long coordinateY, boolean isBanned, LocalDateTime createdAt, Image profileImage ) { - public static MemberProfileResponse fromEntity(MemberProfile profile) { - return new MemberProfileResponse( - profile.getName(), + public static CustomerProfileResponse fromEntity(CustomerProfile profile) { + return new CustomerProfileResponse( profile.getPhoneNumber(), profile.getAddress(), profile.getAddressDetail(), - profile.getCoordinateX(), - profile.getCoordinateY(), profile.isBanned(), profile.getCreatedAt(), profile.getProfileImage() diff --git a/src/main/java/poomasi/domain/member/_profile/dto/response/FarmerProfileResponse.java b/src/main/java/poomasi/domain/member/_profile/dto/response/FarmerProfileResponse.java new file mode 100644 index 00000000..b364097a --- /dev/null +++ b/src/main/java/poomasi/domain/member/_profile/dto/response/FarmerProfileResponse.java @@ -0,0 +1,37 @@ +package poomasi.domain.member._profile.dto.response; + +import poomasi.domain.image.entity.Image; +import poomasi.domain.member._profile.entity.FarmerProfile; + +import java.time.LocalDateTime; +import java.util.List; + +public record FarmerProfileResponse( + String phoneNumber, + boolean isBanned, + LocalDateTime createdAt, + Image profileImage, + String storeName, + String farmName, + List businessRegistrationNumbers, + String storeAddress, + String storeAddressDetail, + String farmAddress, + String farmAddressDetail +) { + public static FarmerProfileResponse fromEntity(FarmerProfile profile) { + return new FarmerProfileResponse( + profile.getPhoneNumber(), + profile.isBanned(), + profile.getCreatedAt(), + profile.getProfileImage(), + profile.getStoreName(), + profile.getFarmName(), + profile.getBusinessRegistrationNumbers(), + profile.getStoreAddress(), + profile.getStoreAddressDetail(), + profile.getFarmAddress(), + profile.getFarmAddressDetail() + ); + } +} \ No newline at end of file diff --git a/src/main/java/poomasi/domain/member/_profile/dto/response/MemberProfileResponse.java b/src/main/java/poomasi/domain/member/_profile/dto/response/MemberProfileResponse.java new file mode 100644 index 00000000..c4ff7b4d --- /dev/null +++ b/src/main/java/poomasi/domain/member/_profile/dto/response/MemberProfileResponse.java @@ -0,0 +1,18 @@ +package poomasi.domain.member._profile.dto.response; + +import poomasi.domain.member._profile.entity.CustomerProfile; +import poomasi.domain.member._profile.entity.FarmerProfile; +import poomasi.domain.member._profile.entity.MemberProfile; + +public class MemberProfileResponse { + + public static Object fromEntity(MemberProfile profile) { + if (profile instanceof FarmerProfile farmerProfile) { + return FarmerProfileResponse.fromEntity(farmerProfile); + } else if (profile instanceof CustomerProfile customerProfile) { + return CustomerProfileResponse.fromEntity(customerProfile); + } else { + return CommonProfileResponse.fromEntity(profile); + } + } +} \ No newline at end of file diff --git a/src/main/java/poomasi/domain/member/_profile/entity/CustomerProfile.java b/src/main/java/poomasi/domain/member/_profile/entity/CustomerProfile.java index e18930cc..ea7b83ad 100644 --- a/src/main/java/poomasi/domain/member/_profile/entity/CustomerProfile.java +++ b/src/main/java/poomasi/domain/member/_profile/entity/CustomerProfile.java @@ -3,8 +3,10 @@ import jakarta.persistence.Column; import jakarta.persistence.DiscriminatorValue; import jakarta.persistence.Entity; +import lombok.Getter; @Entity +@Getter @DiscriminatorValue("CUSTOMER") public class CustomerProfile extends MemberProfile{ @Column(nullable = true, length = 255) diff --git a/src/main/java/poomasi/domain/member/_profile/entity/FarmerProfile.java b/src/main/java/poomasi/domain/member/_profile/entity/FarmerProfile.java index a28b21fe..06b946c7 100644 --- a/src/main/java/poomasi/domain/member/_profile/entity/FarmerProfile.java +++ b/src/main/java/poomasi/domain/member/_profile/entity/FarmerProfile.java @@ -1,10 +1,12 @@ package poomasi.domain.member._profile.entity; import jakarta.persistence.*; +import lombok.Getter; import java.util.List; @Entity +@Getter @DiscriminatorValue("FARMER") public class FarmerProfile extends MemberProfile{ @Column(nullable = true, length = 100, unique = true) diff --git a/src/main/java/poomasi/domain/member/dto/response/MemberResponse.java b/src/main/java/poomasi/domain/member/dto/response/MemberResponse.java index f19c14c3..ca01e60b 100644 --- a/src/main/java/poomasi/domain/member/dto/response/MemberResponse.java +++ b/src/main/java/poomasi/domain/member/dto/response/MemberResponse.java @@ -1,16 +1,19 @@ package poomasi.domain.member.dto.response; +import poomasi.domain.member._profile.dto.response.MemberProfileResponse; import poomasi.domain.member.entity.Member; public record MemberResponse( Long id, + String name, String email, String role, - MemberProfileResponse memberProfile + Object memberProfile ) { public static MemberResponse fromEntity(Member member) { return new MemberResponse( member.getId(), + member.getName(), member.getEmail(), member.getRole().name(), member.getMemberProfile() != null ? MemberProfileResponse.fromEntity(member.getMemberProfile()) : null diff --git a/src/main/java/poomasi/domain/member/dto/response/SignUpResponse.java b/src/main/java/poomasi/domain/member/dto/response/SignUpResponse.java index 02280570..bf4a5ecb 100644 --- a/src/main/java/poomasi/domain/member/dto/response/SignUpResponse.java +++ b/src/main/java/poomasi/domain/member/dto/response/SignUpResponse.java @@ -1,4 +1,4 @@ package poomasi.domain.member.dto.response; -public record SignUpResponse(String email, String message) { +public record SignUpResponse(String name, String email, String message) { } diff --git a/src/main/java/poomasi/domain/member/service/MemberService.java b/src/main/java/poomasi/domain/member/service/MemberService.java index 3c6ac294..9e7f22ef 100644 --- a/src/main/java/poomasi/domain/member/service/MemberService.java +++ b/src/main/java/poomasi/domain/member/service/MemberService.java @@ -44,7 +44,7 @@ public SignUpResponse signUp(SignupRequest signupRequest) { ROLE_CUSTOMER); memberRepository.save(newMember); - return new SignUpResponse(email, "회원 가입 성공"); + return new SignUpResponse(name, email, "회원 가입 성공"); } public MemberResponse getMemberById(Long memberId) { From 5e2dcc2f53782387697aa332aa9727039bc2c9f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 22:23:57 +0900 Subject: [PATCH 12/17] =?UTF-8?q?fix:=20findByEmailAndDeletedAtIsNull?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95=20#82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/security/userdetail/OAuth2UserDetailServiceImpl.java | 2 +- .../auth/security/userdetail/UserDetailsServiceImpl.java | 2 +- .../poomasi/domain/member/repository/MemberRepository.java | 4 ++-- .../java/poomasi/domain/member/service/MemberService.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/poomasi/domain/auth/security/userdetail/OAuth2UserDetailServiceImpl.java b/src/main/java/poomasi/domain/auth/security/userdetail/OAuth2UserDetailServiceImpl.java index 34e8a261..a595b326 100644 --- a/src/main/java/poomasi/domain/auth/security/userdetail/OAuth2UserDetailServiceImpl.java +++ b/src/main/java/poomasi/domain/auth/security/userdetail/OAuth2UserDetailServiceImpl.java @@ -52,7 +52,7 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2Authentic //일단 없으면 가입시키는 쪽으로 구현ㄴ - Member member = memberRepository.findByEmail(email).orElse(null); + Member member = memberRepository.findByEmailAndDeletedAtIsNull(email).orElse(null); if(member == null) { member = Member.builder() .email(email) diff --git a/src/main/java/poomasi/domain/auth/security/userdetail/UserDetailsServiceImpl.java b/src/main/java/poomasi/domain/auth/security/userdetail/UserDetailsServiceImpl.java index e14131fa..86e2ff7b 100644 --- a/src/main/java/poomasi/domain/auth/security/userdetail/UserDetailsServiceImpl.java +++ b/src/main/java/poomasi/domain/auth/security/userdetail/UserDetailsServiceImpl.java @@ -19,7 +19,7 @@ public UserDetailsServiceImpl(MemberRepository memberRepository) { @Override public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException { - Member member = memberRepository.findByEmail(email) + Member member = memberRepository.findByEmailAndDeletedAtIsNull(email) .orElseThrow(() -> new BusinessException(BusinessError.MEMBER_NOT_FOUND)); return new UserDetailsImpl(member); } diff --git a/src/main/java/poomasi/domain/member/repository/MemberRepository.java b/src/main/java/poomasi/domain/member/repository/MemberRepository.java index f9bcb1c3..4e3cea7e 100644 --- a/src/main/java/poomasi/domain/member/repository/MemberRepository.java +++ b/src/main/java/poomasi/domain/member/repository/MemberRepository.java @@ -7,6 +7,6 @@ import java.util.Optional; public interface MemberRepository extends JpaRepository { - Optional findByEmail(String email); + Optional findByEmailAndDeletedAtIsNull(String email); Optional findByIdAndDeletedAtIsNull(Long id); -} +} \ No newline at end of file diff --git a/src/main/java/poomasi/domain/member/service/MemberService.java b/src/main/java/poomasi/domain/member/service/MemberService.java index 9e7f22ef..e39a9a9c 100644 --- a/src/main/java/poomasi/domain/member/service/MemberService.java +++ b/src/main/java/poomasi/domain/member/service/MemberService.java @@ -35,7 +35,7 @@ public SignUpResponse signUp(SignupRequest signupRequest) { String email = signupRequest.email(); String password = signupRequest.password(); - memberRepository.findByEmail(email) + memberRepository.findByEmailAndDeletedAtIsNull(email) .ifPresent(member -> { throw new BusinessException(DUPLICATE_MEMBER_EMAIL); }); Member newMember = new Member(name, email, From 0ad5160f361f7e202d80614b4079e7521c2d3399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 22:36:38 +0900 Subject: [PATCH 13/17] =?UTF-8?q?refactor:=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=EC=A1=B0=ED=9A=8C=20->=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=20=EC=9A=94=EC=95=BD=20=EC=A1=B0=ED=9A=8C=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20#82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MemberController.java | 8 ++++---- .../java/poomasi/domain/member/service/MemberService.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/poomasi/domain/member/controller/MemberController.java b/src/main/java/poomasi/domain/member/controller/MemberController.java index 32d8bdf7..2ee754f3 100644 --- a/src/main/java/poomasi/domain/member/controller/MemberController.java +++ b/src/main/java/poomasi/domain/member/controller/MemberController.java @@ -53,11 +53,11 @@ public ResponseEntity getMemberById(@PathVariable Long memberId) return ResponseEntity.ok(memberResponse); } - @GetMapping + @GetMapping("/summary") @Secured("ROLE_ADMIN") - public ResponseEntity> getMembers(@PageableDefault(size = 10) Pageable pageable) { - Page memberResponses = memberService.getAllMembers(pageable); - return ResponseEntity.ok(memberResponses); + public ResponseEntity> getMembersSummary(@PageableDefault(size = 10) Pageable pageable) { + Page memberSummaryResponses = memberService.getAllMembersSummary(pageable); + return ResponseEntity.ok(memberSummaryResponses); } @GetMapping("/self") diff --git a/src/main/java/poomasi/domain/member/service/MemberService.java b/src/main/java/poomasi/domain/member/service/MemberService.java index e39a9a9c..c386ee3c 100644 --- a/src/main/java/poomasi/domain/member/service/MemberService.java +++ b/src/main/java/poomasi/domain/member/service/MemberService.java @@ -57,9 +57,9 @@ public MemberSummaryResponse getMemberSummary(Long memberId) { return MemberSummaryResponse.fromEntity(member); } - public Page getAllMembers(Pageable pageable) { + public Page getAllMembersSummary(Pageable pageable) { Page members = memberRepository.findAll(pageable); - return members.map(MemberResponse::fromEntity); + return members.map(MemberSummaryResponse::fromEntity); } @Transactional From 49b90b2b018748b9c642ef6672e83f68b925c42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sat, 9 Nov 2024 23:52:00 +0900 Subject: [PATCH 14/17] =?UTF-8?q?refactor:=20MemberProfileResponse=20?= =?UTF-8?q?=EC=9D=B8=ED=84=B0=ED=8E=98=EC=9D=B4=EC=8A=A4=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20#82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/request/MemberProfileRequest.java | 8 +----- .../dto/response/CommonProfileResponse.java | 15 ++++++---- .../dto/response/CustomerProfileResponse.java | 18 ++++++------ .../dto/response/FarmerProfileResponse.java | 28 ++++++++++--------- .../dto/response/MemberProfileResponse.java | 4 +-- .../member/dto/response/MemberResponse.java | 2 +- 6 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/main/java/poomasi/domain/member/_profile/dto/request/MemberProfileRequest.java b/src/main/java/poomasi/domain/member/_profile/dto/request/MemberProfileRequest.java index d1ff89c0..3492e58d 100644 --- a/src/main/java/poomasi/domain/member/_profile/dto/request/MemberProfileRequest.java +++ b/src/main/java/poomasi/domain/member/_profile/dto/request/MemberProfileRequest.java @@ -1,11 +1,5 @@ package poomasi.domain.member._profile.dto.request; -import poomasi.domain.member._profile.entity.MemberProfile; -public record MemberProfileRequest(String name) { - public static MemberProfile toEntity(MemberProfileRequest memberProfileRequest){ - return new MemberProfile( - memberProfileRequest.name - ); - } +public record MemberProfileRequest() { } diff --git a/src/main/java/poomasi/domain/member/_profile/dto/response/CommonProfileResponse.java b/src/main/java/poomasi/domain/member/_profile/dto/response/CommonProfileResponse.java index 9b896d70..cb665655 100644 --- a/src/main/java/poomasi/domain/member/_profile/dto/response/CommonProfileResponse.java +++ b/src/main/java/poomasi/domain/member/_profile/dto/response/CommonProfileResponse.java @@ -1,16 +1,18 @@ package poomasi.domain.member._profile.dto.response; +import lombok.AllArgsConstructor; import poomasi.domain.image.entity.Image; import poomasi.domain.member._profile.entity.MemberProfile; import java.time.LocalDateTime; -public record CommonProfileResponse( - String phoneNumber, - boolean isBanned, - LocalDateTime createdAt, - Image profileImage -) { +@AllArgsConstructor +public class CommonProfileResponse implements MemberProfileResponse { + String phoneNumber; + boolean isBanned; + LocalDateTime createdAt; + Image profileImage; + public static CommonProfileResponse fromEntity(MemberProfile profile) { return new CommonProfileResponse( profile.getPhoneNumber(), @@ -19,4 +21,5 @@ public static CommonProfileResponse fromEntity(MemberProfile profile) { profile.getProfileImage() ); } + } diff --git a/src/main/java/poomasi/domain/member/_profile/dto/response/CustomerProfileResponse.java b/src/main/java/poomasi/domain/member/_profile/dto/response/CustomerProfileResponse.java index f96323d3..53501e03 100644 --- a/src/main/java/poomasi/domain/member/_profile/dto/response/CustomerProfileResponse.java +++ b/src/main/java/poomasi/domain/member/_profile/dto/response/CustomerProfileResponse.java @@ -1,18 +1,20 @@ package poomasi.domain.member._profile.dto.response; +import lombok.AllArgsConstructor; import poomasi.domain.image.entity.Image; import poomasi.domain.member._profile.entity.CustomerProfile; import java.time.LocalDateTime; -public record CustomerProfileResponse( - String phoneNumber, - String address, - String addressDetail, - boolean isBanned, - LocalDateTime createdAt, - Image profileImage -) { +@AllArgsConstructor +public class CustomerProfileResponse implements MemberProfileResponse{ + String phoneNumber; + String address; + String addressDetail; + boolean isBanned; + LocalDateTime createdAt; + Image profileImage; + public static CustomerProfileResponse fromEntity(CustomerProfile profile) { return new CustomerProfileResponse( profile.getPhoneNumber(), diff --git a/src/main/java/poomasi/domain/member/_profile/dto/response/FarmerProfileResponse.java b/src/main/java/poomasi/domain/member/_profile/dto/response/FarmerProfileResponse.java index b364097a..53fed2f5 100644 --- a/src/main/java/poomasi/domain/member/_profile/dto/response/FarmerProfileResponse.java +++ b/src/main/java/poomasi/domain/member/_profile/dto/response/FarmerProfileResponse.java @@ -1,24 +1,26 @@ package poomasi.domain.member._profile.dto.response; +import lombok.AllArgsConstructor; import poomasi.domain.image.entity.Image; import poomasi.domain.member._profile.entity.FarmerProfile; import java.time.LocalDateTime; import java.util.List; -public record FarmerProfileResponse( - String phoneNumber, - boolean isBanned, - LocalDateTime createdAt, - Image profileImage, - String storeName, - String farmName, - List businessRegistrationNumbers, - String storeAddress, - String storeAddressDetail, - String farmAddress, - String farmAddressDetail -) { +@AllArgsConstructor +public class FarmerProfileResponse implements MemberProfileResponse { + String phoneNumber; + boolean isBanned; + LocalDateTime createdAt; + Image profileImage; + String storeName; + String farmName; + List businessRegistrationNumbers; + String storeAddress; + String storeAddressDetail; + String farmAddress; + String farmAddressDetail; + public static FarmerProfileResponse fromEntity(FarmerProfile profile) { return new FarmerProfileResponse( profile.getPhoneNumber(), diff --git a/src/main/java/poomasi/domain/member/_profile/dto/response/MemberProfileResponse.java b/src/main/java/poomasi/domain/member/_profile/dto/response/MemberProfileResponse.java index c4ff7b4d..b191dda0 100644 --- a/src/main/java/poomasi/domain/member/_profile/dto/response/MemberProfileResponse.java +++ b/src/main/java/poomasi/domain/member/_profile/dto/response/MemberProfileResponse.java @@ -4,9 +4,9 @@ import poomasi.domain.member._profile.entity.FarmerProfile; import poomasi.domain.member._profile.entity.MemberProfile; -public class MemberProfileResponse { +public interface MemberProfileResponse { - public static Object fromEntity(MemberProfile profile) { + static MemberProfileResponse fromEntity(MemberProfile profile) { if (profile instanceof FarmerProfile farmerProfile) { return FarmerProfileResponse.fromEntity(farmerProfile); } else if (profile instanceof CustomerProfile customerProfile) { diff --git a/src/main/java/poomasi/domain/member/dto/response/MemberResponse.java b/src/main/java/poomasi/domain/member/dto/response/MemberResponse.java index ca01e60b..98a8c464 100644 --- a/src/main/java/poomasi/domain/member/dto/response/MemberResponse.java +++ b/src/main/java/poomasi/domain/member/dto/response/MemberResponse.java @@ -8,7 +8,7 @@ public record MemberResponse( String name, String email, String role, - Object memberProfile + MemberProfileResponse memberProfile ) { public static MemberResponse fromEntity(Member member) { return new MemberResponse( From 5d90acfd0d52be29fb54840fe68f903d692f955b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sun, 10 Nov 2024 00:14:30 +0900 Subject: [PATCH 15/17] =?UTF-8?q?ReviewResponse=EC=97=90=EC=84=9C=20getNam?= =?UTF-8?q?e=EB=B6=80=EB=B6=84=20=EC=88=98=EC=A0=95=20#129?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/poomasi/domain/review/dto/ReviewResponse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/poomasi/domain/review/dto/ReviewResponse.java b/src/main/java/poomasi/domain/review/dto/ReviewResponse.java index ba6d42b0..1b6ac560 100644 --- a/src/main/java/poomasi/domain/review/dto/ReviewResponse.java +++ b/src/main/java/poomasi/domain/review/dto/ReviewResponse.java @@ -15,7 +15,7 @@ public static ReviewResponse fromEntity(Review review) { return new ReviewResponse( review.getId(), review.getEntityId(), - review.getReviewer().getMemberProfile().getName(), + review.getReviewer().getName(), review.getRating(), review.getContent() ); From f5a8537de1c5d1d3052f79b048a59d6c4db59d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sun, 10 Nov 2024 00:28:45 +0900 Subject: [PATCH 16/17] =?UTF-8?q?fix:=20=EC=B6=A9=EB=8F=8C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0=20#129?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/signup/service/SignupService.java | 47 ------------------- .../domain/store/dto/StoreResponse.java | 2 +- 2 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 src/main/java/poomasi/domain/auth/signup/service/SignupService.java diff --git a/src/main/java/poomasi/domain/auth/signup/service/SignupService.java b/src/main/java/poomasi/domain/auth/signup/service/SignupService.java deleted file mode 100644 index 7099ec8b..00000000 --- a/src/main/java/poomasi/domain/auth/signup/service/SignupService.java +++ /dev/null @@ -1,47 +0,0 @@ -package poomasi.domain.auth.signup.service; - -import jdk.jfr.Description; -import lombok.RequiredArgsConstructor; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import poomasi.domain.member.dto.request.SignupRequest; -import poomasi.domain.member.dto.response.SignUpResponse; -import poomasi.domain.member.entity.LoginType; -import poomasi.domain.member.repository.MemberRepository; -import poomasi.domain.member.entity.Member; -import poomasi.global.error.BusinessException; - -import static poomasi.domain.member.entity.Role.ROLE_CUSTOMER; -import static poomasi.domain.member.entity.Role.ROLE_FARMER; -import static poomasi.global.error.BusinessError.*; - -@Service -@RequiredArgsConstructor -@Transactional(readOnly = true) -public class SignupService { - - private final MemberRepository memberRepository; - private final PasswordEncoder passwordEncoder; - - @Description("카카오톡으로 먼저 회원가입이 되어 있는 경우, 계정 연동을 진행합니다. ") - @Transactional - public SignUpResponse signUp(SignupRequest signupRequest) { - String email = signupRequest.email(); - String password = signupRequest.password(); - - memberRepository.findByEmail(email) - .ifPresent(member -> { throw new BusinessException(DUPLICATE_MEMBER_EMAIL); }); - - Member newMember = Member.builder() - .email(email) - .password(passwordEncoder.encode(password)) - .loginType(LoginType.LOCAL) - .role(ROLE_FARMER) - .build(); - memberRepository.save(newMember); - return new SignUpResponse(email, "회원 가입 성공"); - } -} - diff --git a/src/main/java/poomasi/domain/store/dto/StoreResponse.java b/src/main/java/poomasi/domain/store/dto/StoreResponse.java index cb99e0c7..3a821c63 100644 --- a/src/main/java/poomasi/domain/store/dto/StoreResponse.java +++ b/src/main/java/poomasi/domain/store/dto/StoreResponse.java @@ -46,7 +46,7 @@ public static StoreResponse fromEntity(Store store) { .shipingFee(store.getShipingFee()) //TODO 나중에 삼항연산자 삭제 .ownerName( store.getOwner().getMemberProfile() == null ? "" - : store.getOwner().getMemberProfile().getName()) + : store.getOwner().getName()) .products(store.getProducts().stream().map(ProductResponse::fromEntity).toList()) .build(); From e7e62ecc559c4befa012eaacf0b260db3bf78752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=A7=84=ED=83=9D?= <87135698+jjt4515@users.noreply.github.com> Date: Sun, 10 Nov 2024 00:37:45 +0900 Subject: [PATCH 17/17] =?UTF-8?q?fix:=20=EC=88=9C=ED=99=98=20=EC=B0=B8?= =?UTF-8?q?=EC=A1=B0=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0=20#129?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/config/SecurityBeanGenerator.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/main/java/poomasi/domain/auth/config/SecurityBeanGenerator.java b/src/main/java/poomasi/domain/auth/config/SecurityBeanGenerator.java index 2a067e4d..2aa3d5d6 100644 --- a/src/main/java/poomasi/domain/auth/config/SecurityBeanGenerator.java +++ b/src/main/java/poomasi/domain/auth/config/SecurityBeanGenerator.java @@ -21,9 +21,6 @@ @Configuration public class SecurityBeanGenerator { - private final TokenStorageService tokenStorageService; - private final MemberService memberService; - private final TokenBlacklistService tokenBlacklistService; @Bean @Description("AuthenticationProvider를 위한 Spring bean") @@ -37,11 +34,5 @@ MvcRequestMatcher.Builder mvc(HandlerMappingIntrospector introspector) { return new MvcRequestMatcher.Builder(introspector); } - @Bean - JwtUtil jwtUtil(){ - return new JwtUtil(tokenBlacklistService, - tokenStorageService, - memberService); - } }