[cf9cdbf] | 1 | package edu.gjoko.schedlr.entity;
|
---|
| 2 |
|
---|
[8bcd64c] | 3 | import com.fasterxml.jackson.annotation.JsonIgnore;
|
---|
[77205be] | 4 | import com.fasterxml.jackson.annotation.JsonManagedReference;
|
---|
[cf9cdbf] | 5 | import lombok.AllArgsConstructor;
|
---|
| 6 | import lombok.Getter;
|
---|
| 7 | import lombok.NoArgsConstructor;
|
---|
| 8 | import lombok.Setter;
|
---|
[204464d] | 9 | import org.springframework.data.annotation.CreatedDate;
|
---|
| 10 | import org.springframework.data.annotation.LastModifiedDate;
|
---|
| 11 | import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
---|
[cf9cdbf] | 12 |
|
---|
| 13 | import javax.persistence.*;
|
---|
| 14 | import java.time.LocalDateTime;
|
---|
[77205be] | 15 | import java.util.List;
|
---|
[cf9cdbf] | 16 |
|
---|
| 17 | @Entity
|
---|
[204464d] | 18 | @EntityListeners(AuditingEntityListener.class)
|
---|
[cf9cdbf] | 19 | @Table(name = "stakeholder")
|
---|
| 20 | @Getter
|
---|
| 21 | @Setter
|
---|
| 22 | @NoArgsConstructor
|
---|
| 23 | @AllArgsConstructor
|
---|
| 24 | public class Stakeholder {
|
---|
| 25 |
|
---|
| 26 | @Id
|
---|
| 27 | @GeneratedValue(strategy = GenerationType.SEQUENCE)
|
---|
| 28 | private Long id;
|
---|
| 29 |
|
---|
| 30 | @Column(name = "stakeholder_type")
|
---|
| 31 | @Enumerated(EnumType.STRING)
|
---|
| 32 | private StakeholderType stakeholderType;
|
---|
| 33 |
|
---|
| 34 | @Column(name = "first_name")
|
---|
| 35 | private String firstName;
|
---|
| 36 |
|
---|
| 37 | @Column(name = "last_name")
|
---|
| 38 | private String lastName;
|
---|
| 39 |
|
---|
| 40 | @Column(name = "email")
|
---|
| 41 | private String email;
|
---|
| 42 |
|
---|
[77205be] | 43 | @Column(name = "phone_number")
|
---|
| 44 | private String phoneNumber;
|
---|
| 45 |
|
---|
[cf9cdbf] | 46 | @Column(name = "username")
|
---|
| 47 | private String username;
|
---|
| 48 |
|
---|
| 49 | @Column(name = "password")
|
---|
| 50 | private String password;
|
---|
| 51 |
|
---|
[77205be] | 52 | @OneToMany(mappedBy = "customer")
|
---|
| 53 | @JsonManagedReference(value = "customerAppointments")
|
---|
| 54 | private List<Appointment> appointments;
|
---|
| 55 |
|
---|
[cf9cdbf] | 56 | @Column(name = "created")
|
---|
[204464d] | 57 | @CreatedDate
|
---|
[8bcd64c] | 58 | @JsonIgnore
|
---|
[cf9cdbf] | 59 | private LocalDateTime created;
|
---|
| 60 |
|
---|
| 61 | @Column(name = "modified")
|
---|
[204464d] | 62 | @LastModifiedDate
|
---|
[8bcd64c] | 63 | @JsonIgnore
|
---|
[cf9cdbf] | 64 | private LocalDateTime modified;
|
---|
[77205be] | 65 |
|
---|
| 66 | public String getFullName() {
|
---|
| 67 | return firstName + " " + lastName;
|
---|
| 68 | }
|
---|
[cf9cdbf] | 69 | }
|
---|