-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: config 설정 * feat: FcmMessage 전송 형태 추가 - https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/send?hl=ko#request-body * feat: FcmMessageSender 구현 * feat: 물주기 수행 시 NotificationEvents 발행 * feat: Notification 이벤트를 받아 메시지 전송 수행 * refactor: 로그인 RequestBody로 변경 * refactor: target -> device * test: 로그인 테스트 수정 * refactor: API 명세 롤백 * feat: 사용자 알림 구독/취소 기능 추가 * feat: Admin 알림 전송기능 추가 * build: config 파일 최신화 * refactor: 코드 포맷팅 * test: 어드민 페이지 테스트 수정 * test: 테스트 및 문서 보완 * chore: 불필요 컨트롤러 삭제 * build: device_token 컬럼 추가 * refactor: NotificationEvent builder로 수정 * refactor: 미사용 ObjectMapper 제거 * style: 개행 추가 * test: memberSupport 적용 * test: fcm 패키지 분리 * refactor: member에 isSubscribe 추가 * chore: 어드민 사용자 페이지 제목 변경 * refactor: NotificationSubscribeRequest NotNull 검증조건 추가 * refactor: 알림을 구독하고있을 때 구독요청하면 예외 * refactor: 알림 구독 해지 시 Ok로 응답 변경 * refactor: NotificationEvent NotNull 추가 * test: 테스트 클래스의 public 제거 * test: 물주기 알림 대상 식물 조회 테스트 추가 * test: 알림 구독 취소 응답값 변경 * test: 알림 구독/취소 예외 테스트 추가 * refactor: 어드민 알림 전송 요청 검증 추가 * refactor: 알림 전송 이벤트 비동기처리 * style: import * 수정 (컨벤션)
- Loading branch information
1 parent
f2a80f9
commit 2e06d47
Showing
47 changed files
with
899 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
== 사용자(Member) | ||
|
||
=== 로그인 | ||
|
||
==== Request | ||
|
||
include::{snippets}/auth/login/http-request.adoc[] | ||
|
||
==== Response | ||
|
||
include::{snippets}/auth/login/http-response.adoc[] | ||
|
||
=== 로그아웃 | ||
|
||
==== Request | ||
|
||
include::{snippets}/auth/logout/http-request.adoc[] | ||
|
||
==== Response | ||
|
||
include::{snippets}/auth/logout/http-response.adoc[] | ||
|
||
=== 세션확인 | ||
|
||
==== Request | ||
|
||
include::{snippets}/member/checkSession/http-request.adoc[] | ||
|
||
==== Response | ||
|
||
include::{snippets}/member/checkSession/http-response.adoc[] | ||
|
||
=== 회원탈퇴 | ||
|
||
==== Request | ||
|
||
include::{snippets}/member/withdraw/http-request.adoc[] | ||
|
||
==== Response | ||
|
||
include::{snippets}/member/withdraw/http-response.adoc[] | ||
|
||
=== 알림구독 | ||
|
||
==== Request | ||
|
||
include::{snippets}/member/subscribeNotification/http-request.adoc[] | ||
|
||
==== Response | ||
|
||
include::{snippets}/member/subscribeNotification/http-response.adoc[] | ||
|
||
=== 알림구독해지 | ||
|
||
==== Request | ||
|
||
include::{snippets}/member/unSubscribeNotification/http-request.adoc[] | ||
|
||
==== Response | ||
|
||
include::{snippets}/member/unSubscribeNotification/http-response.adoc[] | ||
|
||
=== 알림 구독상태 확인 | ||
|
||
==== Request | ||
|
||
include::{snippets}/member/checkNotification/http-request.adoc[] | ||
|
||
==== Response | ||
|
||
include::{snippets}/member/checkNotification/http-response.adoc[] | ||
include::{snippets}/member/checkNotification/response-body.adoc[] |
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
backend/pium/src/main/java/com/official/pium/admin/dto/AdminSendNotificationRequest.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.official.pium.admin.dto; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Builder | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class AdminSendNotificationRequest { | ||
|
||
@NotNull | ||
private String deviceToken; | ||
|
||
@NotNull | ||
private String title; | ||
|
||
@NotNull | ||
private String body; | ||
} |
9 changes: 9 additions & 0 deletions
9
backend/pium/src/main/java/com/official/pium/config/ScheduleConfig.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,9 @@ | ||
package com.official.pium.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.annotation.EnableScheduling; | ||
|
||
@Configuration | ||
@EnableScheduling | ||
public class ScheduleConfig { | ||
} |
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
backend/pium/src/main/java/com/official/pium/event/notification/NotificationEvent.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.official.pium.event.notification; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.validation.annotation.Validated; | ||
|
||
@Getter | ||
@Builder | ||
@Validated | ||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class NotificationEvent { | ||
|
||
@NotNull | ||
private final String deviceToken; | ||
|
||
@NotNull | ||
private final String title; | ||
|
||
@NotNull | ||
private final String body; | ||
} |
23 changes: 23 additions & 0 deletions
23
...nd/pium/src/main/java/com/official/pium/event/notification/NotificationEventListener.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,23 @@ | ||
package com.official.pium.event.notification; | ||
|
||
import com.official.pium.service.NotificationService; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.event.EventListener; | ||
import org.springframework.scheduling.annotation.*; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class NotificationEventListener { | ||
|
||
private final NotificationService notificationService; | ||
|
||
@EventListener | ||
@Async | ||
public void handleNotificationEvents(List<NotificationEvent> notificationEvent) { | ||
for (NotificationEvent event : notificationEvent) { | ||
notificationService.sendNotification(event.getDeviceToken(), event.getTitle(), event.getBody()); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
backend/pium/src/main/java/com/official/pium/fcm/dto/FcmMessageResponse.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,34 @@ | ||
package com.official.pium.fcm.dto; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@Builder | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class FcmMessageResponse { | ||
|
||
private boolean validate_only; | ||
private Message message; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public static class Message { | ||
private Notification notification; | ||
private String token; | ||
} | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public static class Notification { | ||
private String title; | ||
private String body; | ||
private String image; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
backend/pium/src/main/java/com/official/pium/fcm/exception/FcmException.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,14 @@ | ||
package com.official.pium.fcm.exception; | ||
|
||
public class FcmException extends RuntimeException { | ||
|
||
public FcmException(String message) { | ||
super(message); | ||
} | ||
|
||
public static class FcmMessageSendException extends FcmException { | ||
public FcmMessageSendException(String message) { | ||
super(message); | ||
} | ||
} | ||
} |
Oops, something went wrong.