-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FEAT] ๋น์ฆ๋์ค ๋ก์ง๊ณผ ์๊ฒฉ ์๋ฆผ ๋ฐ์ก ๋ก์ง ์ฐ๊ฒฐ
- Loading branch information
Showing
12 changed files
with
273 additions
and
35 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
24 changes: 24 additions & 0 deletions
24
src/main/java/com/server/capple/domain/boardSubscribeMember/entity/BoardSubscribeMember.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,24 @@ | ||
package com.server.capple.domain.boardSubscribeMember.entity; | ||
|
||
import com.server.capple.domain.board.entity.Board; | ||
import com.server.capple.domain.member.entity.Member; | ||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
@Getter | ||
@Entity | ||
@AllArgsConstructor | ||
@Builder | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class BoardSubscribeMember { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
@ManyToOne | ||
@JoinColumn(name = "member_id", nullable = false) | ||
private Member member; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "board_id", nullable = false) | ||
private Board board; | ||
} |
13 changes: 13 additions & 0 deletions
13
.../server/capple/domain/boardSubscribeMember/reposiotry/BoardSubscribeMemberRepository.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,13 @@ | ||
package com.server.capple.domain.boardSubscribeMember.reposiotry; | ||
|
||
import com.server.capple.domain.boardSubscribeMember.entity.BoardSubscribeMember; | ||
import com.server.capple.domain.member.entity.Member; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface BoardSubscribeMemberRepository extends JpaRepository<BoardSubscribeMember, Long> { | ||
Boolean existsByMemberIdAndBoardId(Long memberId, Long boardId); | ||
List<BoardSubscribeMember> findBoardSubscribeMembersByBoardId(Long boardId); | ||
void deleteBoardSubscribeMemberByBoardId(Long boardId); | ||
} |
12 changes: 12 additions & 0 deletions
12
...va/com/server/capple/domain/boardSubscribeMember/service/BoardSubscribeMemberService.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,12 @@ | ||
package com.server.capple.domain.boardSubscribeMember.service; | ||
|
||
import com.server.capple.domain.board.entity.Board; | ||
import com.server.capple.domain.member.entity.Member; | ||
|
||
import java.util.List; | ||
|
||
public interface BoardSubscribeMemberService { | ||
void createBoardSubscribeMember(Member member, Board board); | ||
List<Member> findBoardSubscribeMembers(Long boardId); | ||
void deleteBoardSubscribeMemberByBoardId(Long boardId); | ||
} |
33 changes: 33 additions & 0 deletions
33
...om/server/capple/domain/boardSubscribeMember/service/BoardSubscribeMemberServiceImpl.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,33 @@ | ||
package com.server.capple.domain.boardSubscribeMember.service; | ||
|
||
import com.server.capple.domain.board.entity.Board; | ||
import com.server.capple.domain.boardSubscribeMember.entity.BoardSubscribeMember; | ||
import com.server.capple.domain.boardSubscribeMember.reposiotry.BoardSubscribeMemberRepository; | ||
import com.server.capple.domain.member.entity.Member; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class BoardSubscribeMemberServiceImpl implements BoardSubscribeMemberService { | ||
private final BoardSubscribeMemberRepository boardSubscribeMemberRepository; | ||
@Override | ||
public void createBoardSubscribeMember(Member member, Board board) { | ||
if(boardSubscribeMemberRepository.existsByMemberIdAndBoardId(member.getId(), board.getId())) { | ||
return; | ||
} | ||
boardSubscribeMemberRepository.save(BoardSubscribeMember.builder().member(member).board(board).build()); | ||
} | ||
|
||
@Override | ||
public List<Member> findBoardSubscribeMembers(Long boardId) { | ||
return boardSubscribeMemberRepository.findBoardSubscribeMembersByBoardId(boardId).stream().map(BoardSubscribeMember::getMember).toList(); | ||
} | ||
|
||
@Override | ||
public void deleteBoardSubscribeMemberByBoardId(Long boardId) { | ||
boardSubscribeMemberRepository.deleteBoardSubscribeMemberByBoardId(boardId); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/server/capple/domain/notifiaction/entity/NotificationType.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,18 @@ | ||
package com.server.capple.domain.notifiaction.entity; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum NotificationType { | ||
BOARD_HEART("๋๊ตฐ๊ฐ ๋ด ๊ฒ์๊ธ์ ์ข์ํ์ด์", null), | ||
BOARD_COMMENT("๋๊ตฐ๊ฐ ๋ด ๊ฒ์๊ธ์ ๋๊ธ์ ๋ฌ์์ด์", null), | ||
BAORD_COMMENT_DUPLCATE("๋๊ตฐ๊ฐ ๋์ ๊ฐ์ ๊ฒ์๊ธ์ ๋๊ธ์ ๋ฌ์์์", null), | ||
BOARD_COMMENT_HEART("๋๊ตฐ๊ฐ ๋ด ๋๊ธ์ ์ข์ํ์ด์", null), | ||
TODAY_QUESTION_PUBLISHED("์ค๋์ ์ง๋ฌธ", "์ค๋์ ์ง๋ฌธ์ด ์ค๋น ๋์์ด์.\n์ง๊ธ ๋ฐ๋ก ๋ต๋ณํด๋ณด์ธ์."), | ||
TODAY_QUESTION_CLOSED("์ค๋์ ์ง๋ฌธ", "์ค๋์ ์ง๋ฌธ ๋ต๋ณ ์๊ฐ์ด ๋ง๊ฐ๋์์ด์.\n๋ค๋ฅธ ๋ฌ๋๋ค์ ์ด๋ป๊ฒ ๋ต ํ๋์ง ํ์ธํด๋ณด์ธ์."), | ||
; | ||
private final String title; | ||
private final String content; | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/server/capple/domain/notifiaction/service/NotificationService.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,10 @@ | ||
package com.server.capple.domain.notifiaction.service; | ||
|
||
import com.server.capple.domain.board.entity.Board; | ||
import com.server.capple.domain.boardComment.entity.BoardComment; | ||
|
||
public interface NotificationService { | ||
void sendBoardHeartNotification(Long actorId, Board board); | ||
void sendBoardCommentNotification(Long actorId, Board board, BoardComment boardComment); | ||
void sendBoardCommentHeartNotification(Long actorId, Board board, BoardComment boardComment); | ||
} |
Oops, something went wrong.