Skip to content

Commit 43923c8

Browse files
committed
feat: 봉사 기록 엔티티 추가
- 봉사 기록 엔티티 추가 - 엔티티 생성 메서드 구현
1 parent ef9c1b2 commit 43923c8

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.somemore.domains.volunteerrecord.domain;
2+
3+
import com.somemore.global.common.entity.BaseEntity;
4+
import jakarta.persistence.*;
5+
import lombok.AccessLevel;
6+
import lombok.Builder;
7+
import lombok.Getter;
8+
import lombok.NoArgsConstructor;
9+
10+
import java.time.LocalDate;
11+
import java.util.UUID;
12+
13+
import static jakarta.persistence.GenerationType.IDENTITY;
14+
15+
@NoArgsConstructor(access = AccessLevel.PROTECTED)
16+
@Getter
17+
@Entity
18+
@Table(name = "volunteer_record")
19+
public class VolunteerRecord extends BaseEntity {
20+
21+
@Id
22+
@GeneratedValue(strategy = IDENTITY)
23+
private Long id;
24+
25+
@Column(name = "volunteer_id", nullable = false)
26+
private UUID volunteerId;
27+
28+
@Column(name = "title", nullable = false)
29+
private String title;
30+
31+
@Column(name = "volunteer_date", nullable = false)
32+
private LocalDate volunteerDate;
33+
34+
@Column(name = "volunteer_hours", nullable = false)
35+
private int volunteerHours;
36+
37+
@Builder
38+
private VolunteerRecord(UUID volunteerId, String title, LocalDate volunteerDate, int volunteerHours) {
39+
this.volunteerId = volunteerId;
40+
this.title = title;
41+
this.volunteerDate = volunteerDate;
42+
this.volunteerHours = volunteerHours;
43+
}
44+
45+
public static VolunteerRecord create(UUID volunteerId, String title, LocalDate volunteerDate, int volunteerHours) {
46+
return VolunteerRecord.builder()
47+
.volunteerId(volunteerId)
48+
.title(title)
49+
.volunteerDate(volunteerDate)
50+
.volunteerHours(volunteerHours)
51+
.build();
52+
}
53+
54+
}

0 commit comments

Comments
 (0)