-
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.
Merge pull request #90 from YAPP-Github/feat/ISSUE-84
feat: Carpool close API
- Loading branch information
Showing
14 changed files
with
202 additions
and
30 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
18 changes: 18 additions & 0 deletions
18
src/main/java/com/fullcar/carpool/domain/form/FormMessage.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.fullcar.carpool.domain.form; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum FormMessage { | ||
REJECT_MESSAGE("카풀 매칭에 실패했어요. 다른 카풀을 찾아보세요!"), | ||
REQUEST_TITLE("탑승 요청이 들어왔어요!"), | ||
REQUEST_BODY("탑승자 정보를 확인하고 승인해 주세요🚘"), | ||
ACCEPT_TITLE("카풀 매칭에 성공했어요!"), | ||
ACCEPT_BODY("운전자 정보를 확인해 주세요🚘"), | ||
REJECT_TITLE("카풀 매칭에 실패했어요."), | ||
REJECT_BODY("다른 카풀을 찾아볼까요?💁🏻♀️"); | ||
|
||
private final String message; | ||
} |
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
src/main/java/com/fullcar/carpool/domain/form/event/FormStateChangedEvent.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,11 @@ | ||
package com.fullcar.carpool.domain.form.event; | ||
|
||
import com.fullcar.carpool.infra.dto.NotificationDto; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class FormStateChangedEvent { | ||
private NotificationDto notificationDto; | ||
} |
3 changes: 2 additions & 1 deletion
3
src/main/java/com/fullcar/carpool/domain/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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package com.fullcar.carpool.domain.service; | ||
|
||
import com.fullcar.carpool.infra.dto.NotificationDto; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Transactional | ||
public interface NotificationService { | ||
void sendNotification(String nickname, String deviceToken, String title, String body); | ||
void sendNotification(NotificationDto notificationDto); | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/main/java/com/fullcar/carpool/infra/dto/NotificationDto.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,17 @@ | ||
package com.fullcar.carpool.infra.dto; | ||
|
||
import lombok.*; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor(access = AccessLevel.PROTECTED) | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class NotificationDto { | ||
private String nickName; | ||
|
||
private String deviceToken; | ||
|
||
private String title; | ||
|
||
private String body; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/fullcar/carpool/infra/event/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,11 @@ | ||
package com.fullcar.carpool.infra.event; | ||
|
||
import com.fullcar.carpool.infra.dto.NotificationDto; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class NotificationEvent { | ||
private NotificationDto notificationDto; | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/fullcar/carpool/infra/event/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,26 @@ | ||
package com.fullcar.carpool.infra.event; | ||
|
||
import com.fullcar.carpool.domain.form.event.FormStateChangedEvent; | ||
import com.fullcar.carpool.domain.service.NotificationService; | ||
import com.fullcar.carpool.infra.dto.NotificationDto; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.context.event.EventListener; | ||
import org.springframework.scheduling.annotation.Async; | ||
import org.springframework.scheduling.annotation.EnableAsync; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Component | ||
@RequiredArgsConstructor | ||
@EnableAsync | ||
public class NotificationEventListener { | ||
private final NotificationService notificationService; | ||
|
||
@Async | ||
@EventListener | ||
public void sendNotification(FormStateChangedEvent formStateChangedEvent) { | ||
notificationService.sendNotification(formStateChangedEvent.getNotificationDto()); | ||
log.info("Notification send"); | ||
} | ||
} |
Oops, something went wrong.