Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#104
Browse files Browse the repository at this point in the history
  • Loading branch information
JinDalgi committed Dec 28, 2023
2 parents cad0761 + 7d7c6e1 commit ac6c3ee
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public String healthCheck() {
@Operation(summary = "멤버의 상세 정보 등록", description = "회원가입이 완료된 멤버의 상세정보를 작성, 완료 시 Role을 User로 변경")
@PostMapping("/members")
public ResponseEntity<?> createMember(@Valid @RequestPart("CREATE") RequestCreateMemberDto dto,
@RequestPart("IMAGE")MultipartFile image) {
@RequestPart("IMAGE")MultipartFile image,
@RequestHeader("UUID") String memberUUID) {
dto.setMemberUuid(memberUUID);
memberService.createMember(dto, image);
return ResponseEntity.ok(GlobalResponseDto.of(true));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@ public String healthCheck() {

@Operation(summary = "회원가입", description = "email, password를 입력받아 회원가입 처리, 기본 role = guest")
@PostMapping("/passes")
public ResponseEntity<?> createPass(@RequestBody RequestCreatePassDto dto) {
passService.createPass(dto);
public ResponseEntity<?> createPass(@RequestBody RequestCreatePassDto dto, HttpServletResponse response) {
String token = passService.createPass(dto);
String uuid = dto.getUuid();
cookieUtil.setToken(token, TokenType.ACCESS, response);
cookieUtil.setToken(token, TokenType.REFRESH, response);
String role = passService.setRole(RequestLoginDto
.builder()
.email(dto.getEmail()).password(dto.getPassword())
.build());
cookieUtil.setRoleCookie(role, response);
return ResponseEntity.ok(GlobalResponseDto.of(uuid));
}

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

public interface PassService {

void createPass(RequestCreatePassDto dto);
String createPass(RequestCreatePassDto dto);
String login(RequestLoginDto dto);
void logout(String uuid);
List<ResponseListDto> getPassByAll(int pageNo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,15 @@ public class PassServiceImpl implements PassService {

@Override
@Transactional
public void createPass(RequestCreatePassDto dto) {
public String createPass(RequestCreatePassDto dto) {
duplicateUserCheck(dto);
String password = dto.getPassword();
dto.setPassword(passwordEncoder.encode(password));
Pass pass = dto.toEntity();
passRepository.save(pass);

login(
RequestLoginDto.builder()
return login(RequestLoginDto.builder()
.email(dto.getEmail())
.password(password)
.build());
.password(password).build());
}

@Override
Expand Down

0 comments on commit ac6c3ee

Please sign in to comment.