[R1] Refactor specialty class name and add missing java doc
This commit is contained in:
parent
51f83b3bda
commit
02fdb33903
@ -1,6 +1,6 @@
|
|||||||
package com.mirna.hospitalmanagementapi.domain.dtos;
|
package com.mirna.hospitalmanagementapi.domain.dtos;
|
||||||
|
|
||||||
import com.mirna.hospitalmanagementapi.domain.enums.Speciality;
|
import com.mirna.hospitalmanagementapi.domain.enums.Specialty;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.Email;
|
import jakarta.validation.constraints.Email;
|
||||||
@ -32,7 +32,7 @@ public record DoctorDTO(
|
|||||||
|
|
||||||
@NotNull(message="speciality cannot be null")
|
@NotNull(message="speciality cannot be null")
|
||||||
@Valid
|
@Valid
|
||||||
Speciality speciality,
|
Specialty specialty,
|
||||||
|
|
||||||
@NotNull(message="address cannot be null")
|
@NotNull(message="address cannot be null")
|
||||||
@Valid
|
@Valid
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.mirna.hospitalmanagementapi.domain.entities;
|
package com.mirna.hospitalmanagementapi.domain.entities;
|
||||||
|
|
||||||
import com.mirna.hospitalmanagementapi.domain.dtos.AddressDTO;
|
import com.mirna.hospitalmanagementapi.domain.dtos.AddressDTO;
|
||||||
|
import com.mirna.hospitalmanagementapi.domain.dtos.DoctorDTO;
|
||||||
|
|
||||||
import jakarta.persistence.Embeddable;
|
import jakarta.persistence.Embeddable;
|
||||||
|
|
||||||
@ -16,6 +17,11 @@ public class Address {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for class Address
|
||||||
|
* @param addressDTO Data transfer object containing Address information
|
||||||
|
* @see AddressDTO
|
||||||
|
*/
|
||||||
public Address(AddressDTO addressDTO) {
|
public Address(AddressDTO addressDTO) {
|
||||||
this.street = addressDTO.street();
|
this.street = addressDTO.street();
|
||||||
this.neighborhood = addressDTO.neighborhood();
|
this.neighborhood = addressDTO.neighborhood();
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.mirna.hospitalmanagementapi.domain.entities;
|
package com.mirna.hospitalmanagementapi.domain.entities;
|
||||||
|
|
||||||
import com.mirna.hospitalmanagementapi.domain.dtos.DoctorDTO;
|
import com.mirna.hospitalmanagementapi.domain.dtos.DoctorDTO;
|
||||||
import com.mirna.hospitalmanagementapi.domain.enums.Speciality;
|
import com.mirna.hospitalmanagementapi.domain.enums.Specialty;
|
||||||
|
|
||||||
import jakarta.persistence.Embedded;
|
import jakarta.persistence.Embedded;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
@ -21,12 +21,17 @@ import jakarta.persistence.Table;
|
|||||||
@Entity(name="Doctor")
|
@Entity(name="Doctor")
|
||||||
public class Doctor {
|
public class Doctor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for class Doctor
|
||||||
|
* @param doctorDTO Data transfer object containing Doctor entity information
|
||||||
|
* @see DoctorDTO
|
||||||
|
*/
|
||||||
public Doctor(DoctorDTO doctorDTO) {
|
public Doctor(DoctorDTO doctorDTO) {
|
||||||
this.name=doctorDTO.name();
|
this.name=doctorDTO.name();
|
||||||
this.email=doctorDTO.email();
|
this.email=doctorDTO.email();
|
||||||
this.crm=doctorDTO.email();
|
this.crm=doctorDTO.email();
|
||||||
this.telephone=doctorDTO.telephone();
|
this.telephone=doctorDTO.telephone();
|
||||||
this.speciality=doctorDTO.speciality();
|
this.specialty=doctorDTO.specialty();
|
||||||
this.address = new Address(doctorDTO.address());
|
this.address = new Address(doctorDTO.address());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +43,7 @@ public class Doctor {
|
|||||||
private String telephone;
|
private String telephone;
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private Speciality speciality;
|
private Specialty specialty;
|
||||||
|
|
||||||
@Embedded
|
@Embedded
|
||||||
private Address address;
|
private Address address;
|
||||||
@ -101,7 +106,7 @@ public class Doctor {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the crm
|
* Sets the crm
|
||||||
* @param crn Must not be blank.
|
* @param crm Must not be blank.
|
||||||
*/
|
*/
|
||||||
public void setCrm(String crm) {
|
public void setCrm(String crm) {
|
||||||
this.crm = crm;
|
this.crm = crm;
|
||||||
@ -124,20 +129,20 @@ public class Doctor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the speciality
|
* Returns the specialty
|
||||||
* @return An enum class representing the doctor's speciality.
|
* @return An enum class representing the doctor's specialty.
|
||||||
* @see Speciality
|
* @see Speciality
|
||||||
*/
|
*/
|
||||||
public Speciality getSpeciality() {
|
public Specialty getSpecialty() {
|
||||||
return speciality;
|
return specialty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the speciality
|
* Sets the specialty
|
||||||
* @param speciality Must not be null.
|
* @param specialty Must not be null.
|
||||||
*/
|
*/
|
||||||
public void setSpeciality(Speciality speciality) {
|
public void setSpecialty(Specialty specialty) {
|
||||||
this.speciality = speciality;
|
this.specialty = specialty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
package com.mirna.hospitalmanagementapi.domain.enums;
|
|
||||||
|
|
||||||
public enum Speciality {
|
|
||||||
|
|
||||||
ORTHOPEDICS,
|
|
||||||
CARDIOLOGY,
|
|
||||||
GYNECOLOGY,
|
|
||||||
DERMATOLOGY
|
|
||||||
}
|
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package com.mirna.hospitalmanagementapi.domain.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specialties that can be used
|
||||||
|
* @see #ORTHOPEDICS
|
||||||
|
* @see #CARDIOLOGY
|
||||||
|
* @see #GYNECOLOGY
|
||||||
|
* @see #DERMATOLOGY
|
||||||
|
*/
|
||||||
|
public enum Specialty {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specialty in orthopedics
|
||||||
|
*/
|
||||||
|
ORTHOPEDICS,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specialty in cardiology
|
||||||
|
*/
|
||||||
|
CARDIOLOGY,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specialty in gynecology
|
||||||
|
*/
|
||||||
|
GYNECOLOGY,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specialty in dermatology
|
||||||
|
*/
|
||||||
|
DERMATOLOGY
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user