Skip to content

Commit

Permalink
[FIX] 코드리뷰 수정사항 반영 #16
Browse files Browse the repository at this point in the history
  • Loading branch information
jun02160 committed Jul 10, 2023
1 parent f516fbf commit 637d2a6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
import sopt.org.umbbaServer.domain.parentchild.controller.dto.request.OnboardingInviteRequestDto;
import sopt.org.umbbaServer.domain.parentchild.controller.dto.request.OnboardingReceiveRequestDto;
import sopt.org.umbbaServer.domain.parentchild.controller.dto.response.InviteResultResponeDto;
import sopt.org.umbbaServer.domain.parentchild.controller.dto.response.OnboadringReceiveResponseDto;
import sopt.org.umbbaServer.domain.parentchild.controller.dto.response.OnboardingReceiveResponseDto;
import sopt.org.umbbaServer.domain.parentchild.controller.dto.response.OnboardingInviteResponseDto;
import sopt.org.umbbaServer.domain.parentchild.service.ParentchildService;
import sopt.org.umbbaServer.global.common.dto.ApiResponse;
import sopt.org.umbbaServer.global.config.jwt.JwtProvider;
import sopt.org.umbbaServer.global.exception.SuccessType;

import javax.validation.Valid;
import java.security.Principal;

@Slf4j
@RestController
Expand Down Expand Up @@ -45,7 +43,7 @@ public ApiResponse<InviteResultResponeDto> inviteRelation(@Valid @RequestBody In

@PatchMapping("/receive")
@ResponseStatus(HttpStatus.OK)
public ApiResponse<OnboadringReceiveResponseDto> onboardReceive(@Valid @RequestBody OnboardingReceiveRequestDto request) {
public ApiResponse<OnboardingReceiveResponseDto> onboardReceive(@Valid @RequestBody OnboardingReceiveRequestDto request) {
return ApiResponse.success(SuccessType.CREATE_PARENT_CHILD_SUCCESS, parentchildService.onboardReceive(request));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
@Getter
@Builder
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class OnboadringReceiveResponseDto {
public class OnboardingReceiveResponseDto {

private UserInfoDto userInfo;

private InviteResultResponeDto parentchildInfo;

private LocalTime pushTime;

public static OnboadringReceiveResponseDto of(Parentchild parentchild, User user, List<User> parentChildUsers) {
return OnboadringReceiveResponseDto.builder()
public static OnboardingReceiveResponseDto of(Parentchild parentchild, User user, List<User> parentChildUsers) {
return OnboardingReceiveResponseDto.builder()
.userInfo(UserInfoDto.of(user))
.parentchildInfo(InviteResultResponeDto.of(parentchild, parentChildUsers))
.pushTime(parentchild.getPushTime())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import sopt.org.umbbaServer.domain.parentchild.controller.dto.request.InviteCodeRequestDto;
import sopt.org.umbbaServer.domain.parentchild.controller.dto.request.OnboardingInviteRequestDto;
import sopt.org.umbbaServer.domain.parentchild.controller.dto.request.OnboardingReceiveRequestDto;
import sopt.org.umbbaServer.domain.parentchild.controller.dto.response.InviteResultResponeDto;
import sopt.org.umbbaServer.domain.parentchild.controller.dto.response.OnboadringReceiveResponseDto;
import sopt.org.umbbaServer.domain.parentchild.controller.dto.response.OnboardingReceiveResponseDto;
import sopt.org.umbbaServer.domain.parentchild.controller.dto.response.OnboardingInviteResponseDto;
import sopt.org.umbbaServer.domain.parentchild.model.Parentchild;
import sopt.org.umbbaServer.domain.parentchild.model.ParentchildRelation;
import sopt.org.umbbaServer.domain.parentchild.repository.ParentchildRepository;
import sopt.org.umbbaServer.domain.user.model.User;
import sopt.org.umbbaServer.domain.user.repository.UserRepository;
import sopt.org.umbbaServer.global.config.jwt.JwtProvider;
import sopt.org.umbbaServer.global.exception.CustomException;
import sopt.org.umbbaServer.global.exception.ErrorType;

Expand Down Expand Up @@ -60,7 +58,7 @@ public OnboardingInviteResponseDto onboardInvite(OnboardingInviteRequestDto requ

// [수신] 초대받는 측의 온보딩 정보 입력
@Transactional
public OnboadringReceiveResponseDto onboardReceive(OnboardingReceiveRequestDto request) {
public OnboardingReceiveResponseDto onboardReceive(OnboardingReceiveRequestDto request) {

User user = userRepository.findById(request.getUserInfo().getUserId()).orElseThrow(
() -> new CustomException(ErrorType.INVALID_USER)
Expand All @@ -79,7 +77,7 @@ public OnboadringReceiveResponseDto onboardReceive(OnboardingReceiveRequestDto r
List<User> parentChildUsers = getParentChildUsers(parentchild);


return OnboadringReceiveResponseDto.of(parentchild, user, parentChildUsers);
return OnboardingReceiveResponseDto.of(parentchild, user, parentChildUsers);
}

// 부모자식 관계 케이스 분류하기
Expand Down

0 comments on commit 637d2a6

Please sign in to comment.