-
Notifications
You must be signed in to change notification settings - Fork 2
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 #130 from dd-jiyun/main
쪽지 기능 (받은 쪽지, 보낸 쪽지 조회)
- Loading branch information
Showing
7 changed files
with
88 additions
and
60 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
67 changes: 54 additions & 13 deletions
67
Titto_Backend/src/main/java/com/example/titto_backend/message/dto/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 |
---|---|---|
@@ -1,23 +1,64 @@ | ||
package com.example.titto_backend.message.dto; | ||
|
||
import com.example.titto_backend.message.domain.Message; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
// response 임! | ||
public class MessageDTO { | ||
private String title; | ||
private String content; | ||
private Long receiverId; | ||
|
||
public static MessageDTO toDto(Message message) { | ||
return new MessageDTO( | ||
message.getTitle(), | ||
message.getContent(), | ||
message.getReceiver().getId() | ||
); | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
@Schema(description = "메시지 작성") | ||
public static class Request { | ||
@Schema(description = "내용") | ||
private String content; | ||
@Schema(description = "받는 사람 닉네임") | ||
private String receiverNickname; | ||
} | ||
|
||
@Data | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@Schema(description = "메시지 조회") | ||
public static class Response { | ||
@Schema(description = "메시지 ID") | ||
private Long id; | ||
|
||
@Schema(description = "내용") | ||
private String content; | ||
|
||
@Schema(description = "보낸 사람 ID") | ||
private Long senderId; | ||
|
||
@Schema(description = "받는 사람 ID") | ||
private Long receiverId; | ||
|
||
@Schema(description = "보낸 시간") | ||
private String sentAt; | ||
|
||
@Schema(description = "받는 사람 닉네임") | ||
private String receiverNickname; | ||
|
||
@Schema(description = "보낸 사람 닉네임") | ||
private String senderNickname; | ||
|
||
public Response(Message message) { | ||
this.id = message.getId(); | ||
this.content = message.getContent(); | ||
this.senderId = message.getSender().getId(); | ||
this.receiverId = message.getReceiver().getId(); | ||
this.sentAt = message.getSentAt().toString(); | ||
this.receiverNickname = message.getReceiverNickname(); | ||
this.senderNickname = message.getSenderNickname(); | ||
} | ||
} | ||
} | ||
|
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