mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-27 00:20:48 +08:00
51 lines
1.2 KiB
Java
51 lines
1.2 KiB
Java
package com.openisle.model;
|
|
|
|
import jakarta.persistence.*;
|
|
import lombok.Getter;
|
|
import lombok.NoArgsConstructor;
|
|
import lombok.Setter;
|
|
import org.hibernate.annotations.CreationTimestamp;
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
/** Generic activity entity. */
|
|
@Entity
|
|
@Getter
|
|
@Setter
|
|
@NoArgsConstructor
|
|
@Table(name = "activities")
|
|
public class Activity {
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private Long id;
|
|
|
|
@Column(nullable = false)
|
|
private String title;
|
|
|
|
private String icon;
|
|
|
|
private String content;
|
|
|
|
@Column(name = "start_time", nullable = false)
|
|
@CreationTimestamp
|
|
private LocalDateTime startTime;
|
|
|
|
@Column(name = "end_time")
|
|
private LocalDateTime endTime;
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(nullable = false)
|
|
private ActivityType type = ActivityType.NORMAL;
|
|
|
|
@ManyToMany(fetch = FetchType.LAZY)
|
|
@JoinTable(name = "activity_participants",
|
|
joinColumns = @JoinColumn(name = "activity_id"),
|
|
inverseJoinColumns = @JoinColumn(name = "user_id"))
|
|
private Set<User> participants = new HashSet<>();
|
|
|
|
@Column(nullable = false)
|
|
private boolean ended = false;
|
|
}
|