-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Feat] 회원 탈퇴 구현 #74
base: develop
Are you sure you want to change the base?
[Feat] 회원 탈퇴 구현 #74
Changes from 1 commit
6b29533
c352da0
583694c
c97368a
5e5e0a6
c315923
4af4b54
1ee3df5
7bfcdb5
b7e9089
16b185d
ccf2eda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,13 @@ | |
import org.springframework.stereotype.Component; | ||
|
||
import idorm.idormServer.calendar.application.port.out.DeleteSleepoverCalendarPort; | ||
import idorm.idormServer.calendar.application.port.out.DeleteTeamCalendarPort; | ||
import idorm.idormServer.calendar.application.port.out.DeleteTeamMemberPort; | ||
import idorm.idormServer.calendar.application.port.out.DeleteTeamPort; | ||
import idorm.idormServer.calendar.application.port.out.LoadTeamCalendarPort; | ||
import idorm.idormServer.calendar.application.port.out.LoadTeamPort; | ||
import idorm.idormServer.calendar.entity.Team; | ||
import idorm.idormServer.calendar.entity.TeamCalendar; | ||
import idorm.idormServer.member.application.port.out.LoadMemberPort; | ||
import idorm.idormServer.member.entity.Member; | ||
import lombok.AccessLevel; | ||
import lombok.RequiredArgsConstructor; | ||
|
@@ -23,25 +23,27 @@ public class DeleteTeamMemberAdapter implements DeleteTeamMemberPort { | |
private final LoadTeamPort loadTeamPort; | ||
private final DeleteTeamPort deleteTeamPort; | ||
|
||
private final LoadMemberPort loadMemberPort; | ||
|
||
private final LoadTeamCalendarPort loadTeamCalendarPort; | ||
private final DeleteTeamCalendarPort deleteTeamCalendarPort; | ||
|
||
private final DeleteSleepoverCalendarPort deleteSleepoverCalendarPort; | ||
|
||
@Override | ||
public void deleteTeamMember(Long memberId) { | ||
final Member member = loadMemberPort.loadMember(memberId); | ||
public void deleteTeamMember(Member member) { | ||
final Team team = loadTeamPort.findByMemberId(member.getId()); | ||
final List<TeamCalendar> teamCalendars = loadTeamCalendarPort.findByMemberId(member.getId()); | ||
|
||
team.deleteMember(member); | ||
if (team.getMembers().isEmpty()) { | ||
deleteTeamPort.delete(team); | ||
} else { | ||
deleteSleepoverCalendarPort.deleteByMemberId(memberId); | ||
deleteSleepoverCalendarPort.deleteByMemberId(member.getId()); | ||
teamCalendars | ||
.forEach(teamCalendar -> teamCalendar.deletePariticipant(member.getId())); | ||
.forEach(teamCalendar -> { | ||
teamCalendar.deletePariticipant(member.getId()); | ||
if (teamCalendar.getParticipants().isEmpty()) | ||
deleteTeamCalendarPort.delete(teamCalendar); | ||
}); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 해당 부분은 제 쪽에서는 예외가 터지지 않아 문제 원인을 제대로 파악하지 못 하고 있습니다.. 그러나 해당 부분의 예외는 teamCalendar의 participant에 memberId가 없을 경우에 예외가 발생할 수 있는데, 팀캘린더를 participant와 조인하여 조회하기 때문에 예외가 발생할 가능성이 거의 없다고 생각됩니다.. 그렇지만 예외가 발생한 원인을 명확하게 파악하기위해 계속해서 분석하겠습니다! 혹시 원인 파악에 도움이 될만한 정보가 있다면 공유 해주시면 감사하겠습니다! |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package idorm.idormServer.calendar.application.port.out; | ||
|
||
import idorm.idormServer.member.entity.Member; | ||
|
||
public interface DeleteTeamMemberPort { | ||
void deleteTeamMember(final Long memberId); | ||
void deleteTeamMember(final Member member); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
팀에 회원이 한 명 남았을 때 teamStatus가 변경되어야 합니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
팀 도메인의 deleteMember() 내에 처리되어 있습니다!