-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
다음과 같은 상황이 발생할 때 당사자에게 알림이 가도록 만든다.
- 유저 작성 게시글에 댓글이 달릴 경우
- 유저 작성 댓글에 대댓글이 달릴 경우
- 타유저가 유저를 팔로할 경우
- 유저가 뱃지를 획득했을 경우
Progress
- DB 구조 변경: comment, follow, badge 테이블의 PK를 FK를 갖도록 변경한다.
-
Notification관련 Doman, Controller, Service, Dao, Mapper 파일을 만든다.
알림 생성 및 저장
- 특정 상황이 발생했을 때 해당하는 알림을 생성하여 저장하도록 각 Service를 변경한다. 이때 트랜잭션 처리도 함께 해준다.
-
CommentService:add() -
FollowService:add() -
CollectService:add()
-
- NotificationMapper의 insert 쿼리 작성
<insert id="insert" parameterType="notification">
insert into noti(type, cno, fwer_no, bno, uno)
values(#{type}, #{comment.no}, #{follower.no}, #{badge.no},
<choose>
<when test="comment == null">
#{userNo}
</when>
<otherwise>
<if test="type==1">
(select a.writer from comment c inner join article a on a.arno = c.arno where c.cno = #{comment.no})
</if>
<if test="type==2">
(select c.uno from comment c inner join comment c2 on c.momno = c2.cno where c.cno = #{comment.no})
</if>
</otherwise>
</choose>
)
</insert>알림 목록 출력
- Model:
NotificatinoDao.findAll(),NotiifcationService.list() - Controller:
NotificationController.list() - View
Trouble Shooting
DB 구조 변경
Comment가 달린 게시글/댓글 작성자 찾는 문제
현재 시간으로부터 얼마나 지났는지 정보 출력
기존 코드
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
