Skip to content

Commit

Permalink
Merge pull request #250 from WE-ARE-RACCOONS/RAC-351
Browse files Browse the repository at this point in the history
RAC-351 fix : Case B 병합
  • Loading branch information
ywj9811 authored Apr 26, 2024
2 parents e751680 + 678d4dc commit 724c89d
Show file tree
Hide file tree
Showing 30 changed files with 78 additions and 543 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import jakarta.validation.constraints.NotBlank;

public record SeniorChangeRequest(@NotBlank String major, @NotBlank String postgradu, @NotBlank String professor,
@NotBlank String lab, @NotBlank String field, @NotBlank String keyword, @NotBlank String certification) {
@NotBlank String lab, @NotBlank String field, @NotBlank String keyword) {
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ public record SeniorSignUpRequest(@NotNull Long socialId, @NotBlank String phone
@Size(max = 6, message = "6글자까지 입력 가능합니다.") @NotBlank String nickName,
Boolean marketingReceive, @NotBlank String major, @NotBlank String postgradu,
@NotBlank String professor, @NotBlank String lab, @NotBlank String field,
@NotBlank String keyword, @NotBlank String certification) {
@NotBlank String keyword) {
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,4 @@ private User changeSeniorFin(Senior senior, User user) {
bizppurioSeniorMessage.signUp(user);
return user;
}

/**
* 여기부터 Case B를 위한 코드
*/
public User seniorSignUpB(SeniorSignUpRequestB request) {
seniorUtils.checkKeyword(request.keyword());
userUtils.checkPhoneNumber(request.phoneNumber());
User user = mapToUser(request, profile);
userSaveService.save(user);
Senior senior = mapToSenior(user, request);
return seniorSignUpFin(senior);
}

public User changeSeniorB(User user, SeniorChangeRequestB changeRequest) {
seniorUtils.checkKeyword(changeRequest.keyword());
Senior senior = mapToSenior(user, changeRequest);
return changeSeniorFin(senior, user);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,17 @@ public ResponseDto<JwtTokenResponse> refresh(@AuthenticationPrincipal User user,

@PostMapping("/senior/signup/b")
@Operation(summary = "대학원생 가입(Case B) - 필수 과정만", description = "대학원생 회원가입 - 필수 과정만")
public ResponseDto<JwtTokenResponse> singUpSeniorB(@RequestBody @Valid SeniorSignUpRequestB request) {
User user = signUpUseCase.seniorSignUpB(request);
public ResponseDto<JwtTokenResponse> singUpSeniorB(@RequestBody @Valid SeniorSignUpRequest request) {
User user = signUpUseCase.seniorSignUp(request);
JwtTokenResponse jwtToken = jwtUseCase.signIn(user);
return ResponseDto.create(SENIOR_CREATE.getCode(), CREATE_SENIOR.getMessage(), jwtToken);
}

@PostMapping("/senior/change/b")
@Operation(summary = "선배로 추가 가입(Case B) | 토큰 필요", description = "대학생 대학원생으로 변경 추가 가입")
public ResponseDto<JwtTokenResponse> changeSeniorB(@AuthenticationPrincipal User user,
@RequestBody @Valid SeniorChangeRequestB changeRequest) {
User changeUser = signUpUseCase.changeSeniorB(user, changeRequest);
@RequestBody @Valid SeniorChangeRequest changeRequest) {
User changeUser = signUpUseCase.changeSenior(user, changeRequest);
JwtTokenResponse jwtToken = jwtUseCase.changeSenior(changeUser);
return ResponseDto.create(SENIOR_CREATE.getCode(), CREATE_SENIOR.getMessage(), jwtToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,4 @@ public interface AvailableDslRepository {
List<Available> findAllBySenior(Senior senior);
List<Available> findAllByMine(Senior senior);

/**
* Case B
*/
List<Available> findAllByAnySenior(Senior senior);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,21 @@
import java.util.List;

import static com.postgraduate.domain.available.domain.entity.QAvailable.available;
import static com.postgraduate.domain.senior.domain.entity.constant.Status.APPROVE;

@RequiredArgsConstructor
@Repository
public class AvailableDslRepositoryImpl implements AvailableDslRepository {
private final JPAQueryFactory queryFactory;
@Override
public List<Available> findAllBySenior(Senior senior) {
return queryFactory.selectFrom(available)
.distinct()
.where(available.senior.eq(senior), available.senior.status.eq(APPROVE))
.fetch();
}

@Override
public List<Available> findAllByMine(Senior senior) {
return queryFactory.selectFrom(available)
.distinct()
.where(available.senior.eq(senior))
.fetch();
}

@Override
public List<Available> findAllByAnySenior(Senior senior) {
public List<Available> findAllByMine(Senior senior) {
return queryFactory.selectFrom(available)
.distinct()
.where(available.senior.eq(senior))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,11 @@
public class AvailableGetService {
private final AvailableRepository availableRepository;

public List<Available> bySenior(Senior senior) {
return availableRepository.findAllBySenior(senior);
}

public List<Available> byMine(Senior senior) {
return availableRepository.findAllByMine(senior);
}

/**
* Case B
*/
public List<Available> bySeniorWithAny(Senior senior) {
return availableRepository.findAllByAnySenior(senior);
public List<Available> bySenior(Senior senior) {
return availableRepository.findAllBySenior(senior);
}
}

This file was deleted.

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

public record SeniorDetailResponse(
boolean isMine,
boolean certification,
String nickName,
int term,
String profile,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public record SeniorSearchResponse(
Long seniorId,
boolean certification,
String profile,
String nickName,
String postgradu,
Expand Down

This file was deleted.

Loading

0 comments on commit 724c89d

Please sign in to comment.