Skip to content

Commit

Permalink
Merge pull request #298 from twenty-three-23/feature/TT-359
Browse files Browse the repository at this point in the history
  • Loading branch information
snacktime81 authored Aug 9, 2024
2 parents 0e49a6a + f69ea1a commit 43d94ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.twentythree.peech.common.dto.response;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public class WrappedResponseBody<T> {

private int statusCode;
private T responseBody;

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.twentythree.peech.user.controller;

import com.twentythree.peech.common.dto.response.WrappedResponseBody;
import com.twentythree.peech.security.jwt.JWTAuthentication;
import com.twentythree.peech.user.domain.UserFetcher;
import com.twentythree.peech.user.domain.UserMapper;
Expand Down Expand Up @@ -47,14 +48,14 @@ public UserIdTokenResponseDTO createUserByDeviceId(@RequestBody CreateUserReques
@Operation(summary = "소셜로 회원 가입",
description = "소셜 계정으로 회원 가입")
@PostMapping("api/v1.1/user")
public ResponseEntity<UserIdTokenResponseDTO> loginBySocial(@RequestBody LoginBySocialRequestDTO request) {
public ResponseEntity<WrappedResponseBody<UserIdTokenResponseDTO>> loginBySocial(@RequestBody LoginBySocialRequestDTO request) {

String token = request.getSocialToken();
AuthorizationServer authorizationServer = request.getAuthorizationServer();

AccessAndRefreshToken accessAndRefreshToken = userService.loginBySocial(token, authorizationServer);

return ResponseEntity.status(411).body(new UserIdTokenResponseDTO(accessAndRefreshToken.getAccessToken(), accessAndRefreshToken.getRefreshToken()));
UserIdTokenResponseDTO userIdTokenResponseDTO = new UserIdTokenResponseDTO(accessAndRefreshToken.getAccessToken(), accessAndRefreshToken.getRefreshToken());
return ResponseEntity.status(201).body(new WrappedResponseBody<UserIdTokenResponseDTO>(411, userIdTokenResponseDTO));
}

@Operation(summary = "로그인에 필요한 추가 정보를 입력 받는다",
Expand Down

0 comments on commit 43d94ee

Please sign in to comment.