Skip to content

Commit

Permalink
refactor: 서비스 -> 파사드 의존성 변경 (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
SunwoongH committed Apr 10, 2024
1 parent 0d30a99 commit a2804d1
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions doorip-api/src/main/java/org/doorip/user/api/UserApiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@

import lombok.RequiredArgsConstructor;
import org.doorip.auth.UserId;
import org.doorip.common.BaseResponse;
import org.doorip.common.ApiResponseUtil;
import org.doorip.common.BaseResponse;
import org.doorip.message.SuccessMessage;
import org.doorip.user.dto.request.ResultUpdateRequest;
import org.doorip.user.dto.request.UserReissueRequest;
import org.doorip.user.dto.request.UserSignInRequest;
import org.doorip.user.dto.request.UserSignUpRequest;
import org.doorip.user.dto.request.ProfileUpdateRequest;
import org.doorip.user.dto.request.*;
import org.doorip.user.dto.response.ProfileGetResponse;
import org.doorip.user.dto.response.UserSignUpResponse;
import org.doorip.user.dto.response.UserSignInResponse;
import org.doorip.user.service.UserService;
import org.doorip.user.dto.response.UserSignUpResponse;
import org.doorip.user.facade.UserFacade;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
Expand All @@ -24,72 +20,72 @@
@RequestMapping("/api/users")
@Controller
public class UserApiController implements UserApi {
private final UserService userService;
private final UserFacade userFacade;

@GetMapping("/splash")
@Override
public ResponseEntity<BaseResponse<?>> splash(@UserId final Long userId) {
userService.splash(userId);
userFacade.splash(userId);
return ApiResponseUtil.success(SuccessMessage.OK);
}

@PostMapping("/signin")
@Override
public ResponseEntity<BaseResponse<?>> signIn(@RequestHeader(AUTHORIZATION) final String token,
@RequestBody final UserSignInRequest request) {
final UserSignInResponse response = userService.signIn(token, request);
final UserSignInResponse response = userFacade.signIn(token, request);
return ApiResponseUtil.success(SuccessMessage.OK, response);
}

@PostMapping("/signup")
@Override
public ResponseEntity<BaseResponse<?>> signUp(@RequestHeader(AUTHORIZATION) final String token,
@RequestBody final UserSignUpRequest request) {
final UserSignUpResponse response = userService.signUp(token, request);
final UserSignUpResponse response = userFacade.signUp(token, request);
return ApiResponseUtil.success(SuccessMessage.CREATED, response);
}

@PatchMapping("/signout")
@Override
public ResponseEntity<BaseResponse<?>> signOut(@UserId final Long userId) {
userService.signOut(userId);
userFacade.signOut(userId);
return ApiResponseUtil.success(SuccessMessage.OK);
}

@DeleteMapping("/withdraw")
@Override
public ResponseEntity<BaseResponse<?>> withdraw(@UserId final Long userId) {
userService.withdraw(userId);
userFacade.withdraw(userId);
return ApiResponseUtil.success(SuccessMessage.OK);
}

@PostMapping("/reissue")
@Override
public ResponseEntity<BaseResponse<?>> reissue(@RequestHeader(AUTHORIZATION) final String refreshtoken,
@RequestBody final UserReissueRequest request) {
final UserSignUpResponse response = userService.reissue(refreshtoken, request);
final UserSignUpResponse response = userFacade.reissue(refreshtoken, request);
return ApiResponseUtil.success(SuccessMessage.OK, response);
}

@GetMapping("/profile")
@Override
public ResponseEntity<BaseResponse<?>> getProfile(@UserId final Long userId) {
final ProfileGetResponse response = userService.getProfile(userId);
final ProfileGetResponse response = userFacade.getProfile(userId);
return ApiResponseUtil.success(SuccessMessage.OK, response);
}

@PatchMapping("/test")
@Override
public ResponseEntity<BaseResponse<?>> updateResult(@UserId final Long userId,
@RequestBody final ResultUpdateRequest request) {
userService.updateResult(userId, request);
userFacade.updateResult(userId, request);
return ApiResponseUtil.success(SuccessMessage.OK);
}

@PatchMapping("/profile")
public ResponseEntity<BaseResponse<?>> updateProfile(@UserId final Long userId,
@RequestBody final ProfileUpdateRequest request) {
userService.updateProfile(userId, request);
userFacade.updateProfile(userId, request);
return ApiResponseUtil.success(SuccessMessage.OK);
}
}

0 comments on commit a2804d1

Please sign in to comment.