Skip to content

Commit

Permalink
Merge pull request #269 from 6QuizOnTheBlock/be/feat/#267-member_select
Browse files Browse the repository at this point in the history
feat: 멤버 조회 기능 구현 완료
  • Loading branch information
HABINOH authored May 11, 2024
2 parents 6040019 + 06c441f commit 7af6e6c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
import com.quiz.ourclass.domain.member.service.MemberService;
import com.quiz.ourclass.domain.member.service.client.KakaoOicdClient;
import com.quiz.ourclass.global.config.annotation.LogExclusion;
import com.quiz.ourclass.global.dto.MemberSimpleDTO;
import com.quiz.ourclass.global.dto.ResultResponse;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
Expand All @@ -19,6 +22,7 @@
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.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
Expand Down Expand Up @@ -117,4 +121,13 @@ public ResponseEntity<ResultResponse<?>> deleteMe() {
memberService.deleteMe();
return ResponseEntity.ok(ResultResponse.success(null));
}

@GetMapping("/{id}")
public ResponseEntity<ResultResponse<?>> select(
@Parameter(name = "id", description = "멤버 PK 값", required = true, in = ParameterIn.PATH)
@PathVariable(value = "id") Long id
) {
MemberSimpleDTO response = memberService.select(id);
return ResponseEntity.ok(ResultResponse.success(response));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.quiz.ourclass.domain.member.dto.request.MemberUpdateRequest;
import com.quiz.ourclass.domain.member.dto.request.UpdateFcmTokenRequest;
import com.quiz.ourclass.domain.member.dto.response.MemberUpdateResponse;
import com.quiz.ourclass.global.dto.MemberSimpleDTO;
import com.quiz.ourclass.global.dto.ResultResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
Expand All @@ -18,6 +19,7 @@
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.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

Expand Down Expand Up @@ -91,4 +93,17 @@ public ResponseEntity<ResultResponse<?>> updateDefaultImage(

@PatchMapping("/photo")
public ResponseEntity<ResultResponse<?>> updateProfile(MemberUpdateRequest request);

@Operation(summary = "멤버 조회", description = "ID 값에 해당하는 멤버 Simple 정보(id, name, iamgeUrl)를 조회합니다.",
responses = {
@ApiResponse(responseCode = "200", description = "(message: \"Success\")",
content = @Content(schema = @Schema(implementation = MemberSimpleDTO.class))),
@ApiResponse(responseCode = "404", description = "(message : \"멤버가 존재하지 않습니다.\")", content = @Content)
}
)
@GetMapping("{id}")
ResponseEntity<ResultResponse<?>> select(

@PathVariable(value = "id") Long id
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.quiz.ourclass.domain.member.repository.DefaultImageRepository;
import com.quiz.ourclass.domain.member.repository.MemberRepository;
import com.quiz.ourclass.domain.member.repository.RefreshRepository;
import com.quiz.ourclass.global.dto.MemberSimpleDTO;
import com.quiz.ourclass.global.exception.ErrorCode;
import com.quiz.ourclass.global.exception.GlobalException;
import com.quiz.ourclass.global.util.AwsS3ObjectStorage;
Expand Down Expand Up @@ -197,5 +198,9 @@ public void deleteMe() {

}


public MemberSimpleDTO select(Long id) {
Member member = memberRepository.findById(id)
.orElseThrow(() -> new GlobalException(ErrorCode.MEMBER_NOT_FOUND));
return memberMapper.memberToMemberSimpleDTO(member);
}
}

0 comments on commit 7af6e6c

Please sign in to comment.