Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d8345fa
refactor: Feed 폴더 구조 변경
jbh010204 Dec 3, 2025
d75eae2
feat: FeedService를 command와 query로 분리
jbh010204 Dec 3, 2025
291ae9a
refactor: feed 도메인 내 어그레이트 약한 참조 관계로 변경
jbh010204 Dec 3, 2025
b30480a
refactor: Feed관련 DTO에서 사용하지 않는 메서드 삭제
jbh010204 Dec 3, 2025
7553103
refactor: Feed수정에 맞춰 테스트 변경
jbh010204 Dec 3, 2025
eb862fa
feat: FeedComment 약결합 분리 및 CQRS 패턴으로 변경
jbh010204 Dec 3, 2025
deec9d0
feat: FeedCommand 포트 확장
jbh010204 Dec 3, 2025
f80d05c
feat: FeedCommand 도메인 + 서비스 CQRS 분리
jbh010204 Dec 3, 2025
4a37258
feat: 댓글 조회시 필요한 유저 정보를 위해 UserData 포트/어댑터 추가
jbh010204 Dec 3, 2025
4179e1e
refactor: Feed와 FeedComment 느슨한 형태로 분리
jbh010204 Dec 4, 2025
76b8763
refactor: FeedResult 폴더 구조 Command의 DTO 위치로 변경
jbh010204 Dec 9, 2025
4b37f15
refactor: FeedQueryService 불필요한 트랜잭션 어노테이션 제거
jbh010204 Dec 9, 2025
f5971ef
feat: UserSnapshot DTO renamed to UserSnapShot and updated references
jbh010204 Dec 9, 2025
fb40dd7
refactor: FeedComment의 comment필드를 content로 명칭변경
jbh010204 Dec 9, 2025
ff62a4e
feat: rename FeedComment Aggregate to Comment
jbh010204 Dec 9, 2025
af6d726
feat: Feed 수정&삭제 기능 구현
jbh010204 Dec 9, 2025
0a43147
feat: Feed 통합 테스트 구현 및 단위 테스트 command용으로 분리
jbh010204 Dec 9, 2025
6065adb
Merge remote-tracking branch 'origin/develop' into feat/#35
jbh010204 Dec 9, 2025
fb1caef
docs: Feed 및 Comment Swaggeer 작성
jbh010204 Dec 9, 2025
7926140
refactor: test내부 클래스 stub 외부로 구조 변경
jbh010204 Dec 10, 2025
e7eebd9
refactor: User와 Profile 간접 참조 형태로 분리 및 연관된 코드 변경
jbh010204 Dec 12, 2025
d3a9022
feat: Replace UserDataPort with ProfileDataPort for user profile hand…
jbh010204 Dec 12, 2025
4367844
refactor: Rename entity from 'feed_comments' to 'comments' for clarity
jbh010204 Dec 12, 2025
c6aa091
refactor: ProfileSnapShot domain 패키지 구조로 이동
jbh010204 Dec 13, 2025
79cdea3
Merge remote-tracking branch 'origin/develop' into feat/#35
jbh010204 Dec 13, 2025
a37f38d
refactor: 피드 검증을 위한 FeedValidationPort and adapter 도입
jbh010204 Dec 13, 2025
2a54f69
refactor: author validation in Feed 도메인 내부 로직으로 변경
jbh010204 Dec 13, 2025
f2d6792
refactor: DB 스키마 변경에 따른 SQL feed_comments to comments 으로 변경
jbh010204 Dec 13, 2025
43a92c5
refactor: validation adapters의 스테레오타입을 Component로 변경
jbh010204 Dec 13, 2025
44ba7dd
refactor: ProfileJpaRepository 추가 및 프로필 저장 로직 구현
jbh010204 Dec 13, 2025
94e485b
fix : comments 객체와 다르게 구성된 sql문 수정
polyglot-k Dec 14, 2025
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
Empty file modified gradlew
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

