[3d3e59d] | 1 | package finki.paw5.model.entities;
|
---|
[d427a07] | 2 |
|
---|
[579bf6d] | 3 | import jakarta.persistence.*;
|
---|
[d427a07] | 4 | import lombok.Data;
|
---|
[fdd7961] | 5 | import lombok.RequiredArgsConstructor;
|
---|
[d427a07] | 6 |
|
---|
[579bf6d] | 7 | import java.time.LocalDate;
|
---|
[c03e53b] | 8 | import java.util.List;
|
---|
[579bf6d] | 9 |
|
---|
[d427a07] | 10 | @Data
|
---|
| 11 | @Entity
|
---|
[fdd7961] | 12 | @RequiredArgsConstructor
|
---|
[d427a07] | 13 | @Table(name = "donor")
|
---|
[579bf6d] | 14 | @PrimaryKeyJoinColumn(name = "id_user")
|
---|
| 15 | public class Donor extends User {
|
---|
[d427a07] | 16 |
|
---|
| 17 | @Column(name = "is_from_organisation", nullable = false)
|
---|
[fdd7961] | 18 | private Boolean fromOrganisation;
|
---|
[d427a07] | 19 |
|
---|
[fdfc6fa] | 20 | @Column(name = "name_organisation_donor", nullable = true, length = 100)
|
---|
[d427a07] | 21 | private String organisationName;
|
---|
| 22 |
|
---|
[c03e53b] | 23 | @ManyToMany
|
---|
| 24 | @JoinTable(name = "donor_donates_to_organisation",
|
---|
| 25 | joinColumns = @JoinColumn(name = "id_user"),
|
---|
| 26 | inverseJoinColumns = @JoinColumn(name = "id_organisation"))
|
---|
| 27 | List<Organisation> donatedToOrganisations;
|
---|
| 28 |
|
---|
[fdd7961] | 29 | public Donor(LocalDate dateCreated, String name, String email,
|
---|
| 30 | String password, String telephone, Boolean fromOrganisation,
|
---|
| 31 | String organisationName) {
|
---|
[579bf6d] | 32 | super(dateCreated, name, email, password, telephone);
|
---|
| 33 | this.fromOrganisation = fromOrganisation;
|
---|
| 34 | this.organisationName = organisationName;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
[d427a07] | 37 | }
|
---|