Skip to content

Commit

Permalink
orphanRemoval 설정 추가 및 이메일 링크 수정 (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddongpuri authored Nov 30, 2023
1 parent 17fc3d3 commit 82cb0f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public class EmailInfoGenerator {

public static EmailInfo createMentorApprovalMail(Mentor mentor) {
String[] to = {mentor.getEmail()};
Map<String, Object> attributes = Map.of("link", BASE_URL + "/mypage");
Map<String, Object> attributes = Map.of("link", BASE_URL);

return new EmailInfo(to, MENTOR_APPROVED, attributes);
}

public static EmailInfo createEventCreationMail(List<Mentee> mentees, EventNoticeInfo eventCreationInfo) {
List<String> menteeList = mentees.stream().map(Mentee::getEmail).toList();
String[] to = menteeList.toArray(new String[menteeList.size()]);
Map<String, Object> attributes = Map.of("link", BASE_URL + "/event/view/" + eventCreationInfo.eventId(), "mentorNickname", eventCreationInfo.mentorNickname());
Map<String, Object> attributes = Map.of("link", BASE_URL + "/event/" + eventCreationInfo.eventId(), "mentorNickname", eventCreationInfo.mentorNickname());

return new EmailInfo(to, EVENT_CREATED, attributes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class Mentor extends BaseEntity {
private String refreshToken;

@Getter
@OneToMany(fetch = LAZY, mappedBy = "mentor", cascade = {CascadeType.PERSIST, CascadeType.REMOVE})
@OneToMany(fetch = LAZY, mappedBy = "mentor", cascade = {CascadeType.PERSIST, CascadeType.REMOVE}, orphanRemoval = true)
private Set<MentorPosition> experiencedPositions = new HashSet<>();

@Getter
Expand Down Expand Up @@ -122,7 +122,7 @@ public boolean isApproved() {
}

public void updateInfos(MentorInfoUpdateRequest updateRequest) {
validateInputs(email, provider, imageUrl, requiredInfo,updateRequest.experiencedPositions(), updateRequest.careerContent(), updateRequest.careerYear(), updateRequest.introduce());
validateInputs(email, provider, imageUrl, requiredInfo, updateRequest.experiencedPositions(), updateRequest.careerContent(), updateRequest.careerYear(), updateRequest.introduce());
this.clearPositions();
this.requiredInfo.updateNickname(updateRequest.nickname());
this.requiredInfo.updatePhoneNumber(updateRequest.phoneNumber());
Expand All @@ -147,4 +147,5 @@ public Role getRole() {
public String getNickname() {
return requiredInfo.getNickname();
}

}

0 comments on commit 82cb0f2

Please sign in to comment.