-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
๐ :: Api-v0.0.8-1
- Loading branch information
Showing
101 changed files
with
2,132 additions
and
372 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
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
16 changes: 16 additions & 0 deletions
16
...i/src/main/java/band/gosrock/api/comment/model/response/RetrieveCommentCountResponse.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,16 @@ | ||
package band.gosrock.api.comment.model.response; | ||
|
||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class RetrieveCommentCountResponse { | ||
|
||
private final Long commentCounts; | ||
|
||
public static RetrieveCommentCountResponse of(Long commentCounts) { | ||
return RetrieveCommentCountResponse.builder().commentCounts(commentCounts).build(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
.../src/main/java/band/gosrock/api/comment/model/response/RetrieveRandomCommentResponse.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,20 @@ | ||
package band.gosrock.api.comment.model.response; | ||
|
||
|
||
import band.gosrock.domain.common.vo.CommentInfoVo; | ||
import band.gosrock.domain.domains.comment.domain.Comment; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class RetrieveRandomCommentResponse { | ||
|
||
private final CommentInfoVo commentInfo; | ||
|
||
public static RetrieveRandomCommentResponse of(Comment comment) { | ||
return RetrieveRandomCommentResponse.builder() | ||
.commentInfo(comment.toCommentInfoVo()) | ||
.build(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
DuDoong-Api/src/main/java/band/gosrock/api/comment/service/DeleteCommentUseCase.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,33 @@ | ||
package band.gosrock.api.comment.service; | ||
|
||
|
||
import band.gosrock.api.comment.mapper.CommentMapper; | ||
import band.gosrock.api.common.UserUtils; | ||
import band.gosrock.common.annotation.UseCase; | ||
import band.gosrock.domain.domains.comment.domain.Comment; | ||
import band.gosrock.domain.domains.comment.service.CommentDomainService; | ||
import band.gosrock.domain.domains.event.service.EventService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@UseCase | ||
@RequiredArgsConstructor | ||
public class DeleteCommentUseCase { | ||
|
||
private final UserUtils userUtils; | ||
|
||
private final CommentMapper commentMapper; | ||
|
||
private final EventService eventService; | ||
|
||
private final CommentDomainService commentDomainService; | ||
|
||
@Transactional | ||
public void execute(Long eventId, Long commentId) { | ||
Long currentUserId = userUtils.getCurrentUserId(); | ||
// ๊ถํ ๊ฒ์ฌ | ||
eventService.checkEventHost(currentUserId, eventId); | ||
Comment comment = commentMapper.retrieveComment(commentId); | ||
commentDomainService.deleteComment(comment, eventId); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
DuDoong-Api/src/main/java/band/gosrock/api/comment/service/RetrieveCommentCountUseCase.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,29 @@ | ||
package band.gosrock.api.comment.service; | ||
|
||
|
||
import band.gosrock.api.comment.mapper.CommentMapper; | ||
import band.gosrock.api.comment.model.response.RetrieveCommentCountResponse; | ||
import band.gosrock.common.annotation.UseCase; | ||
import band.gosrock.domain.domains.comment.adaptor.CommentAdaptor; | ||
import band.gosrock.domain.domains.event.adaptor.EventAdaptor; | ||
import band.gosrock.domain.domains.event.domain.Event; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@UseCase | ||
@RequiredArgsConstructor | ||
public class RetrieveCommentCountUseCase { | ||
|
||
private final CommentAdaptor commentAdaptor; | ||
|
||
private final CommentMapper commentMapper; | ||
|
||
private final EventAdaptor eventAdaptor; | ||
|
||
@Transactional(readOnly = true) | ||
public RetrieveCommentCountResponse execute(Long eventId) { | ||
Event event = eventAdaptor.findById(eventId); | ||
Long commentCount = commentAdaptor.queryCommentCount(event.getId()); | ||
return commentMapper.toRetrieveCommentCountResponse(commentCount); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
DuDoong-Api/src/main/java/band/gosrock/api/comment/service/RetrieveRandomCommentUseCase.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 band.gosrock.api.comment.service; | ||
|
||
|
||
import band.gosrock.api.comment.mapper.CommentMapper; | ||
import band.gosrock.api.comment.model.response.RetrieveRandomCommentResponse; | ||
import band.gosrock.common.annotation.UseCase; | ||
import band.gosrock.domain.domains.comment.adaptor.CommentAdaptor; | ||
import band.gosrock.domain.domains.comment.domain.Comment; | ||
import band.gosrock.domain.domains.event.adaptor.EventAdaptor; | ||
import band.gosrock.domain.domains.event.domain.Event; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@UseCase | ||
@RequiredArgsConstructor | ||
public class RetrieveRandomCommentUseCase { | ||
|
||
private final CommentAdaptor commentAdaptor; | ||
|
||
private final CommentMapper commentMapper; | ||
|
||
private final EventAdaptor eventAdaptor; | ||
|
||
@Transactional(readOnly = true) | ||
public RetrieveRandomCommentResponse execute(Long eventId) { | ||
Event event = eventAdaptor.findById(eventId); | ||
Comment comment = commentAdaptor.queryRandomComment(event.getId()); | ||
return commentMapper.toRetrieveRandomCommentResponse(comment); | ||
} | ||
} |
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
Oops, something went wrong.