Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.List;

import static com.kustacks.kuring.message.application.service.FirebaseSubscribeService.ACADEMIC_EVENT_TOPIC;
import static com.kustacks.kuring.message.domain.MessageType.ACADEMIC;

@Slf4j
@UseCase
Expand Down Expand Up @@ -99,7 +100,7 @@ private Message makeMessage(String title, String body) {
.setTopic(serverProperties.ifDevThenAddSuffix(ACADEMIC_EVENT_TOPIC))
.putData("title", title)
.putData("body", body)
.putData("messageType", "academic")
.putData("messageType", ACADEMIC.getValue())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

import static com.kustacks.kuring.message.application.service.FirebaseSubscribeService.ACADEMIC_EVENT_TOPIC;
import static com.kustacks.kuring.message.application.service.FirebaseSubscribeService.ALL_DEVICE_SUBSCRIBED_TOPIC;
import static com.kustacks.kuring.message.domain.MessageType.ACADEMIC;
import static com.kustacks.kuring.message.domain.MessageType.ADMIN;
import static com.kustacks.kuring.message.domain.MessageType.NOTICE;

@Slf4j
@UseCase
Expand Down Expand Up @@ -76,7 +79,7 @@ public void sendAcademicTestNotification(AcademicTestNotificationCommand command
"title", command.title(),
"body", command.body()
))
.putData("messageType", "academic")
.putData("messageType", ACADEMIC.getValue())
.setTopic(serverProperties.addDevSuffix(ACADEMIC_EVENT_TOPIC))
.build();

Expand Down Expand Up @@ -152,7 +155,7 @@ private Message createMessageFromCommand(AdminNotificationCommand command) {
.setBody(command.body())
.build())
.putAllData(objectMapper.convertValue(command, Map.class))
.putData("messageType", "admin")
.putData("messageType", ADMIN.getValue())
.setTopic(serverProperties.ifDevThenAddSuffix(ALL_DEVICE_SUBSCRIBED_TOPIC))
.build();
}
Expand All @@ -165,7 +168,7 @@ private Message createMessageFromDto(NoticeMessageDto messageDto, UnaryOperator<
.setBody(messageDto.getSubject())
.build())
.putAllData(objectMapper.convertValue(messageDto, Map.class))
.putData("messageType", "notice")
.putData("messageType", NOTICE.getValue())
.setTopic(suffixUtil.apply(messageDto.getCategory()))
.build();
}
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/kustacks/kuring/message/domain/MessageType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.kustacks.kuring.message.domain;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum MessageType {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enum화 하여 관리하시는점 좋습니다!!


NOTICE("notice"),
ADMIN("admin"),
ACADEMIC("academic");

private final String value;
}