summaryrefslogtreecommitdiff
path: root/pse-server/src/main/java/org/psesquared/server/model/SubscriptionAction.java
blob: 3d850eb2cf76b79270f37557bc29c49f9347a2a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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;

}