Skip to content

Commit

Permalink
#66 [feat] 글 조회 서비스 로직 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
parkheeddong committed Jan 11, 2024
1 parent 12fad51 commit 3fe998a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public enum SuccessMessage {
POST_DELETE_SUCCESS(HttpStatus.OK.value(), "글 삭제가 완료되었습니다."),
CATEGORY_LIST_SEARCH_SUCCESS(HttpStatus.OK.value(), "카테고리 리스트 조회가 완료되었습니다."),
MOIM_TOPIC_GET_SUCCESS(HttpStatus.OK.value(), "글감 조회가 완료되었습니다."),
POST_GET_SUCCESS(HttpStatus.OK.value(), "글 조회가 완료되었습니다."),
/*
201 CREATED
*/
Expand Down
13 changes: 13 additions & 0 deletions module-domain/src/main/java/com/mile/post/service/PostService.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
import com.mile.curious.serivce.dto.CuriousInfoResponse;
import com.mile.exception.message.ErrorMessage;
import com.mile.exception.model.NotFoundException;
import com.mile.moim.domain.Moim;
import com.mile.post.domain.Post;
import com.mile.post.repository.PostRepository;
import com.mile.post.service.dto.CommentCreateRequest;
import com.mile.post.service.dto.CommentListResponse;
import com.mile.post.service.dto.PostGetResponse;
import com.mile.post.service.dto.PostPutRequest;
import com.mile.post.service.dto.WriterAuthenticateResponse;
import com.mile.topic.domain.Topic;
import com.mile.topic.serivce.TopicService;
import com.mile.user.service.UserService;
import com.mile.writerName.domain.WriterName;
import com.mile.writerName.serivce.WriterNameService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -148,9 +151,19 @@ private void deleteRelatedData(
curiousService.deleteAllByPost(post);
commentService.deleteAllByPost(post);
}

private void deleteS3File(
final String key
) {
s3Service.deleteImage(key);
}

@Transactional(readOnly = true)
public PostGetResponse getPost(
final Long postId
) {
Post post = findById(postId);
Moim moim = post.getTopic().getMoim();
return PostGetResponse.of(post, moim);
}
}

0 comments on commit 3fe998a

Please sign in to comment.