Added Post system. Notification system

This commit is contained in:
redtea committed 2022-09-01 17:04:25 +03:00
1 parent cc068fc3a8
commit 3ac444931c
29 files changed
+639 -86

No files matched your search

@@ -0,0 +1,32 @@
package site.easystartup.web.notification.controller;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import site.easystartup.web.notification.domian.Notification;
import site.easystartup.web.notification.repo.NotificationRepo;
import site.easystartup.web.notification.service.NotificationService;
import java.security.Principal;
import java.util.List;
@RestController
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class NotificationRestController {
private final NotificationService notificationService;
@GetMapping("/notifications/{username}")
public ResponseEntity<List<Notification>> notification(@PathVariable String username, Principal principal) {
return ResponseEntity.ok().body(notificationService.getNotificationByRecipient(username, principal));
}
@DeleteMapping("/notifications/{id}/delete")
public void delete(@PathVariable long id,
Principal principal) {
notificationService.delete(id, principal);
}
}