-
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.
- Loading branch information
Showing
18 changed files
with
560 additions
and
180 deletions.
There are no files selected for viewing
21 changes: 0 additions & 21 deletions
21
src/main/java/aromanticcat/umcproject/config/AppConfig.java
This file was deleted.
Oops, something went wrong.
75 changes: 75 additions & 0 deletions
75
src/main/java/aromanticcat/umcproject/converter/NangmanPostBoxConverter.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,75 @@ | ||
package aromanticcat.umcproject.converter; | ||
|
||
import aromanticcat.umcproject.entity.NangmanLetter; | ||
import aromanticcat.umcproject.entity.NangmanReply; | ||
import aromanticcat.umcproject.web.dto.NangmanPostBoxRequestDTO; | ||
import aromanticcat.umcproject.web.dto.NangmanPostBoxResponseDTO; | ||
|
||
public class NangmanPostBoxConverter { | ||
|
||
//낭만 레터 엔티티 -> DTO 생성 | ||
public static NangmanPostBoxResponseDTO.SendLetterResultDTO toSendLetterResultDTO(NangmanLetter nangmanLetter){ | ||
|
||
return NangmanPostBoxResponseDTO.SendLetterResultDTO.builder() | ||
.nangmanLetterId(nangmanLetter.getId()) | ||
.senderNickname(nangmanLetter.getSenderNickname()) | ||
.createdAt(nangmanLetter.getCreatedAt()) | ||
.build(); | ||
} | ||
|
||
//낭만 레터 DTO -> 엔티티 생성 | ||
public static NangmanLetter toNangmanLetterResult(NangmanPostBoxRequestDTO.SendLetterDTO request){ | ||
return NangmanLetter.builder() | ||
.isPublic(request.getIsPublic()) | ||
.content(request.getContent()) | ||
.senderNickname(request.getSenderRandomNickname()) | ||
// .member(request.getMember()) | ||
.build(); | ||
} | ||
|
||
//낭만 레터 엔티티 -> 프리뷰 낭만 레터 DTO 생성 | ||
public static NangmanPostBoxResponseDTO.LetterSummaryResultDTO toLetterSummaryResultDTO(NangmanLetter nangmanLetter){ | ||
// 편지 내용을 40자 까지만 보이도록 | ||
String content = nangmanLetter.getContent(); | ||
String preview = content.length() <= 40 ? content: content.substring(0, 40) + "..."; | ||
|
||
return NangmanPostBoxResponseDTO.LetterSummaryResultDTO.builder() | ||
.nangmanLetterId(nangmanLetter.getId()) | ||
.preview(preview) | ||
.createdAt(nangmanLetter.getCreatedAt()) | ||
.build(); | ||
} | ||
|
||
//낭만 레터 엔티티 + 랜덤 닉네임 -> 낭만 리플라이 DTO 생성 | ||
public static NangmanPostBoxResponseDTO.SelectedLetterResultDTO toReplyLetterResultDTO(NangmanLetter nangmanLetter, String randomNickname){ | ||
return NangmanPostBoxResponseDTO.SelectedLetterResultDTO.builder() | ||
.nangmanLetterId(nangmanLetter.getId()) | ||
.nangmanLetterContent(nangmanLetter.getContent()) | ||
.senderNickname(nangmanLetter.getSenderNickname()) | ||
.replySenderNickname(randomNickname) | ||
.build(); | ||
} | ||
|
||
// 낭만 리플라이 DTO -> 낭만 리플라이 엔티티 | ||
public static NangmanReply toNangmanReplyResult(NangmanPostBoxRequestDTO.ReplyLetterDTO request, NangmanLetter nangmanLetter){ | ||
return NangmanReply.builder() | ||
.content(request.getReplyContent()) | ||
.replySenderNickname(request.getReplySenderNickname()) | ||
.nangmanLetter(nangmanLetter) | ||
// .member(request.getMember()) | ||
.build(); | ||
|
||
} | ||
|
||
public static NangmanPostBoxResponseDTO.SendReplyResultDTO toSendReplyResultDTO(NangmanReply nangmanReply){ | ||
return NangmanPostBoxResponseDTO.SendReplyResultDTO.builder() | ||
.nangmanReplyId(nangmanReply.getId()) | ||
.nangmanLetterId(nangmanReply.getNangmanLetter().getId()) | ||
.replySenderNickname(nangmanReply.getReplySenderNickname()) | ||
.createdAt(nangmanReply.getCreatedAt()) | ||
.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package aromanticcat.umcproject.entity; | ||
|
||
import lombok.Getter; | ||
|
||
import javax.persistence.*; | ||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name = "letter") | ||
public class Letter extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long letter_id; | ||
|
||
@Column(name = "nickname", length = 60) | ||
private String nickname; | ||
|
||
@Column(length = 255) | ||
private String content; | ||
|
||
private Boolean open; | ||
|
||
@Column(name = "login_status") | ||
private Boolean loginStatus; | ||
|
||
@Column(name = "sender_ID") | ||
private Long senderId; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "letter_paper_id",insertable = false, updatable = false) | ||
private LetterPaper letterPaper; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "stamp_id", insertable = false, updatable = false) | ||
private Stamp stamp; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "id", insertable = false, updatable = false) | ||
private Letterbox letterbox; | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/aromanticcat/umcproject/entity/LetterPaper.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 aromanticcat.umcproject.entity; | ||
|
||
import lombok.Getter; | ||
|
||
import javax.persistence.*; | ||
import javax.validation.constraints.NotNull; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name = "letter_paper") | ||
public class LetterPaper extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long letter_paper_id; | ||
|
||
@NotNull | ||
private String image_url; | ||
|
||
@NotNull | ||
private String name; | ||
|
||
@OneToMany(mappedBy = "letterPaper") | ||
private List<Letter> letters; | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/aromanticcat/umcproject/entity/Letterbox.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,38 @@ | ||
package aromanticcat.umcproject.entity; | ||
|
||
import lombok.Getter; | ||
|
||
import javax.persistence.*; | ||
import javax.validation.constraints.NotNull; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name = "letterbox") | ||
public class Letterbox extends BaseEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long letterbox_id; | ||
|
||
@Column(name = "user_id", nullable = false) | ||
private Long userId; | ||
|
||
@NotNull | ||
private String name; | ||
@NotNull | ||
private String color; | ||
|
||
@NotNull | ||
@Column(name = "end_dt") | ||
private LocalDateTime endDt; | ||
|
||
@NotNull | ||
private Boolean activate; | ||
|
||
@NotNull | ||
private Boolean sender; | ||
|
||
@OneToMany(mappedBy = "letterbox") | ||
private List<Letter> letters; | ||
} |
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
21 changes: 11 additions & 10 deletions
21
src/main/java/aromanticcat/umcproject/entity/NangmanReply.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
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 aromanticcat.umcproject.entity; | ||
|
||
import lombok.Getter; | ||
|
||
import javax.persistence.*; | ||
import javax.validation.constraints.NotNull; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name = "stamp") | ||
public class Stamp extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long stamp_id; | ||
|
||
@NotNull | ||
private String image_url; | ||
|
||
@NotNull | ||
private String name; | ||
|
||
@OneToMany(mappedBy = "stamp") | ||
private List<Letter> letters; | ||
} |
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
8 changes: 8 additions & 0 deletions
8
src/main/java/aromanticcat/umcproject/repository/NangmanReplyRepository.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,8 @@ | ||
package aromanticcat.umcproject.repository; | ||
|
||
import aromanticcat.umcproject.entity.NangmanReply; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface NangmanReplyRepository extends JpaRepository<NangmanReply, Long> { | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/aromanticcat/umcproject/service/NangmanPostBoxService.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,22 @@ | ||
package aromanticcat.umcproject.service; | ||
|
||
import aromanticcat.umcproject.entity.NangmanLetter; | ||
import aromanticcat.umcproject.entity.NangmanReply; | ||
import aromanticcat.umcproject.web.dto.NangmanPostBoxRequestDTO; | ||
|
||
import java.util.List; | ||
|
||
public interface NangmanPostBoxService { | ||
|
||
NangmanLetter writeAndSendLetter(NangmanPostBoxRequestDTO.SendLetterDTO requestDTO); | ||
|
||
List<NangmanLetter> getLetterList(); | ||
|
||
NangmanLetter getLetterById(Long id); | ||
|
||
NangmanReply writeAndSendReply(NangmanPostBoxRequestDTO.ReplyLetterDTO requestDTO, Long id); | ||
|
||
// NangmanLetterDTO readOne(Long id); | ||
// | ||
// void receivedReply(NangmanLetterDTO nangmanLetterDTO); | ||
} |
Oops, something went wrong.