-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvent.java
More file actions
77 lines (57 loc) · 1.45 KB
/
Event.java
File metadata and controls
77 lines (57 loc) · 1.45 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package com.techevents.model;
import jakarta.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@Entity
public class Event {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
@Column(length = 1000)
private String description;
private LocalDate eventDate;
private String city;
@Column(nullable = false, updatable = false)
private LocalDateTime createdAt;
@ElementCollection
private List<String> tags;
@PrePersist
protected void onCreate() {
this.createdAt = LocalDateTime.now();
}
// Constructors
public Event() {
}
public Event(String title, String description, LocalDate eventDate, String city,
List<String> tags) {
this.title = title;
this.description = description;
this.eventDate = eventDate;
this.city = city;
this.tags = tags;
this.createdAt = LocalDateTime.now();
}
public Long getId() {
return id;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public LocalDate getEventDate() {
return eventDate;
}
public String getCity() {
return city;
}
public List<String> getTags() {
return tags;
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
}