-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad98174
commit b7904fd
Showing
19 changed files
with
167 additions
and
51 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
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
60 changes: 60 additions & 0 deletions
60
...m/depromeet/breadmapbackend/domain/notice/factory/push/CommunityCommentNoticeFactory.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,60 @@ | ||
package com.depromeet.breadmapbackend.domain.notice.factory.push; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import com.depromeet.breadmapbackend.domain.notice.Notice; | ||
import com.depromeet.breadmapbackend.domain.notice.dto.NoticeEventDto; | ||
import com.depromeet.breadmapbackend.domain.notice.factory.NoticeType; | ||
import com.depromeet.breadmapbackend.domain.post.Post; | ||
import com.depromeet.breadmapbackend.domain.post.PostRepository; | ||
import com.depromeet.breadmapbackend.domain.user.User; | ||
import com.depromeet.breadmapbackend.domain.user.UserRepository; | ||
import com.depromeet.breadmapbackend.global.exception.DaedongException; | ||
import com.depromeet.breadmapbackend.global.exception.DaedongStatus; | ||
import com.depromeet.breadmapbackend.global.infra.properties.CustomAWSS3Properties; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class CommunityCommentNoticeFactory implements NoticeFactory { | ||
|
||
private static final String COMMENT_TITLE_FORMAT = "댓글 알림"; | ||
private static final String COMMENT_CONTENT_FORMAT = "내 게시글에 %s님이 댓글을 달았어요!"; | ||
private static final NoticeType SUPPORT_TYPE = NoticeType.REVIEW_COMMENT; | ||
private final CustomAWSS3Properties customAwss3Properties; | ||
private final UserRepository userRepository; | ||
private final PostRepository postRepository; | ||
|
||
@Override | ||
public boolean support(final NoticeType noticeType) { | ||
return SUPPORT_TYPE == noticeType; | ||
} | ||
|
||
@Override | ||
public String getImage(final Notice notice) { | ||
return customAwss3Properties.getCloudFront() + "/" + | ||
customAwss3Properties.getDefaultImage().getComment() | ||
+ ".png"; | ||
} | ||
|
||
@Override | ||
public List<Notice> createNotice(final NoticeEventDto noticeEventDto) { | ||
|
||
final Post post = postRepository.findById(noticeEventDto.contentId()) | ||
.orElseThrow(() -> new DaedongException(DaedongStatus.REVIEW_NOT_FOUND)); | ||
final User fromUser = userRepository.findById(noticeEventDto.userId()) | ||
.orElseThrow(() -> new DaedongException(DaedongStatus.USER_NOT_FOUND)); | ||
|
||
return List.of(Notice.createNoticeWithContent( | ||
post.getUser(), | ||
COMMENT_TITLE_FORMAT, | ||
noticeEventDto.contentId(), | ||
COMMENT_CONTENT_FORMAT, | ||
fromUser.getNickName(), | ||
noticeEventDto.noticeType() | ||
)); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
.../com/depromeet/breadmapbackend/domain/notice/factory/push/CommunityLikeNoticeFactory.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,58 @@ | ||
package com.depromeet.breadmapbackend.domain.notice.factory.push; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import com.depromeet.breadmapbackend.domain.notice.Notice; | ||
import com.depromeet.breadmapbackend.domain.notice.dto.NoticeEventDto; | ||
import com.depromeet.breadmapbackend.domain.notice.factory.NoticeType; | ||
import com.depromeet.breadmapbackend.domain.post.Post; | ||
import com.depromeet.breadmapbackend.domain.post.PostRepository; | ||
import com.depromeet.breadmapbackend.domain.user.User; | ||
import com.depromeet.breadmapbackend.domain.user.UserRepository; | ||
import com.depromeet.breadmapbackend.global.exception.DaedongException; | ||
import com.depromeet.breadmapbackend.global.exception.DaedongStatus; | ||
import com.depromeet.breadmapbackend.global.infra.properties.CustomAWSS3Properties; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class CommunityLikeNoticeFactory implements NoticeFactory { | ||
private static final String COMMUNITY_CONTENT_FORMAT = "내 게시글을 %s님이 좋아해요!"; | ||
private static final String COMMUNITY_TITLE_FORMAT = "좋아요 알림"; | ||
private static final NoticeType SUPPORT_TYPE = NoticeType.COMMUNITY_LIKE; | ||
private final CustomAWSS3Properties customAwss3Properties; | ||
private final UserRepository userRepository; | ||
private final PostRepository postRepository; | ||
|
||
@Override | ||
public boolean support(final NoticeType noticeType) { | ||
return SUPPORT_TYPE == noticeType; | ||
} | ||
|
||
@Override | ||
public String getImage(final Notice notice) { | ||
return customAwss3Properties.getCloudFront() + "/" + | ||
customAwss3Properties.getDefaultImage().getLike() | ||
+ ".png"; | ||
} | ||
|
||
@Override | ||
public List<Notice> createNotice(final NoticeEventDto noticeEventDto) { | ||
final Post post = postRepository.findById(noticeEventDto.contentId()) | ||
.orElseThrow(() -> new DaedongException(DaedongStatus.POST_NOT_FOUND)); | ||
final User fromUser = userRepository.findById(noticeEventDto.userId()) | ||
.orElseThrow(() -> new DaedongException(DaedongStatus.USER_NOT_FOUND)); | ||
|
||
return List.of(Notice.createNoticeWithContent( | ||
post.getUser(), | ||
COMMUNITY_TITLE_FORMAT, | ||
noticeEventDto.contentId(), | ||
COMMUNITY_CONTENT_FORMAT, | ||
fromUser.getNickName(), | ||
noticeEventDto.noticeType() | ||
)); | ||
} | ||
} |
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
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.