Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: modify api with university certification status #152

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public List<HeartTeamData> findSentHeart(Long teamId,
member.mbti,
member.profileImage.basicUrl.as("profileImageUrl"),
member.collegeInfo.collegeCode.codeValue.as("college"),
member.collegeInfo.admissionYear.as("admissionYear")
member.collegeInfo.admissionYear.as("admissionYear"),
member.email.isNotNull().as("emailAuthenticated")
)))
.from(heart)
.join(team).on(heart.team.teamId.eq(team.teamId))
Expand Down Expand Up @@ -65,7 +66,8 @@ public List<HeartTeamData> findReceivedHeart(Long teamId,
Projections.constructor(TeamLeaderData.class, member.nickname, member.mbti,
member.profileImage.basicUrl.as("profileImageUrl"),
member.collegeInfo.collegeCode.codeValue.as("college"),
member.collegeInfo.admissionYear.as("admissionYear"))))
member.collegeInfo.admissionYear.as("admissionYear"),
member.email.isNotNull().as("emailAuthenticated"))))
.from(heart)
.join(team).on(heart.partnerTeam.teamId.eq(team.teamId))
.join(heart.team.teamLeader, member)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public List<AcceptedMeetingResponseDto> findAcceptedMeetingList(final Long membe
.map(meetingInformation -> AcceptedMeetingResponseDto.of(
meetingInformation, findTeamProfileImageUrl(meetingInformation.getTeamId())
))
.sorted(Comparator.comparing(AcceptedMeetingResponseDto::getMeetingAcceptTime).reversed())
.sorted(
Comparator.comparing(AcceptedMeetingResponseDto::getMeetingAcceptTime).reversed())
.toList();
}

Expand Down Expand Up @@ -133,7 +134,8 @@ private JPAQuery<MeetingInformationDto> selectMeetingInformationDto() {
code.codeValue.as("partnerLeaderCollegeName"),
partnerTeamLeader.collegeInfo.collegeType.as("partnerLeaderCollegeType"),
partnerTeamLeader.collegeInfo.admissionYear.as("partnerLeaderAdmissionYear"),
partnerTeamLeader.profileImage.imageAuth.as("partnerLeaderImageAuth")
partnerTeamLeader.profileImage.imageAuth.as("partnerLeaderImageAuth"),
partnerTeamLeader.email.isNotNull().as("emailAuthenticated")
));
}

Expand All @@ -158,7 +160,8 @@ public List<SentMeetingResponseDto> findSentRequestList(final Long memberId) {

return meetingRequestList.stream()
.map(meetingRequestInformation -> SentMeetingResponseDto.of(
meetingRequestInformation, findTeamProfileImageUrl(meetingRequestInformation.getTeamId())
meetingRequestInformation,
findTeamProfileImageUrl(meetingRequestInformation.getTeamId())
))
.toList();
}
Expand All @@ -184,7 +187,8 @@ public List<ReceivedMeetingResponseDto> findReceiveRequestList(final Long member

return meetingReceivedList.stream()
.map(meetingRequestInformation -> ReceivedMeetingResponseDto.of(
meetingRequestInformation, findTeamProfileImageUrl(meetingRequestInformation.getTeamId())
meetingRequestInformation,
findTeamProfileImageUrl(meetingRequestInformation.getTeamId())
))
.toList();
}
Expand All @@ -207,7 +211,8 @@ private JPAQuery<MeetingRequestInformationDto> selectMeetingRequestInformationDt
code.codeValue.as("partnerLeaderCollegeName"),
partnerTeamLeader.collegeInfo.collegeType.as("partnerLeaderCollegeType"),
partnerTeamLeader.collegeInfo.admissionYear.as("partnerLeaderAdmissionYear"),
partnerTeamLeader.profileImage.imageAuth.as("partnerLeaderImageAuth")
partnerTeamLeader.profileImage.imageAuth.as("partnerLeaderImageAuth"),
partnerTeamLeader.email.isNotNull().as("emailAuthenticated")
));
}

