-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from capstone-five-ai/fix/cache
fix: 캐시가 초기화되지 않는 문제 해결
- Loading branch information
Showing
4 changed files
with
66 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.app.fake; | ||
|
||
import com.app.domain.member.constant.MemberType; | ||
import com.app.domain.member.constant.Role; | ||
import com.app.domain.member.entity.Member; | ||
import com.app.domain.member.service.MemberService; | ||
import com.app.global.jwt.dto.JwtTokenDto; | ||
import com.app.global.jwt.service.TokenManager; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RequiredArgsConstructor | ||
@Profile(value = {"local", "test"}) | ||
@RestController | ||
public class FakeLoginController { | ||
|
||
private final MemberService memberService; | ||
private final TokenManager tokenManager; | ||
|
||
@PostMapping("/api/fake/login") | ||
public ResponseEntity<String> fakeSignUp(@RequestBody FakeSignUpRequest request) { | ||
Member member = memberService.findMemberByEmail(request.getEmail()).orElseGet( | ||
() -> memberService.registerMember(Member.builder() | ||
.nickName(request.getNickname()) | ||
.email(request.getEmail()) | ||
.memberType(MemberType.KAKAO) | ||
.role(Role.USER) | ||
.build()) | ||
); | ||
|
||
JwtTokenDto jwtTokenDto = tokenManager.createJwtTokenDto(member.getMemberId(), member.getRole()); | ||
member.updateRefreshToken(jwtTokenDto); | ||
return ResponseEntity.ok(jwtTokenDto.getAccessToken()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.app.fake; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class FakeSignUpRequest { | ||
|
||
private String nickname; | ||
private String email; | ||
|
||
public FakeSignUpRequest(String nickname, String email) { | ||
this.nickname = nickname; | ||
this.email = email; | ||
} | ||
} |