|
| 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