Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔀 :: (#111) Soft Delete 오류 수정 #112

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
package com.xquare.v1servicefeed.feed.api.impl;

import com.xquare.v1servicefeed.annotation.DomainService;
import com.xquare.v1servicefeed.comment.spi.CommandCommentSpi;
import com.xquare.v1servicefeed.configuration.spi.SecuritySpi;
import com.xquare.v1servicefeed.feed.Category;
import com.xquare.v1servicefeed.feed.CategoryEnum;
import com.xquare.v1servicefeed.feed.Feed;
import com.xquare.v1servicefeed.feed.api.FeedApi;
import com.xquare.v1servicefeed.feed.api.dto.request.DomainCreateFeedRequest;
import com.xquare.v1servicefeed.feed.api.dto.request.DomainUpdateFeedRequest;
import com.xquare.v1servicefeed.feed.api.dto.response.*;
import com.xquare.v1servicefeed.feed.api.dto.response.AuthorityElement;
import com.xquare.v1servicefeed.feed.api.dto.response.FeedCategoryElement;
import com.xquare.v1servicefeed.feed.api.dto.response.FeedCategoryListResponse;
import com.xquare.v1servicefeed.feed.api.dto.response.FeedElement;
import com.xquare.v1servicefeed.feed.api.dto.response.FeedList;
import com.xquare.v1servicefeed.feed.api.dto.response.FeedListPageResponse;
import com.xquare.v1servicefeed.feed.api.dto.response.FeedListResponse;
import com.xquare.v1servicefeed.feed.api.dto.response.FeedPageList;
import com.xquare.v1servicefeed.feed.api.dto.response.FeedWeakElement;
import com.xquare.v1servicefeed.feed.api.dto.response.SaveFeedResponse;
import com.xquare.v1servicefeed.feed.spi.CommandFeedImageSpi;
import com.xquare.v1servicefeed.feed.spi.CommandFeedSpi;
import com.xquare.v1servicefeed.feed.spi.QueryCategorySpi;
Expand All @@ -36,6 +44,9 @@
@DomainService
public class FeedApiImpl implements FeedApi {

private static final String FEED_NOTICE = "FEED_NOTICE";
private static final String CONTENT = "새로운 공지가 등록되었습니다.";
private static final String THREAD_ID = "FEED_NOTICE";
private final CommandFeedSpi commandFeedSpi;
private final FeedUserSpi feedUserSpi;
private final CommandFeedImageSpi commandFeedImageSpi;
Expand All @@ -47,9 +58,6 @@ public class FeedApiImpl implements FeedApi {
private final CommandFeedLikeSpi commandFeedLikeSpi;
private final FeedAuthoritySpi feedAuthoritySpi;
private final NotificationSpi notificationSpi;
private static final String FEED_NOTICE = "FEED_NOTICE";
private static final String CONTENT = "새로운 공지가 등록되었습니다.";
private static final String THREAD_ID = "FEED_NOTICE";

@Override
public SaveFeedResponse saveFeed(DomainCreateFeedRequest request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public void saveComment(Comment comment) {
}

@Override
@Transactional
public void deleteCommentById(UUID commentId) {
CommentEntity comment = getCommentById(commentId);
comment.delete(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public UUID saveFeed(Feed feed) {
}

@Override
@Transactional
public void deleteFeed(Feed feed) {
FeedEntity feedEntity = getFeedEntityById(feed.getId());
feedEntity.delete(true);
Expand All @@ -62,7 +63,7 @@ public Feed queryFeedById(UUID feedId) {
@Override
public FeedPageList queryAllFeedByCategory(UUID categoryId, LocalDateTime time, long limit) {
BooleanBuilder expression = new BooleanBuilder();
if(time != null) expression.and(feedEntity.createdAt.lt(time));
if (time != null) expression.and(feedEntity.createdAt.lt(time));

List<FeedListVO> voList = query
.select(new QFeedListVO(
Expand All @@ -88,16 +89,16 @@ public FeedPageList queryAllFeedByCategory(UUID categoryId, LocalDateTime time,

return new FeedPageList(
voList.stream()
.map(feedListVO -> FeedList.builder()
.feedId(feedListVO.getFeedId())
.userId(feedListVO.getUserId())
.content(feedListVO.getContent())
.authorityType(feedListVO.getAuthorityType())
.createdAt(feedListVO.getCreatedAt())
.likeCount(feedListVO.getLikeCount())
.commentCount(feedListVO.getCommentCount())
.build())
.collect(Collectors.toList())
.map(feedListVO -> FeedList.builder()
.feedId(feedListVO.getFeedId())
.userId(feedListVO.getUserId())
.content(feedListVO.getContent())
.authorityType(feedListVO.getAuthorityType())
.createdAt(feedListVO.getCreatedAt())
.likeCount(feedListVO.getLikeCount())
.commentCount(feedListVO.getCommentCount())
.build())
.collect(Collectors.toList())
);
}

Expand Down
2 changes: 1 addition & 1 deletion feed-infrastructure/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spring:
profiles:
active: ${PROFILE}
config:
import: ${CLOUD_CONFIG_IMPORT_URL:optional:configserver:https://api.xquare.app/cloud-config/}
import: optional:configserver:https://prod-server.xquare.app/cloud-config/
cloud:
config:
username: ${CLOUD_CONFIG_USERNAME}
Expand Down
Loading