@Repository
@RequiredArgsConstructor
public class CommunityCommandAdaptor
implements CommunityCommandPort, com.example.bak.feed.application.port.CommunityCommandPort {
public class CommunityCommandAdaptor implements CommunityCommandPort {

private final CommunityJpaRepository communityJpaRepository;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.bak.community.infra.command;

import com.example.bak.feed.application.command.port.CommunityValidationPort;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

@Repository
@RequiredArgsConstructor
public class CommunityValidationAdapter implements CommunityValidationPort {

private final CommunityJpaRepository communityJpaRepository;

@Override
public boolean isCommunityExists(Long communityId) {
return communityJpaRepository.existsById(communityId);
}
}
68 changes: 0 additions & 68 deletions src/main/java/com/example/bak/feed/application/FeedService.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.example.bak.feed.application.command;

import com.example.bak.feed.application.command.port.CommunityValidationPort;
import com.example.bak.feed.application.command.port.FeedCommandPort;
import com.example.bak.feed.application.query.dto.FeedResult;
import com.example.bak.feed.domain.Feed;
import com.example.bak.global.exception.BusinessException;
import com.example.bak.global.exception.ErrorCode;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
@Transactional
public class FeedCommandService {

private final FeedCommandPort feedCommandPort;
private final CommunityValidationPort communityValidationPort;

public FeedResult createFeed(String title, String content, Long communityId, Long userId) {

if (!communityValidationPort.isCommunityExists(communityId)) {
throw new BusinessException(ErrorCode.COMMUNITY_NOT_FOUND);
}

Feed newFeed = Feed.create(title, content, communityId, userId);
Feed savedFeed = feedCommandPort.save(newFeed);

return FeedResult.of(savedFeed.getId());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.example.bak.feed.application.command.port;

public interface CommunityValidationPort {

boolean isCommunityExists(Long communityId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.bak.feed.application.command.port;

import com.example.bak.feed.domain.Feed;
import java.util.Optional;

public interface FeedCommandPort {

Feed save(Feed feed);

Optional<Feed> findById(Long id);
}
30 changes: 0 additions & 30 deletions src/main/java/com/example/bak/feed/application/dto/FeedDetail.java

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.example.bak.feed.application.query;

import com.example.bak.feed.application.query.dto.FeedDetail;
import com.example.bak.feed.application.query.dto.FeedSummary;
import com.example.bak.feed.application.query.port.FeedQueryPort;
import com.example.bak.global.exception.BusinessException;
import com.example.bak.global.exception.ErrorCode;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
public class FeedQueryService {

private final FeedQueryPort feedQueryPort;

@Transactional(readOnly = true)
public FeedDetail getFeedDetail(Long feedId) {
return feedQueryPort.findDetailById(feedId)
.orElseThrow(() -> new BusinessException(ErrorCode.FEED_NOT_FOUND));
}

@Transactional(readOnly = true)
public FeedSummary getFeedSummary(Long feedId) {
return feedQueryPort.findSummaryById(feedId)
.orElseThrow(() -> new BusinessException(ErrorCode.FEED_NOT_FOUND));
}

@Transactional(readOnly = true)
public List<FeedSummary> getFeeds(int page, int size) {
Pageable pageable = PageRequest.of(page, size);
Page<FeedSummary> feedPage = feedQueryPort.findAll(pageable);
return feedPage.getContent();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example.bak.feed.application.query.dto;

import com.example.bak.community.application.query.dto.CommunityResult;
import com.example.bak.user.application.dto.UserInfo;

/**
* Feed 도메인의 상세 정보를 담는 DTO 단건 조회 시 사용
*/
public record FeedDetail(
Long id,
String title,
String content,
UserInfo author,
CommunityResult.Detail community
) {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.bak.feed.application.dto;
package com.example.bak.feed.application.query.dto;

public record FeedResult(
Long id
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example.bak.feed.application.query.dto;

import com.example.bak.community.application.query.dto.CommunityResult;
import com.example.bak.user.application.dto.UserInfo;

/**
* Feed 도메인의 간단한 정보를 담는 DTO 목록 조회 시 사용
*/
public record FeedSummary(
Long id,
String title,
UserInfo author,
CommunityResult.Detail community,
int commentCount
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example.bak.feed.application.query.port;

import com.example.bak.feed.application.query.dto.FeedDetail;
import com.example.bak.feed.application.query.dto.FeedSummary;
import java.util.Optional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

public interface FeedQueryPort {

Page<FeedSummary> findAll(Pageable pageable);

Optional<FeedSummary> findSummaryById(Long feedId);

Optional<FeedDetail> findDetailById(Long feedId);
}
Loading