From 06477abd945bfb5bc6af49307fad2e1e0634c791 Mon Sep 17 00:00:00 2001 From: senna Date: Wed, 13 Nov 2024 22:47:58 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=82=B4=20=ED=83=9C=EA=B7=B8=20?= =?UTF-8?q?=EA=B0=80=EC=A0=B8=EC=98=A4=EA=B8=B0=20API=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/controller/MemberController.java | 3 +++ .../member/controller/MemberControllerImpl.java | 16 +++++++++++++++- .../dto/responses/MemberTagGetResponse.java | 7 +++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/leets/team2/xclone/domain/member/dto/responses/MemberTagGetResponse.java diff --git a/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberController.java b/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberController.java index 096232c..7195e54 100644 --- a/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberController.java +++ b/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberController.java @@ -6,6 +6,7 @@ import com.leets.team2.xclone.domain.member.dto.requests.MemberFindGetRequest; import com.leets.team2.xclone.domain.member.dto.responses.CheckTagDuplicationGetResponse; import com.leets.team2.xclone.domain.member.dto.responses.MemberFindGetResponse; +import com.leets.team2.xclone.domain.member.dto.responses.MemberTagGetResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; @@ -28,4 +29,6 @@ ResponseEntity> getCheckTagDuplication( @Operation(summary = "프로필 사진 수정 API", description = "자신의 프로필 사진을 수정합니다.") ResponseEntity> updateProfilePicture(@RequestPart(value="image",required = false) MultipartFile image); + @Operation(summary = "멤버 Tag 가져오기 API", description = "로그인한 멤버의 Tag를 가져옵니다.") + ResponseEntity> getMemberTag(); } diff --git a/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberControllerImpl.java b/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberControllerImpl.java index 137c4ba..505e890 100644 --- a/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberControllerImpl.java +++ b/src/main/java/com/leets/team2/xclone/domain/member/controller/MemberControllerImpl.java @@ -7,13 +7,19 @@ import com.leets.team2.xclone.domain.member.dto.MemberDTO; import com.leets.team2.xclone.domain.member.dto.requests.CheckTagDuplicationGetRequest; import com.leets.team2.xclone.domain.member.dto.responses.CheckTagDuplicationGetResponse; +import com.leets.team2.xclone.domain.member.dto.responses.MemberTagGetResponse; import com.leets.team2.xclone.domain.member.entities.Member; import com.leets.team2.xclone.domain.member.service.MemberService; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; @Controller @@ -55,4 +61,12 @@ public ResponseEntity> updateProfilePicture(@Request return ApiData.ok(response); } + @Override + @GetMapping("/my-tag") + @UseGuards({MemberGuard.class}) + public ResponseEntity> getMemberTag() { + return ApiData.ok( + new MemberTagGetResponse(MemberContext.getMember().getTag()) + ); + } } diff --git a/src/main/java/com/leets/team2/xclone/domain/member/dto/responses/MemberTagGetResponse.java b/src/main/java/com/leets/team2/xclone/domain/member/dto/responses/MemberTagGetResponse.java new file mode 100644 index 0000000..394f367 --- /dev/null +++ b/src/main/java/com/leets/team2/xclone/domain/member/dto/responses/MemberTagGetResponse.java @@ -0,0 +1,7 @@ +package com.leets.team2.xclone.domain.member.dto.responses; + +public record MemberTagGetResponse( + String tag +) { + +}