-
Notifications
You must be signed in to change notification settings - Fork 0
/
Event.java
50 lines (36 loc) 路 1.09 KB
/
Event.java
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
package ch.relievers.relive.entities;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@Entity(name = "`event`")
@NoArgsConstructor
@Getter
@Setter
public class Event {
public enum EventState { PLANNED, ONGOING, PAST }
public Event(String displayName, String description, LocalDateTime startDateTime, Integer duration) {
this.displayName = displayName;
this.description = description;
this.startDateTime = startDateTime;
this.duration = duration;
this.state = EventState.PLANNED;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@ManyToOne
private User owner;
@OneToMany(mappedBy = "event")
@JsonIgnore
private List<MediaItem> medias;
private String displayName;
private String description;
private LocalDateTime startDateTime;
// Unit = minutes
private Integer duration;
private EventState state;
}