Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import server.loop.domain.post.entity.Comment;
import server.loop.domain.user.entity.User;
import server.loop.domain.post.entity.Post;
Expand All @@ -28,6 +30,8 @@ public class Notification {
private Post post;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "comment_id")
@OnDelete(action = OnDeleteAction.CASCADE)
private Comment comment;

private String message;
Expand All @@ -40,6 +44,8 @@ public class Notification {
@Column(nullable = false)
private String postTitle;



@PrePersist
protected void onCreate() {
this.createdAt = LocalDateTime.now();
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/server/loop/global/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti

.requestMatchers(HttpMethod.GET, "/api/users/check-nickname").permitAll()
// ------------------ 인증(Authenticated) API ------------------
// 신고(Report) 명시 추가
.requestMatchers(HttpMethod.POST, "/api/posts/*/report").authenticated()

// 게시글 관련
.requestMatchers(HttpMethod.POST, "/api/posts").authenticated()
.requestMatchers(HttpMethod.PUT, "/api/posts/**").authenticated()
Expand All @@ -111,6 +114,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.requestMatchers(HttpMethod.DELETE, "/api/users/me").authenticated()
.requestMatchers(HttpMethod.PATCH, "/api/users/profile/nickname").authenticated()
.requestMatchers(HttpMethod.PATCH, "/api/users/password").authenticated()

//알림서비스
.requestMatchers("/ws/**", "/api/ws/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/notifications").authenticated()
Expand Down