Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 온보딩 멤버 정보 조회 기능 #72

Merged
merged 7 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import com.gdschongik.gdsc.domain.member.application.OnboardingMemberService;
import com.gdschongik.gdsc.domain.member.dto.request.MemberSignupRequest;
import com.gdschongik.gdsc.domain.member.dto.request.OnboardingMemberUpdateRequest;
import com.gdschongik.gdsc.domain.member.dto.response.MemberInfoResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
Expand Down Expand Up @@ -35,4 +37,11 @@ public ResponseEntity<Void> updateMember(@Valid @RequestBody OnboardingMemberUpd
onboardingMemberService.updateMember(request);
return ResponseEntity.ok().build();
}

@Operation(summary = "회원 정보 조회", description = "회원 정보를 조회합니다.")
@GetMapping("/me")
public ResponseEntity<MemberInfoResponse> getMemberInfo() {
MemberInfoResponse response = onboardingMemberService.getMemberInfo();
return ResponseEntity.ok().body(response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.gdschongik.gdsc.domain.member.domain.Member;
import com.gdschongik.gdsc.domain.member.dto.request.MemberSignupRequest;
import com.gdschongik.gdsc.domain.member.dto.request.OnboardingMemberUpdateRequest;
import com.gdschongik.gdsc.domain.member.dto.response.MemberInfoResponse;
import com.gdschongik.gdsc.global.util.MemberUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand All @@ -27,4 +28,9 @@ public void updateMember(OnboardingMemberUpdateRequest request) {
Member currentMember = memberUtil.getCurrentMember();
currentMember.updateDiscordInfo(request.discordUsername(), request.nickname());
}

public MemberInfoResponse getMemberInfo() {
Member currentMember = memberUtil.getCurrentMember();
return MemberInfoResponse.of(currentMember);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.gdschongik.gdsc.domain.member.dto.response;

import com.gdschongik.gdsc.domain.member.domain.Member;
import com.gdschongik.gdsc.domain.member.domain.MemberRole;
import com.gdschongik.gdsc.domain.member.domain.RequirementStatus;
import io.swagger.v3.oas.annotations.media.Schema;

public record MemberInfoResponse(
Long memberId,
String studentId,
String name,
String phone,
String department,
String email,
String discordUsername,
String nickname,
@Schema(description = "회비 입금 상태") RequirementStatus paymentStatus,
@Schema(description = "디스코드 연동 상태") RequirementStatus discordStatus,
@Schema(description = "가입 상태") MemberRole role) {

public static MemberInfoResponse of(Member member) {
return new MemberInfoResponse(
member.getId(),
member.getStudentId(),
member.getName(),
member.getPhone(),
member.getDepartment(),
member.getEmail(),
member.getDiscordUsername(),
member.getNickname(),
member.getRequirement().getPaymentStatus(),
member.getRequirement().getDiscordStatus(),
member.getRole());
}
}
Loading