Skip to content

Commit

Permalink
Merge pull request #141 from Gamegoo-repo/feat/138
Browse files Browse the repository at this point in the history
[Feat/138] 회원 API 관련 기능 추가 개발
  • Loading branch information
rimi3226 authored Aug 10, 2024
2 parents d92ccb8 + 3bd2980 commit 4efe342
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public class QMatchingRecord extends EntityPathBase<MatchingRecord> {

public final BooleanPath mike = createBoolean("mike");

public final StringPath rank = createString("rank");
public final NumberPath<Integer> rank = createNumber("rank", Integer.class);


public final EnumPath<MatchingStatus> status = createEnum("status", MatchingStatus.class);

Expand Down
4 changes: 3 additions & 1 deletion src/main/generated/com/gamegoo/domain/member/QMember.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class QMember extends EntityPathBase<Member> {

public final NumberPath<Long> id = createNumber("id", Long.class);

public final BooleanPath isAgree = createBoolean("isAgree");

public final EnumPath<LoginType> loginType = createEnum("loginType", LoginType.class);

public final NumberPath<Integer> mainPosition = createNumber("mainPosition", Integer.class);
Expand All @@ -59,7 +61,7 @@ public class QMember extends EntityPathBase<Member> {

public final NumberPath<Integer> profileImage = createNumber("profileImage", Integer.class);

public final StringPath rank = createString("rank");
public final NumberPath<Integer> rank = createNumber("rank", Integer.class);

public final StringPath refreshToken = createString("refreshToken");

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/gamegoo/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public JWTFilter jwtFilter() {
List<String> excludedPaths = Arrays.asList("/swagger-ui/", "/v3/api-docs",
"/v1/member/join", "/v1/member/login", "/v1/member/email", "/v1/member/refresh",
"/v1/member/riot", "/v1/posts/list", "/v1/posts/list/{boardId}",
"/v1/test/chatroom/create/matched", "/v1/member/password/reset", "/v1/member/profile/{id}");
"/v1/test/chatroom/create/matched", "/v1/member/password/reset", "/v1/member/profile/other");
return new JWTFilter(jwtUtil, excludedPaths, customUserDetailService);

}
Expand All @@ -69,7 +69,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.authorizeHttpRequests((auth) -> auth
.antMatchers("/", "/v1/member/join", "/v1/member/login", "/v1/member/email/**",
"/v1/member/refresh", "/v1/member/riot", "/v1/posts/list/**",
"/v1/test/chatroom/create/matched", "/v1/member/password/reset", "/v1/member/profile/{id}").permitAll()
"/v1/test/chatroom/create/matched", "/v1/member/password/reset", "/v1/member/profile/other").permitAll()
.antMatchers("/", "/swagger-ui/**", "/v3/api-docs/**").permitAll()
.anyRequest().authenticated())
.addFilterBefore(new JWTExceptionHandlerFilter(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public ApiResponse<String> blindMember() {

}

@Operation(summary = "jwt 토큰이 필요한 회원 조회 API 입니다.", description = "API for looking up member with jwt")
@GetMapping("/profile/jwt")
@Operation(summary = "내 프로필 조회 API 입니다. (jwt 토큰 O)", description = "API for looking up member with jwt")
@GetMapping("/profile")
public ApiResponse<MemberResponse.myProfileMemberDTO> getMemberJWT() {
Long memberId = JWTUtil.getCurrentUserId();

Expand All @@ -88,8 +88,8 @@ public ApiResponse<MemberResponse.myProfileMemberDTO> getMemberJWT() {
return ApiResponse.onSuccess(MemberConverter.toMyProfileDTO(myProfile));
}

@Operation(summary = "회원 조회 API 입니다.", description = "API for looking up member")
@GetMapping("/profile")
@Operation(summary = "다른 회원 프로필 조회 API 입니다. (jwt 토큰 X)", description = "API for looking up member")
@GetMapping("/profile/other")
public ApiResponse<MemberResponse.myProfileMemberDTO> getMember(@RequestParam("id") Long memberId) {
Member myProfile = profileService.findMember(memberId);

Expand Down
12 changes: 9 additions & 3 deletions src/main/java/com/gamegoo/converter/MemberConverter.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.gamegoo.converter;

import com.gamegoo.domain.member.Member;
import com.gamegoo.domain.friend.Friend;
import com.gamegoo.domain.member.Member;
import com.gamegoo.dto.member.MemberResponse;
import org.springframework.data.domain.Page;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.data.domain.Page;

public class MemberConverter {

public static MemberResponse.blockListDTO toBlockListDTO(Page<Member> blockList) {
Expand Down Expand Up @@ -65,6 +64,13 @@ public static MemberResponse.myProfileMemberDTO toMyProfileDTO(Member member) {
.tier(member.getTier())
.rank(member.getRank())
.profileImg(member.getProfileImage())
.manner(member.getMannerLevel())
.mainP(member.getMainPosition())
.subP(member.getSubPosition())
.isAgree(member.getIsAgree())
.isBlind(member.getBlind())
.winrate(member.getWinRate())
.loginType(String.valueOf(member.getLoginType()))
.updatedAt(String.valueOf(member.getUpdatedAt()))
.gameStyleResponseDTOList(gameStyleResponseDTOList)
.championResponseDTOList(championResponseDTOList)
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/gamegoo/dto/member/MemberResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ public static class myProfileMemberDTO {
String tag;
Tier tier;
Integer rank;
Integer manner;
String updatedAt;
Integer mainP;
Integer subP;
Boolean isAgree;
Boolean isBlind;
String loginType;
Double winrate;
List<GameStyleResponseDTO> gameStyleResponseDTOList;
List<ChampionResponseDTO> championResponseDTOList;
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/gamegoo/service/member/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public Member joinMember(String email, String password, String gameName, String
.profileImage(randomProfileImage)
.blind(false)
.mike(false)
.mannerLevel(1)
.isAgree(isAgree)
.build();

Expand Down Expand Up @@ -128,10 +129,10 @@ public Member joinMember(String email, String password, String gameName, String
* @param email
*/
@Transactional
public void sendEmail(String email, Boolean ischeck) {
public void sendEmail(String email, Boolean isCheck) {
// 중복 확인하기
boolean isPresent = memberRepository.findByEmail(email).isPresent();
if (isPresent && ischeck) {
if (isPresent && isCheck) {
throw new MemberHandler(ErrorStatus.MEMBER_CONFLICT);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import com.gamegoo.apiPayload.code.status.ErrorStatus;
import com.gamegoo.apiPayload.exception.handler.MemberHandler;
import com.gamegoo.domain.member.Member;
import com.gamegoo.domain.gamestyle.GameStyle;
import com.gamegoo.domain.gamestyle.MemberGameStyle;
import com.gamegoo.domain.member.Member;
import com.gamegoo.repository.member.GameStyleRepository;
import com.gamegoo.repository.member.MemberGameStyleRepository;
import com.gamegoo.repository.member.MemberRepository;
Expand Down

0 comments on commit 4efe342

Please sign in to comment.