-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: 피드 도메인 이벤트에 작성된 피드 내용 데이터 추가 FeedResponse, FeedImageResponse 사용 * refactor: SSE용 이벤트 변환시 db조회 제거
- Loading branch information
Showing
6 changed files
with
90 additions
and
81 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
11 changes: 11 additions & 0 deletions
11
backend/src/main/java/team/teamby/teambyteam/feed/application/dto/FeedImageResponse.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 |
---|---|---|
@@ -1,9 +1,20 @@ | ||
package team.teamby.teambyteam.feed.application.dto; | ||
|
||
import team.teamby.teambyteam.feed.domain.image.FeedThreadImage; | ||
|
||
public record FeedImageResponse( | ||
Long id, | ||
Boolean isExpired, | ||
String name, | ||
String url | ||
) { | ||
|
||
public static FeedImageResponse from(final FeedThreadImage feedThreadImage) { | ||
return new FeedImageResponse( | ||
feedThreadImage.getId(), | ||
feedThreadImage.isExpired(), | ||
feedThreadImage.getImageName().getValue(), | ||
feedThreadImage.getImageUrl().getValue() | ||
); | ||
} | ||
} |
17 changes: 15 additions & 2 deletions
17
backend/src/main/java/team/teamby/teambyteam/feed/application/event/FeedEvent.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 |
---|---|---|
@@ -1,16 +1,29 @@ | ||
package team.teamby.teambyteam.feed.application.event; | ||
|
||
import team.teamby.teambyteam.common.domain.DomainEvent; | ||
import team.teamby.teambyteam.feed.application.dto.FeedResponse; | ||
|
||
public class FeedEvent implements DomainEvent<Long> { | ||
private final Long feedId; | ||
private final Long teamPlaceId; | ||
private final FeedResponse response; | ||
|
||
public FeedEvent(final Long feedId) { | ||
this.feedId = feedId; | ||
public FeedEvent(final FeedResponse response, final Long teamPlaceId) { | ||
this.feedId = response.id(); | ||
this.response = response; | ||
this.teamPlaceId = teamPlaceId; | ||
} | ||
|
||
@Override | ||
public Long getDomainId() { | ||
return feedId; | ||
} | ||
|
||
public FeedResponse response() { | ||
return response; | ||
} | ||
|
||
public Long getTeamPlaceId() { | ||
return teamPlaceId; | ||
} | ||
} |
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