-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat/#71 포토부스 찜 API 추가 & 수정
- Loading branch information
Showing
12 changed files
with
160 additions
and
4 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
9 changes: 9 additions & 0 deletions
9
domain/src/main/java/com/pocket/domain/port/photobooth/PhotoBoothCheckLikePort.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.pocket.domain.port.photobooth; | ||
|
||
import com.pocket.domain.entity.photobooth.PhotoBooth; | ||
|
||
public interface PhotoBoothCheckLikePort { | ||
|
||
Boolean checkLike(Long photoBoothId, String userEmail); | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
domain/src/main/java/com/pocket/domain/port/photobooth/PhotoBoothDeleteLikePort.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.pocket.domain.port.photobooth; | ||
|
||
import com.pocket.domain.entity.photobooth.PhotoBooth; | ||
|
||
public interface PhotoBoothDeleteLikePort { | ||
|
||
void deleteLike(Long photoBoothId, String userEmail); | ||
|
||
} |
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
7 changes: 7 additions & 0 deletions
7
domain/src/main/java/com/pocket/domain/usecase/photobooth/PhotoBoothCheckLikeUseCase.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,7 @@ | ||
package com.pocket.domain.usecase.photobooth; | ||
|
||
public interface PhotoBoothCheckLikeUseCase { | ||
|
||
Boolean checkLike(Long photoBoothId, String userEmail); | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
domain/src/main/java/com/pocket/domain/usecase/photobooth/PhotoBoothDeleteLikeUseCase.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,7 @@ | ||
package com.pocket.domain.usecase.photobooth; | ||
|
||
public interface PhotoBoothDeleteLikeUseCase { | ||
|
||
void deleteLike(Long photoBoothId, String userEmail); | ||
|
||
} |
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
23 changes: 23 additions & 0 deletions
23
.../main/java/com/pocket/outbound/adapter/photobooth/adapter/PhotoBoothCheckLikeAdapter.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,23 @@ | ||
package com.pocket.outbound.adapter.photobooth.adapter; | ||
|
||
import com.pocket.core.aop.annotation.AdapterService; | ||
import com.pocket.domain.port.photobooth.PhotoBoothCheckLikePort; | ||
import com.pocket.outbound.entity.photobooth.JpaLike; | ||
import com.pocket.outbound.repository.photobooth.LikeRepository; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.Optional; | ||
|
||
|
||
@AdapterService | ||
@RequiredArgsConstructor | ||
public class PhotoBoothCheckLikeAdapter implements PhotoBoothCheckLikePort { | ||
|
||
private final LikeRepository likeRepository; | ||
|
||
@Override | ||
public Boolean checkLike(Long photoBoothId, String userEmail) { | ||
return likeRepository.findByUser_UserEmailAndPhotoBooth_Id(userEmail, photoBoothId).isPresent(); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...main/java/com/pocket/outbound/adapter/photobooth/adapter/PhotoBoothDeleteLikeAdapter.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,30 @@ | ||
package com.pocket.outbound.adapter.photobooth.adapter; | ||
|
||
import com.pocket.core.aop.annotation.AdapterService; | ||
import com.pocket.core.exception.photobooth.PhotoBoothCustomException; | ||
import com.pocket.core.exception.photobooth.PhotoBoothErrorCode; | ||
import com.pocket.domain.port.photobooth.PhotoBoothDeleteLikePort; | ||
import com.pocket.outbound.entity.photobooth.JpaLike; | ||
import com.pocket.outbound.repository.photobooth.LikeRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.Optional; | ||
|
||
@AdapterService | ||
@RequiredArgsConstructor | ||
public class PhotoBoothDeleteLikeAdapter implements PhotoBoothDeleteLikePort { | ||
|
||
private final LikeRepository likeRepository; | ||
|
||
@Override | ||
@Transactional | ||
public void deleteLike(Long photoBoothId, String userEmail) { | ||
Optional<JpaLike> entity = likeRepository.findByUser_UserEmailAndPhotoBooth_Id(userEmail, photoBoothId); | ||
if (entity.isPresent()) { | ||
likeRepository.delete(entity.get()); | ||
} else { | ||
throw new PhotoBoothCustomException(PhotoBoothErrorCode.PHOTOBOOTHLIKE_NOT_FOUND); | ||
} | ||
} | ||
} |
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