Skip to content

Commit

Permalink
[refactor] : 자기이해 온오프라인 타입 수정
Browse files Browse the repository at this point in the history
[refactor] : 자기이해 온오프라인 타입 수정
  • Loading branch information
emilywin825 authored May 23, 2024
2 parents 87b77e8 + 279c514 commit 0a24016
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public ProgramDetailDto.ProgramDetailResponseDto getDetailProgram(String authori
participants = findSelfUnderstandingById(programId).getProgramParticipants().size();
return ProgramDetailDto.ProgramDetailResponseDto.of(findSelfUnderStandingById(programId), findAllUserKeyword(user), participants, isApply);
} else if (type.equals("branding")) {
participants=findBrandingById(programId).getProgramParticipants().size();
return ProgramDetailDto.ProgramDetailResponseDto.of(findBrandingById(programId), findAllUserKeyword(user),participants, isApply);
participants = findBrandingById(programId).getProgramParticipants().size();
return ProgramDetailDto.ProgramDetailResponseDto.of(findBrandingById(programId), findAllUserKeyword(user), participants, isApply);
} else throw new ProgramException(NOT_FOUND_PROGRAM);
}

Expand Down Expand Up @@ -120,7 +120,7 @@ public void applyPrograms(String authorizationHeader, ProgramDto.ProgramJoinRequ

private boolean verifyCanApplyPrograms(User user, String programsType, Long programId) {
if (programsType.equals("branding")) {
return programParticipantsRepository.existsByUserAndBranding(user,findBrandingById(programId));
return programParticipantsRepository.existsByUserAndBranding(user, findBrandingById(programId));
} else if (programsType.equals("self-understanding")) {
return programParticipantsRepository.existsByUserAndSelfUnderstanding(user, findSelfUnderstandingById(programId));
} else throw new ProgramException(PROGRAM_ENUM_NOT_FOUND);
Expand All @@ -136,7 +136,6 @@ private User findUserByUUID(String authorizationHeader) {
}



private UUID findUserIdFromauthorizationHeader(String authorizationHeader) {
String token = jwtUtil.getTokenFromHeader(authorizationHeader);
jwtUtil.getUserIdFromToken(token);
Expand All @@ -147,11 +146,11 @@ private List<SelfUnderstanding> findSelfUnderstandingByFilter(ProgramDto.Program
Integer endPrice = requestDto.getEndPrice();
if (endPrice == null) endPrice = maxPrice;

if (requestDto.getForm() != null) {
return selfUnderstandingsRepository.findByPriceBetweenAndForm(requestDto.getStartPrice(), endPrice, FORM.ofCode(requestDto.getForm()));
} else {
if (requestDto.getForm() == null || requestDto.getForm().equals("온오프라인")) {
return selfUnderstandingsRepository.findByPriceBetween(requestDto.getStartPrice(), endPrice);
}
} else if(requestDto.getForm().equals("온라인")||requestDto.getForm().equals("오프라인"))
return selfUnderstandingsRepository.findByPriceBetweenAndForm(requestDto.getStartPrice(), endPrice, FORM.ofCode(requestDto.getForm()));
else throw new ProgramException(PROGRAM_ENUM_NOT_FOUND);
}

private List<Branding> findBrandingsByFilter(String authorizationHeader, ProgramDto.ProgramBrandingRequestDto requestDto) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
@AllArgsConstructor
public enum FORM {
ONLINE("온라인","ONLINE"),
OFFLINE("오프라인","OFFLINE"),
ALL("온오프라인","ALL");
OFFLINE("오프라인","OFFLINE");

private final String code;
private final String name;
Expand Down

0 comments on commit 0a24016

Please sign in to comment.