package org.psesquared.server.model; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import jakarta.persistence.ManyToOne; import jakarta.persistence.Table; import java.io.Serializable; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** * An action a user took regarding a podcast. */ @Data @Builder @NoArgsConstructor @AllArgsConstructor @Entity @Table(name = "subscription_actions") public class SubscriptionAction implements Serializable { /** * The primary key for the table. */ @Id @GeneratedValue(strategy=GenerationType.SEQUENCE) @Column(name = "id", updatable = false) private int id; /** * The user who took this action. */ @ManyToOne(optional = false) private User user; /** * The timestamp of when this action took place. */ @Column(name = "timestamp", nullable = false) private long timestamp; /** * The podcast that was affected. */ @ManyToOne(optional = false) private Subscription subscription; /** * Whether the podcast was added or removed. */ @Column(name = "added", nullable = false) private boolean added; }