Expand Down
7 changes: 1 addition & 6 deletions src/main/java/com/e2i/wemeet/domain/member/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.e2i.wemeet.exception.badrequest.TeamNotExistsException;
import com.e2i.wemeet.exception.unauthorized.CreditNotEnoughException;
import com.e2i.wemeet.exception.unauthorized.UnAuthorizedRoleException;
import com.e2i.wemeet.exception.unauthorized.UnAuthorizedUnivException;
import com.e2i.wemeet.util.validator.CustomFormatValidator;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
Expand Down Expand Up @@ -210,11 +209,7 @@ public void validateTeamCreation() {
if (this.team.stream().anyMatch(t -> t.getDeletedAt() == null)) {
throw new TeamExistsException();
}

if (!isEmailAuthenticated()) {
throw new UnAuthorizedUnivException();
}


if (!isProfileImageExists()) {
throw new ProfileImageNotExistsException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public Optional<LeaderResponseDto> findLeaderByTeamId(final Long teamId) {
member.collegeInfo.collegeType.as("collegeType"),
member.collegeInfo.admissionYear,
member.profileImage.lowUrl.as("leaderLowProfileImageUrl"),
member.profileImage.imageAuth.as("imageAuth")
member.profileImage.imageAuth.as("imageAuth"),
member.email.isNotNull().as("emailAuthenticated")
)
)
.from(team)
Expand All @@ -64,7 +65,8 @@ public Optional<LeaderResponseDto> findLeaderByTeamId(final Long teamId) {
}

@Override
public Optional<TeamInformationDto> findTeamInformationByTeamId(final Long memberLeaderId, final Long teamId, final LocalDateTime readTime) {
public Optional<TeamInformationDto> findTeamInformationByTeamId(final Long memberLeaderId,
final Long teamId, final LocalDateTime readTime) {
com.e2i.wemeet.domain.team.QTeam myTeam = new com.e2i.wemeet.domain.team.QTeam("myTeam");
TeamInformationDto teamInformationDto = Optional.ofNullable(queryFactory
.select(Projections.constructor(TeamInformationDto.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public record TeamLeaderData(
Mbti mbti,
String profileImageUrl,
String college,
String admissionYear
String admissionYear,
Boolean emailAuthenticated
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public List<SuggestionTeamData> findSuggestionTeamForUser(Long memberId, Gender
Projections.constructor(TeamLeaderData.class, member.nickname, member.mbti,
member.profileImage.lowUrl.as("profileImageUrl"),
member.collegeInfo.collegeCode.codeValue.as("college"),
member.collegeInfo.admissionYear.as("admissionYear"))
member.collegeInfo.admissionYear.as("admissionYear"),
member.email.isNotNull().as("emailAuthenticated"))
)
)
.from(team)
Expand Down Expand Up @@ -90,7 +91,8 @@ public List<SuggestionHistoryData> findSuggestionHistoryTeam(Long memberId,
Projections.constructor(TeamLeaderData.class, member.nickname, member.mbti,
member.profileImage.lowUrl.as("profileImageUrl"),
member.collegeInfo.collegeCode.codeValue.as("college"),
member.collegeInfo.admissionYear.as("admissionYear"))
member.collegeInfo.admissionYear.as("admissionYear"),
member.email.isNotNull().as("emailAuthenticated"))
)
)
.from(history)
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/com/e2i/wemeet/dto/dsl/MeetingInformationDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ public class MeetingInformationDto {
private CollegeType partnerLeaderCollegeType;
private String partnerLeaderAdmissionYear;
private Boolean partnerLeaderImageAuth;
private Boolean emailAuthenticated;

@QueryProjection
public MeetingInformationDto(Long meetingId, LocalDateTime meetingAcceptTime, boolean isOver, LocalDateTime deletedAt, Long teamId,
public MeetingInformationDto(Long meetingId, LocalDateTime meetingAcceptTime, boolean isOver,
LocalDateTime deletedAt, Long teamId,
int memberCount,
Region region, Long partnerLeaderId, String partnerLeaderNickname, Mbti partnerLeaderMbti, String partnerLeaderLowProfileUrl,
String partnerLeaderCollegeName, CollegeType partnerLeaderCollegeType, String partnerLeaderAdmissionYear, Boolean partnerLeaderImageAuth) {
Region region, Long partnerLeaderId, String partnerLeaderNickname, Mbti partnerLeaderMbti,
String partnerLeaderLowProfileUrl,
String partnerLeaderCollegeName, CollegeType partnerLeaderCollegeType,
String partnerLeaderAdmissionYear, Boolean partnerLeaderImageAuth,
Boolean emailAuthenticated) {
this.meetingId = meetingId;
this.meetingAcceptTime = meetingAcceptTime;
this.isOver = isOver;
Expand All @@ -49,6 +54,7 @@ public MeetingInformationDto(Long meetingId, LocalDateTime meetingAcceptTime, bo
this.partnerLeaderCollegeType = partnerLeaderCollegeType;
this.partnerLeaderAdmissionYear = partnerLeaderAdmissionYear;
this.partnerLeaderImageAuth = partnerLeaderImageAuth;
this.emailAuthenticated = emailAuthenticated;
}

public boolean isOver() {
Expand All @@ -70,6 +76,7 @@ public String toString() {
", partnerLeaderMbti=" + partnerLeaderMbti +
", partnerLeaderLowProfileUrl='" + partnerLeaderLowProfileUrl + '\'' +
", partnerLeaderCollegeName='" + partnerLeaderCollegeName + '\'' +
", emailAuthenticated='" + emailAuthenticated + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ public class MeetingRequestInformationDto {
private CollegeType partnerLeaderCollegeType;
private String partnerLeaderAdmissionYear;
private Boolean partnerLeaderImageAuth;
private Boolean emailAuthenticated;

@QueryProjection
public MeetingRequestInformationDto(Long meetingRequestId, LocalDateTime requestSentTime, String message, AcceptStatus acceptStatus, Long teamId,
int memberCount, Region region, LocalDateTime deletedAt, Long partnerLeaderId, String partnerLeaderNickname, Mbti partnerLeaderMbti,
String partnerLeaderLowProfileUrl, String partnerLeaderCollegeName, CollegeType partnerLeaderCollegeType, String partnerLeaderAdmissionYear,
Boolean partnerLeaderImageAuth) {
public MeetingRequestInformationDto(Long meetingRequestId, LocalDateTime requestSentTime,
String message, AcceptStatus acceptStatus, Long teamId,
int memberCount, Region region, LocalDateTime deletedAt, Long partnerLeaderId,
String partnerLeaderNickname, Mbti partnerLeaderMbti,
String partnerLeaderLowProfileUrl, String partnerLeaderCollegeName,
CollegeType partnerLeaderCollegeType, String partnerLeaderAdmissionYear,
Boolean partnerLeaderImageAuth, Boolean emailAuthenticated) {
this.meetingRequestId = meetingRequestId;
this.requestSentTime = requestSentTime;
this.message = message;
Expand All @@ -52,6 +56,7 @@ public MeetingRequestInformationDto(Long meetingRequestId, LocalDateTime request
this.partnerLeaderCollegeType = partnerLeaderCollegeType;
this.partnerLeaderAdmissionYear = partnerLeaderAdmissionYear;
this.partnerLeaderImageAuth = partnerLeaderImageAuth;
this.emailAuthenticated = emailAuthenticated;
}

@Override
Expand All @@ -68,6 +73,7 @@ public String toString() {
", partnerLeaderMbti=" + partnerLeaderMbti +
", partnerLeaderLowProfileUrl='" + partnerLeaderLowProfileUrl + '\'' +
", partnerLeaderCollegeName='" + partnerLeaderCollegeName + '\'' +
", emailAuthenticated='" + emailAuthenticated + '\'' +
'}';
}

Expand Down
16 changes: 11 additions & 5 deletions src/main/java/com/e2i/wemeet/dto/response/LeaderResponseDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public record LeaderResponseDto(
CollegeType collegeType,
String admissionYear,
String leaderLowProfileImageUrl,
Boolean imageAuth
Boolean imageAuth,
Boolean emailAuthenticated

) {

Expand All @@ -27,7 +28,8 @@ public static LeaderResponseDto of(final Member leader) {
leader.getCollegeInfo().getCollegeType(),
leader.getCollegeInfo().getAdmissionYear(),
leader.getProfileImage().getLowUrl(),
leader.getProfileImage().getImageAuth()
leader.getProfileImage().getImageAuth(),
(leader.getEmail() != null)
);
}

Expand All @@ -40,11 +42,13 @@ public static LeaderResponseDto of(final MeetingInformationDto meetingInformatio
meetingInformationDto.getPartnerLeaderCollegeType(),
meetingInformationDto.getPartnerLeaderAdmissionYear(),
meetingInformationDto.getPartnerLeaderLowProfileUrl(),
meetingInformationDto.getPartnerLeaderImageAuth()
meetingInformationDto.getPartnerLeaderImageAuth(),
meetingInformationDto.getEmailAuthenticated()
);
}

public static LeaderResponseDto of(final MeetingRequestInformationDto meetingRequestInformationDto) {
public static LeaderResponseDto of(
final MeetingRequestInformationDto meetingRequestInformationDto) {
return new LeaderResponseDto(
meetingRequestInformationDto.getPartnerLeaderId(),
meetingRequestInformationDto.getPartnerLeaderNickname(),
Expand All @@ -53,7 +57,8 @@ public static LeaderResponseDto of(final MeetingRequestInformationDto meetingReq
meetingRequestInformationDto.getPartnerLeaderCollegeType(),
meetingRequestInformationDto.getPartnerLeaderAdmissionYear(),
meetingRequestInformationDto.getPartnerLeaderLowProfileUrl(),
meetingRequestInformationDto.getPartnerLeaderImageAuth()
meetingRequestInformationDto.getPartnerLeaderImageAuth(),
meetingRequestInformationDto.getEmailAuthenticated()
);
}

Expand All @@ -68,6 +73,7 @@ public String toString() {
", admissionYear='" + admissionYear + '\'' +
", leaderLowProfileImageUrl='" + leaderLowProfileImageUrl + '\'' +
", imageAuth=" + imageAuth +
", emailAuthentication=" + emailAuthenticated +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public record MemberDetailResponseDto(
String collegeType,
String admissionYear,
ProfileImageResponseDto profileImage,
Boolean authUnivStatus
Boolean emailAuthenticated
) {

public static MemberDetailResponseDto of(final Member member, final String college) {
Expand All @@ -28,7 +28,7 @@ public static MemberDetailResponseDto of(final Member member, final String colle
.collegeType(member.getCollegeInfo().getCollegeType().getDescription())
.admissionYear(member.getCollegeInfo().getAdmissionYear())
.profileImage(profileImage)
.authUnivStatus(member.getEmail() != null)
.emailAuthenticated(member.getEmail() != null)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static SuggestionResponseDto of(SuggestionTeamData data) {
.nickname(data.teamLeader().nickname())
.mbti(data.teamLeader().mbti().name())
.admissionYear(data.teamLeader().admissionYear())
.emailAuthenticated(data.teamLeader().emailAuthenticated())
.build()
).build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public record TeamLeaderResponseDto(
String nickname,
String mbti,
String college,
String admissionYear
String admissionYear,
Boolean emailAuthenticated
) {

public static TeamLeaderResponseDto of(TeamLeaderData data) {
Expand All @@ -17,6 +18,7 @@ public static TeamLeaderResponseDto of(TeamLeaderData data) {
.mbti(data.mbti().name())
.college(data.college())
.admissionYear(data.admissionYear())
.emailAuthenticated(data.emailAuthenticated())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public static MyTeamDetailResponseDto of(Team team, List<TeamImageData> teamImag
.nickname(teamLeader.getNickname())
.mbti(teamLeader.getMbti().name())
.college(teamLeader.getCollegeInfo().getCollegeCode().getCodeValue())
.admissionYear(teamLeader.getCollegeInfo().getAdmissionYear()).build()
.admissionYear(teamLeader.getCollegeInfo().getAdmissionYear())
.emailAuthenticated(teamLeader.getEmail() != null)
.build()
)
.images(
teamImages.stream()
Expand Down
Loading