-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProblem.java
More file actions
69 lines (61 loc) · 1.79 KB
/
Problem.java
File metadata and controls
69 lines (61 loc) · 1.79 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
package com.gamzabat.algohub.feature.problem.domain;
import java.time.LocalDate;
import java.time.LocalDateTime;
import org.hibernate.annotations.SQLDelete;
import com.gamzabat.algohub.feature.group.studygroup.domain.StudyGroup;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Entity
@Getter
@NoArgsConstructor
@SQLDelete(sql = "UPDATE problem SET deleted_at = CURRENT_TIMESTAMP WHERE id = ?")
@Table(
name = "problem",
indexes = {
@Index(name = "idx_problem_group", columnList = "study_group_id")
}
)
public class Problem {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(length = 512)
private String link;
private LocalDate startDate;
private LocalDate endDate;
private Integer number;
private String title;
private Integer level;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "study_group_id")
private StudyGroup studyGroup;
private LocalDateTime deletedAt;
@Builder
public Problem(String link, LocalDate startDate, LocalDate endDate, Integer number, String title, Integer level,
StudyGroup studyGroup) {
this.link = link;
this.number = number;
this.startDate = startDate;
this.endDate = endDate;
this.title = title;
this.level = level;
this.studyGroup = studyGroup;
}
public void editProblemStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public void editProblemEndDate(LocalDate endDate) {
this.endDate = endDate;
}
}