Skip to content

Commit

Permalink
Merge pull request #193 from SMU-SATTO/feature/#192
Browse files Browse the repository at this point in the history
[Bug] 회원 탈퇴, 시간표 관련 외래키 문제
  • Loading branch information
HyunwooYi authored Sep 3, 2024
2 parents 10d97cc + 4ec00d7 commit 754cf1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.example.satto.domain.currentLecture.entity.CurrentLecture;
import com.example.satto.domain.timeTable.entity.TimeTable;
import com.example.satto.domain.timeTableLecture.entity.TimeTableLecture;
import com.example.satto.domain.users.entity.Users;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
Expand Down Expand Up @@ -31,4 +32,6 @@ TimeTableLecture findTimeTableLectureByTimeTableIdAndCodeSection(@Param("timeTab
@Modifying
@Query("delete from TimeTableLecture l where l.timeTable.timetableId = :timeTableId")
void deleteByTimeTableId(@Param("timeTableId") Long timeTableId);

void deleteAllByTimeTable_Users(Users user);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.example.satto.domain.follow.repository.FollowRepository;
import com.example.satto.domain.mail.dto.EmailRequestDTO;
import com.example.satto.domain.timeTable.repository.TimeTableRepository;
import com.example.satto.domain.timeTableLecture.repository.TimeTableLectureRepository;
import com.example.satto.domain.users.dto.UsersRequestDTO;
import com.example.satto.domain.users.entity.Users;
import com.example.satto.domain.users.repository.UsersRepository;
Expand Down Expand Up @@ -32,6 +33,7 @@ public class UsersServiceImpl implements UsersService {
private final FollowRepository followRepository;
private final PasswordEncoder passwordEncoder;
private final TimeTableRepository timeTableRepository;
private final TimeTableLectureRepository timeTableLectureRepository;
private final UuidRepository uuidRepository;
private final S3Manager s3Manager;
private final S3Config s3Config;
Expand Down Expand Up @@ -173,6 +175,7 @@ public boolean nicknameDuplicate(String nickname) {
public void withdrawal(Users user) {
followRepository.deleteByFollowingId(user);
followRepository.deleteByFollowerId(user);
timeTableLectureRepository.deleteAllByTimeTable_Users(user);
timeTableRepository.deleteAllByUsers(user);
usersRepository.deleteById(user.getUserId());
}
Expand Down

0 comments on commit 754cf1f

Please sign in to comment.