-
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.
- Loading branch information
1 parent
ea96689
commit 616631f
Showing
3 changed files
with
79 additions
and
0 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
39 changes: 39 additions & 0 deletions
39
src/main/java/com/sajang/devracebackend/dto/chat/ChatSaveRequestDto.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,39 @@ | ||
package com.sajang.devracebackend.dto.chat; | ||
|
||
import com.sajang.devracebackend.domain.Chat; | ||
import com.sajang.devracebackend.domain.enums.MessageType; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class ChatSaveRequestDto { | ||
|
||
// cannot NULL | ||
@NotNull(message = "ERROR - roomId cannot be NULL") | ||
private Long roomId; | ||
@NotNull(message = "ERROR - senderId cannot be NULL") | ||
private Long senderId; // 첫 입장때는 방장 userId로. | ||
@NotNull(message = "ERROR - messageType cannot be NULL") | ||
private MessageType messageType; | ||
|
||
// can NULL | ||
@Setter | ||
private String message; // MessageType == 'ENTER' or 'LEAVE' or 'RANK' 일때는 null 가능. 'TALK'일때는 null 불가능. | ||
|
||
|
||
public Chat toEntity(String senderName, String message, LocalDateTime createdTime) { | ||
return Chat.ChatSaveBuilder() | ||
.roomId(roomId) | ||
.senderId(senderId) | ||
.senderName(senderName) | ||
.message(message) | ||
.messageType(messageType) | ||
.createdTime(createdTime) | ||
.build(); | ||
} | ||
} |
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