-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
86 additions
and
68 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
52 changes: 52 additions & 0 deletions
52
dateroad-api/src/main/java/org/dateroad/point/event/MessageDto.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,52 @@ | ||
package org.dateroad.point.event; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import org.dateroad.course.dto.request.PointUseReq; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class MessageDto { | ||
@Builder | ||
public static class PointMessageDTO { | ||
private final String userId; | ||
private final String point; | ||
private final String type; | ||
private final String description; | ||
|
||
public static PointMessageDTO of(Long userId, PointUseReq pointUseReq) { | ||
return PointMessageDTO.builder() | ||
.userId(userId.toString()) | ||
.point(String.valueOf(pointUseReq.getPoint())) | ||
.description(pointUseReq.getDescription()) | ||
.type(pointUseReq.getType().name()).build(); | ||
} | ||
|
||
public Map<String, String> toMap() { | ||
Map<String, String> fieldMap = new HashMap<>(); | ||
fieldMap.put("userId", userId); | ||
fieldMap.put("point", point); | ||
fieldMap.put("type", type); | ||
fieldMap.put("description", description); | ||
return fieldMap; | ||
} | ||
} | ||
|
||
@Builder | ||
@AllArgsConstructor | ||
public static class FreeMessageDTO { | ||
private final String userId; | ||
public static FreeMessageDTO of(Long userId) { | ||
return FreeMessageDTO.builder().userId(userId.toString()).build(); | ||
} | ||
|
||
public Map<String, String> toMap() { | ||
Map<String, String> fieldMap = new HashMap<>(); | ||
fieldMap.put("userId", userId); | ||
return fieldMap; | ||
} | ||
} | ||
} |