[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;
|
||||
|
||||
import com.mirna.hospitalmanagementapi.domain.enums.Speciality;
|
||||
import com.mirna.hospitalmanagementapi.domain.enums.Specialty;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.Email;
|
||||
@ -32,7 +32,7 @@ public record DoctorDTO(
|
||||
|
||||
@NotNull(message="speciality cannot be null")
|
||||
@Valid
|
||||
Speciality speciality,
|
||||
Specialty specialty,
|
||||
|
||||
@NotNull(message="address cannot be null")
|
||||
@Valid
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.mirna.hospitalmanagementapi.domain.entities;
|
||||
|
||||
import com.mirna.hospitalmanagementapi.domain.dtos.AddressDTO;
|
||||
import com.mirna.hospitalmanagementapi.domain.dtos.DoctorDTO;
|
||||
|
||||
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) {
|
||||
this.street = addressDTO.street();
|
||||
this.neighborhood = addressDTO.neighborhood();
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.mirna.hospitalmanagementapi.domain.entities;
|
||||
|
||||
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.Entity;
|
||||
@ -21,12 +21,17 @@ import jakarta.persistence.Table;
|
||||
@Entity(name="Doctor")
|
||||
public class Doctor {
|
||||
|
||||
/**
|
||||
* Constructor for class Doctor
|
||||
* @param doctorDTO Data transfer object containing Doctor entity information
|
||||
* @see DoctorDTO
|
||||
*/
|
||||
public Doctor(DoctorDTO doctorDTO) {
|
||||
this.name=doctorDTO.name();
|
||||
this.email=doctorDTO.email();
|
||||
this.crm=doctorDTO.email();
|
||||
this.telephone=doctorDTO.telephone();
|
||||
this.speciality=doctorDTO.speciality();
|
||||
this.specialty=doctorDTO.specialty();
|
||||
this.address = new Address(doctorDTO.address());
|
||||
}
|
||||
|
||||
@ -38,7 +43,7 @@ public class Doctor {
|
||||
private String telephone;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Speciality speciality;
|
||||
private Specialty specialty;
|
||||
|
||||
@Embedded
|
||||
private Address address;
|
||||
@ -101,7 +106,7 @@ public class Doctor {
|
||||
|
||||
/**
|
||||
* Sets the crm
|
||||
* @param crn Must not be blank.
|
||||
* @param crm Must not be blank.
|
||||
*/
|
||||
public void setCrm(String crm) {
|
||||
this.crm = crm;
|
||||
@ -124,20 +129,20 @@ public class Doctor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the speciality
|
||||
* @return An enum class representing the doctor's speciality.
|
||||
* Returns the specialty
|
||||
* @return An enum class representing the doctor's specialty.
|
||||
* @see Speciality
|
||||
*/
|
||||
public Speciality getSpeciality() {
|
||||
return speciality;
|
||||
public Specialty getSpecialty() {
|
||||
return specialty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the speciality
|
||||
* @param speciality Must not be null.
|
||||
* Sets the specialty
|
||||
* @param specialty Must not be null.
|
||||
*/
|
||||
public void setSpeciality(Speciality speciality) {
|
||||
this.speciality = speciality;
|
||||
public void setSpecialty(Specialty specialty) {
|
||||
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