Add subscription feature

This commit is contained in:
Tim
2025-07-02 18:17:32 +08:00
parent 6e9cd7f450
commit 47fc78a603
12 changed files with 337 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
package com.openisle.model;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/** Subscription to a post for update notifications. */
@Entity
@Getter
@Setter
@NoArgsConstructor
@Table(name = "post_subscriptions",
uniqueConstraints = @UniqueConstraint(columnNames = {"user_id", "post_id"}))
public class PostSubscription {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "user_id")
private User user;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "post_id")
private Post post;
}