Skip to content

Commit

Permalink
Merge pull request #273 from IoTeaTime/develop
Browse files Browse the repository at this point in the history
release: 서버 배포
  • Loading branch information
seok019283501 authored Dec 11, 2024
2 parents aba75aa + 755ee6a commit 27e7844
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.ioteatime.meonghanyangserver.groupmember.dto.response.GroupMemberResponse;
import org.ioteatime.meonghanyangserver.groupmember.mapper.GroupMemberResponseMapper;
import org.ioteatime.meonghanyangserver.groupmember.repository.GroupMemberRepository;
import org.ioteatime.meonghanyangserver.image.repository.ImageRepository;
import org.ioteatime.meonghanyangserver.member.domain.MemberEntity;
import org.ioteatime.meonghanyangserver.member.repository.MemberRepository;
import org.springframework.stereotype.Service;
Expand All @@ -33,6 +34,7 @@ public class GroupMemberService {
private final MemberRepository memberRepository;
private final GroupMemberRepository groupMemberRepository;
private final KvsChannelNameGenerator kvsChannelNameGenerator;
private final ImageRepository imageRepository;

@Transactional
public void joinGroupMember(Long memberId, JoinGroupMemberRequest joinGroupMemberRequest) {
Expand Down Expand Up @@ -128,6 +130,7 @@ public void deleteGroupMember(Long memberId, Long groupId) {
// 방장 퇴장
groupMemberRepository.deleteByGroupId(groupId);
cctvRepository.deleteByGroupId(groupId);
imageRepository.deleteByGroupId(groupId);
groupRepository.deleteById(groupId);
} else {
// 참여자 퇴장
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
import java.time.LocalDateTime;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.ioteatime.meonghanyangserver.group.domain.GroupEntity;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@Getter
@Entity
@NoArgsConstructor
@Table(name = "image")
@EntityListeners(AuditingEntityListener.class)
public class ImageEntity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
import org.ioteatime.meonghanyangserver.image.domain.ImageEntity;
import org.springframework.data.jpa.repository.JpaRepository;

public interface ImageJpaRepository extends JpaRepository<ImageEntity, Long> {}
public interface ImageJpaRepository extends JpaRepository<ImageEntity, Long> {
void deleteByGroupId(Long groupId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ public interface ImageRepository {
List<ImageResponse> findAllByGroupIdAndDate(Long groupId, LocalDateTime searchDate);

ImageEntity save(ImageEntity imageEntity);

void deleteByGroupId(Long groupId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@ public List<ImageResponse> findAllByGroupIdAndDate(Long groupId, LocalDateTime s
public ImageEntity save(ImageEntity imageEntity) {
return imageJpaRepository.save(imageEntity);
}

@Override
public void deleteByGroupId(Long groupId) {
imageJpaRepository.deleteByGroupId(groupId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.ioteatime.meonghanyangserver.groupmember.doamin.GroupMemberEntity;
import org.ioteatime.meonghanyangserver.groupmember.doamin.enums.GroupMemberRole;
import org.ioteatime.meonghanyangserver.groupmember.repository.GroupMemberRepository;
import org.ioteatime.meonghanyangserver.image.repository.ImageRepository;
import org.ioteatime.meonghanyangserver.member.domain.MemberEntity;
import org.ioteatime.meonghanyangserver.member.dto.request.ChangePasswordRequest;
import org.ioteatime.meonghanyangserver.member.dto.request.UpdateNicknameAndGroupNameRequest;
Expand Down Expand Up @@ -55,6 +56,7 @@ public class MemberService {
private final GroupMemberRepository groupMemberRepository;
private final RefreshTokenRepository refreshTokenRepository;
private final AccessTokenRepository accessTokenRepository;
private final ImageRepository imageRepository;

public MemberWithGroupDetailResponse getMemberDetail(Long memberId) {
MemberEntity memberEntity =
Expand Down Expand Up @@ -114,6 +116,10 @@ public void deleteMember(String authHeader, Long memberId) {
cctvRepository.deleteByGroupId(groupId);
log.info("[방장 회원 탈퇴] {}", "GroupId 기준으로 CCTV 목록을 삭제하였습니다.");

// Image 목록 삭제
imageRepository.deleteByGroupId(groupId);
log.info("[방장 회원 탈퇴] {}", "GroupId 기준으로 Image 목록을 삭제하였습니다.");

// GroupId 기준으로 groupMember 모두 찾아 삭제
groupMemberRepository.deleteAllByGroupId(groupId);
log.info("[방장 회원 탈퇴] {}", "GroupId 기준으로 GroupMember를 모두 삭제하였습니다.");
Expand Down

0 comments on commit 27e7844

Please sign in to comment.