Skip to content

Commit

Permalink
refactor: modify api with university certification status (#152)
Browse files Browse the repository at this point in the history
* refactor(team): remove college student authentication conditions from team creation conditions

* refactor: add emailAuthenticated data to response

* chore: add openapi
  • Loading branch information
Chaerim1001 authored Sep 28, 2023
1 parent edb39a0 commit 022ea65
Show file tree
Hide file tree
Showing 21 changed files with 880 additions and 848 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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 @@ -73,7 +74,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 @@ -79,7 +79,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 @@ -204,10 +205,65 @@ 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")
));
}

// 보낸 미팅 신청 조회
@Override
public List<SentMeetingResponseDto> findSentRequestList(final Long memberId) {
List<MeetingRequestInformationDto> meetingRequestList = selectMeetingRequestInformationDto()
.from(meetingRequest)
// My Team & Partner Team
.join(meetingRequest.team, team).on(team.deletedAt.isNull())
.join(meetingRequest.partnerTeam, partnerTeam)
// Me & Partner Team Leader
.join(team.teamLeader, member)
.join(partnerTeam.teamLeader, partnerTeamLeader)
// Partner Team Leader College
.join(partnerTeamLeader.collegeInfo.collegeCode, code)
.where(
member.memberId.eq(memberId),
member.deletedAt.isNull()
)
.fetch();

return meetingRequestList.stream()
.map(meetingRequestInformation -> SentMeetingResponseDto.of(
meetingRequestInformation,
findTeamProfileImageUrl(meetingRequestInformation.getTeamId())
))
.toList();
}

// 받은 미팅 신청 조회
@Override
public List<ReceivedMeetingResponseDto> findReceiveRequestList(final Long memberId) {
List<MeetingRequestInformationDto> meetingReceivedList = selectMeetingRequestInformationDto()
.from(meetingRequest)
// PartnerTeam == RequestReceivedTeam == My Team
.join(meetingRequest.team, partnerTeam)
.join(meetingRequest.partnerTeam, team).on(team.deletedAt.isNull())
// Me & Partner Team Leader
.join(team.teamLeader, member)
.join(partnerTeam.teamLeader, partnerTeamLeader)
// Partner Team Leader College
.join(partnerTeamLeader.collegeInfo.collegeCode, code)
.where(
member.memberId.eq(memberId),
member.deletedAt.isNull()
)
.fetch();

return meetingReceivedList.stream()
.map(meetingRequestInformation -> ReceivedMeetingResponseDto.of(
meetingRequestInformation,
findTeamProfileImageUrl(meetingRequestInformation.getTeamId())
))
.toList();
}

private JPAQuery<MeetingRequestInformationDto> selectMeetingRequestInformationDto() {
return queryFactory.select(
new QMeetingRequestInformationDto(
Expand All @@ -226,7 +282,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 @@ -221,11 +220,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 @@ -49,7 +49,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 @@ -105,7 +106,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

0 comments on commit 022ea65

Please sign in to comment.