| 1 | package com.finki.icare.model;
|
|---|
| 2 |
|
|---|
| 3 | import com.fasterxml.jackson.annotation.JsonIgnore;
|
|---|
| 4 | import jakarta.persistence.*;
|
|---|
| 5 | import lombok.AllArgsConstructor;
|
|---|
| 6 | import lombok.Data;
|
|---|
| 7 | import lombok.EqualsAndHashCode;
|
|---|
| 8 | import lombok.NoArgsConstructor;
|
|---|
| 9 | import org.hibernate.annotations.JdbcTypeCode;
|
|---|
| 10 | import org.hibernate.type.SqlTypes;
|
|---|
| 11 |
|
|---|
| 12 | import java.time.LocalDate;
|
|---|
| 13 | import java.util.List;
|
|---|
| 14 |
|
|---|
| 15 | @Entity
|
|---|
| 16 | @Table(name = "therapist")
|
|---|
| 17 | @Data
|
|---|
| 18 | @NoArgsConstructor
|
|---|
| 19 | @AllArgsConstructor
|
|---|
| 20 | @EqualsAndHashCode(callSuper = true)
|
|---|
| 21 | @PrimaryKeyJoinColumn(name = "id_user")
|
|---|
| 22 | public class Therapist extends User {
|
|---|
| 23 |
|
|---|
| 24 | @Column(name = "office_location", nullable = false, length = 255)
|
|---|
| 25 | private String officeLocation;
|
|---|
| 26 |
|
|---|
| 27 | @Column(name = "degree", nullable = false, length = 100)
|
|---|
| 28 | private String degree;
|
|---|
| 29 |
|
|---|
| 30 | @Column(name = "years_exp", nullable = false)
|
|---|
| 31 | private Integer yearsExp;
|
|---|
| 32 |
|
|---|
| 33 | @Column(name = "phone_number", nullable = false, length = 20)
|
|---|
| 34 | private String phoneNumber;
|
|---|
| 35 |
|
|---|
| 36 | @JdbcTypeCode(SqlTypes.ARRAY)
|
|---|
| 37 | @Column(name = "consultation_slots", columnDefinition = "DATE[]")
|
|---|
| 38 | private LocalDate[] consultationSlots;
|
|---|
| 39 |
|
|---|
| 40 | @JsonIgnore
|
|---|
| 41 | @OneToMany(mappedBy = "therapist", cascade = CascadeType.ALL)
|
|---|
| 42 | private List<Patient> patients;
|
|---|
| 43 |
|
|---|
| 44 | @JsonIgnore
|
|---|
| 45 | @OneToMany(mappedBy = "therapist", cascade = CascadeType.ALL)
|
|---|
| 46 | private List<Consultation> consultations;
|
|---|
| 47 | }
|
|---|