-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FIX] 탈퇴 시 안건 후보로 등록된 사진 삭제 불가 이슈 해결
- Loading branch information
Showing
11 changed files
with
73 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,8 @@ public void delete() { | |
} | ||
super.delete(); | ||
} | ||
|
||
public void nullifyPhoto() { | ||
this.photo = null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/com/umc/naoman/domain/photo/service/PhotoQueryService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.umc.naoman.domain.photo.service; | ||
|
||
import com.umc.naoman.domain.member.entity.Member; | ||
import com.umc.naoman.domain.photo.entity.Photo; | ||
|
||
public interface PhotoQueryService { | ||
Photo findPhoto(Long photoId); | ||
boolean hasSamplePhoto(Member member); | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/umc/naoman/domain/photo/service/PhotoQueryServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.umc.naoman.domain.photo.service; | ||
|
||
import com.umc.naoman.domain.member.entity.Member; | ||
import com.umc.naoman.domain.photo.entity.Photo; | ||
import com.umc.naoman.domain.photo.repository.PhotoRepository; | ||
import com.umc.naoman.domain.photo.repository.SamplePhotoRepository; | ||
import com.umc.naoman.global.error.BusinessException; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import static com.umc.naoman.global.error.code.S3ErrorCode.PHOTO_NOT_FOUND; | ||
|
||
@Service | ||
@Transactional(readOnly = true) | ||
@RequiredArgsConstructor | ||
public class PhotoQueryServiceImpl implements PhotoQueryService { | ||
private final PhotoRepository photoRepository; | ||
private final SamplePhotoRepository samplePhotoRepository; | ||
|
||
@Override | ||
public Photo findPhoto(Long photoId) { | ||
return photoRepository.findById(photoId) | ||
.orElseThrow(() -> new BusinessException(PHOTO_NOT_FOUND)); | ||
} | ||
|
||
@Override | ||
public boolean hasSamplePhoto(Member member) { | ||
return samplePhotoRepository.existsByMemberId(member.getId()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters