-
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.
Merge pull request #49 from OmokNoonE/feature/notificationAOP
[PR] AOP 알림 기능 및 쪽지 기능 구현
- Loading branch information
Showing
14 changed files
with
601 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,5 @@ public class CommentDTO { | |
|
||
private String memberId; | ||
|
||
private String nickname; // 필요없으면 지움 | ||
|
||
} |
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
115 changes: 115 additions & 0 deletions
115
OnionHotSayYo/src/main/java/org/omoknoone/onionhotsayyo/letter/command/aggregate/Letter.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,115 @@ | ||
package org.omoknoone.onionhotsayyo.letter.command.aggregate; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import org.hibernate.annotations.ColumnDefault; | ||
import org.hibernate.annotations.CreationTimestamp; | ||
import org.omoknoone.onionhotsayyo.member.aggregate.Member; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.Table; | ||
|
||
@Entity | ||
@Table(name = "letter") | ||
public class Letter { | ||
|
||
@Id | ||
@Column(name = "letter_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private int letterId; | ||
|
||
@Column(name = "message") | ||
private String message; | ||
|
||
@Column(name = "event_time") | ||
@CreationTimestamp | ||
private LocalDateTime eventTime; | ||
|
||
@Column(name = "is_checked") | ||
@ColumnDefault("false") | ||
private boolean isChecked; | ||
|
||
@JoinColumn(name = "send_id") | ||
private String sendId; | ||
|
||
@JoinColumn(name = "receive_id") | ||
private String receiveId; | ||
|
||
public Letter() { | ||
} | ||
|
||
public Letter(int letterId, String message, LocalDateTime eventTime, boolean isChecked, String sendId, | ||
String receiveId) { | ||
this.letterId = letterId; | ||
this.message = message; | ||
this.eventTime = eventTime; | ||
this.isChecked = isChecked; | ||
this.sendId = sendId; | ||
this.receiveId = receiveId; | ||
} | ||
|
||
public int getLetterId() { | ||
return letterId; | ||
} | ||
|
||
public void setLetterId(int letterId) { | ||
this.letterId = letterId; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
public LocalDateTime getEventTime() { | ||
return eventTime; | ||
} | ||
|
||
public void setEventTime(LocalDateTime eventTime) { | ||
this.eventTime = eventTime; | ||
} | ||
|
||
public boolean isChecked() { | ||
return isChecked; | ||
} | ||
|
||
public void setChecked(boolean checked) { | ||
isChecked = checked; | ||
} | ||
|
||
public String getSendId() { | ||
return sendId; | ||
} | ||
|
||
public void setSendId(String sendId) { | ||
this.sendId = sendId; | ||
} | ||
|
||
public String getReceiveId() { | ||
return receiveId; | ||
} | ||
|
||
public void setReceiveId(String receiveId) { | ||
this.receiveId = receiveId; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Letter{" + | ||
"letterId=" + letterId + | ||
", message='" + message + '\'' + | ||
", eventTime=" + eventTime + | ||
", isChecked=" + isChecked + | ||
", sendId='" + sendId + '\'' + | ||
", receiveId='" + receiveId + '\'' + | ||
'}'; | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
...src/main/java/org/omoknoone/onionhotsayyo/letter/command/controller/LetterController.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,85 @@ | ||
package org.omoknoone.onionhotsayyo.letter.command.controller; | ||
|
||
import java.util.List; | ||
|
||
import org.modelmapper.ModelMapper; | ||
import org.omoknoone.onionhotsayyo.letter.command.dto.LetterDTO; | ||
import org.omoknoone.onionhotsayyo.letter.command.service.LetterService; | ||
import org.omoknoone.onionhotsayyo.notification.command.service.NotificationService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/letters") | ||
public class LetterController { | ||
private final LetterService letterService; | ||
private final NotificationService notificationService; | ||
private final ModelMapper modelMapper; | ||
|
||
@Autowired | ||
public LetterController(LetterService letterService, NotificationService notificationService, | ||
ModelMapper modelMapper) { | ||
this.letterService = letterService; | ||
this.notificationService = notificationService; | ||
this.modelMapper = modelMapper; | ||
} | ||
|
||
// 쪽지 발송 | ||
@PostMapping("/send") | ||
public ResponseEntity<LetterDTO> sendLetter(@RequestBody LetterDTO letterDTO) { | ||
LetterDTO sendLetter = letterService.sendLetter(letterDTO); | ||
return ResponseEntity.status(HttpStatus.CREATED).body(sendLetter); | ||
} | ||
|
||
// 쪽지 수신 확인 | ||
@PutMapping("/check/{letterId}") | ||
public ResponseEntity<LetterDTO> checkLetter(@PathVariable(name = "letterId") int letterId) { | ||
LetterDTO readLetter = letterService.checkLetter(letterId); | ||
return ResponseEntity.status(HttpStatus.OK).body(readLetter); | ||
} | ||
|
||
|
||
// // 송수신 쪽지 모두 확인 | ||
// @GetMapping("/list/myletter/{memberId}") | ||
// public ResponseEntity<List<LetterDTO>> viewLetterByMe(@PathVariable(name = "memberId") String memberId) { | ||
// List<LetterDTO> letterList = letterService.viewLetterByMe(memberId); | ||
// return ResponseEntity.status(HttpStatus.OK).body(letterList); | ||
// } | ||
|
||
// 내가 보낸 쪽지 | ||
@GetMapping("/mysendletter/{memberId}") | ||
public ResponseEntity<List<LetterDTO>> viewSendLetter(@PathVariable(name = "memberId") String memberId) { | ||
List<LetterDTO> sendLetterList = letterService.viewSendLetter(memberId); | ||
return ResponseEntity.status(HttpStatus.OK).body(sendLetterList); | ||
} | ||
|
||
// 내가 받은 쪽지 | ||
@GetMapping("/myreceiveletter/{memberId}") | ||
public ResponseEntity<List<LetterDTO>> viewReceiveLetter(@PathVariable(name = "memberId") String memberId) { | ||
List<LetterDTO> receiveLetter = letterService.viewReceiveLetter(memberId); | ||
return ResponseEntity.status(HttpStatus.OK).body(receiveLetter); | ||
} | ||
|
||
// 안 읽은 상태의 쪽지 조회 | ||
@GetMapping("/unreadletter/{memberId}") | ||
public ResponseEntity<List<LetterDTO>> viewUnreadLetter(@PathVariable(name = "memberId") String memberId) { | ||
List<LetterDTO> unreadletter = letterService.viewUnreadLetter(memberId); | ||
return ResponseEntity.status(HttpStatus.OK).body(unreadletter); | ||
} | ||
|
||
|
||
|
||
|
||
@GetMapping("/health_check") | ||
public String healthCheck() { | ||
return "Good"; | ||
} | ||
} |
Oops, something went wrong.