[R1] Add java doc
This commit is contained in:
parent
e7034a9236
commit
51f83b3bda
@ -26,7 +26,15 @@ public class DoctorController {
|
||||
@Autowired
|
||||
private DoctorService doctorService;
|
||||
|
||||
|
||||
/**
|
||||
* Post method to create a new Doctor object based on the provided DTO.
|
||||
*
|
||||
* @param doctorDTO The data transfer object containing data for Doctor
|
||||
* entity.
|
||||
*
|
||||
* @return A response entity containing the saved doctor if successful, or
|
||||
* a 400-level error if there is a validation error
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseEntity<Object> postDoctor(@RequestBody @Valid DoctorDTO doctorDTO) {
|
||||
|
||||
|
||||
@ -3,6 +3,12 @@ package com.mirna.hospitalmanagementapi.domain.dtos;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* Data transfer object used to transfer data that will be saved in a Address entity
|
||||
*
|
||||
* @author Mirna Gama
|
||||
* @version 1.0
|
||||
*/
|
||||
public record AddressDTO(
|
||||
|
||||
@NotBlank(message="street cannot be blank")
|
||||
|
||||
@ -8,6 +8,12 @@ import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* Data transfer object used to transfer data that will be saved in a Doctor entity
|
||||
*
|
||||
* @author Mirna Gama
|
||||
* @version 1.0
|
||||
*/
|
||||
public record DoctorDTO(
|
||||
|
||||
@NotBlank(message="name cannot be blank")
|
||||
|
||||
@ -4,6 +4,11 @@ import com.mirna.hospitalmanagementapi.domain.dtos.AddressDTO;
|
||||
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Mirna Gama
|
||||
* @version 1.0
|
||||
*/
|
||||
@Embeddable
|
||||
public class Address {
|
||||
|
||||
@ -29,58 +34,115 @@ public class Address {
|
||||
private String additionalDetails;
|
||||
private String houseNumber;
|
||||
|
||||
/**
|
||||
* Returns the street
|
||||
* @return A string representing the street.
|
||||
*/
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the street
|
||||
* @param street Must not be blank.
|
||||
*/
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the neighborhood
|
||||
* @return A string representing the neighborhood.
|
||||
*/
|
||||
public String getNeighborhood() {
|
||||
return neighborhood;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the neighborhood
|
||||
* @param neighborhood Must not be blank.
|
||||
*/
|
||||
public void setNeighborhood(String neighborhood) {
|
||||
this.neighborhood = neighborhood;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the zip code
|
||||
* @return A string representing the zip code.
|
||||
*/
|
||||
public String getZipCode() {
|
||||
return zipCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the zip code
|
||||
* @param zipCode Must not be blank.
|
||||
*/
|
||||
public void setZipCode(String zipCode) {
|
||||
this.zipCode = zipCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the city
|
||||
* @return A string representing the city.
|
||||
*/
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the city
|
||||
* @param city Must not be blank.
|
||||
*/
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the state
|
||||
* @return A string representing the state.
|
||||
*/
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the state
|
||||
* @param state Must not be blank.
|
||||
*/
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the additional details
|
||||
* @return A string representing the additional details.
|
||||
*/
|
||||
public String getAdditionalDetails() {
|
||||
return additionalDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the additional details
|
||||
* @param additionalDetails Not required
|
||||
*/
|
||||
public void setAdditionalDetails(String additionalDetails) {
|
||||
this.additionalDetails = additionalDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the house number
|
||||
* @return A string representing the house number.
|
||||
*/
|
||||
public String getHouseNumber() {
|
||||
return houseNumber;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the house number
|
||||
* @param houseNumber Not required
|
||||
*/
|
||||
public void setHouseNumber(String houseNumber) {
|
||||
this.houseNumber = houseNumber;
|
||||
}
|
||||
|
||||
@ -12,6 +12,11 @@ import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Mirna Gama
|
||||
* @version 1.0
|
||||
*/
|
||||
@Table(name="doctors")
|
||||
@Entity(name="Doctor")
|
||||
public class Doctor {
|
||||
@ -38,58 +43,116 @@ public class Doctor {
|
||||
@Embedded
|
||||
private Address address;
|
||||
|
||||
/**
|
||||
* Returns the doctor id.
|
||||
* @return A Long representing the doctor id.
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the doctor id.
|
||||
* @param id The doctor's unique identifier.
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name
|
||||
* @return A string representing the doctor's name.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name
|
||||
* @param name Must not be blank.
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the email
|
||||
* @return A string representing the doctor's email.
|
||||
*/
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the email
|
||||
* @param email Must not be blank.
|
||||
*/
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the crm
|
||||
* @return A string representing the doctor's crm.
|
||||
*/
|
||||
public String getCrm() {
|
||||
return crm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the crm
|
||||
* @param crn Must not be blank.
|
||||
*/
|
||||
public void setCrm(String crm) {
|
||||
this.crm = crm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the telephone
|
||||
* @return A string representing the doctor's telephone.
|
||||
*/
|
||||
public String getTelephone() {
|
||||
return telephone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the telephone
|
||||
* @param telephone Must not be blank.
|
||||
*/
|
||||
public void setTelephone(String telephone) {
|
||||
this.telephone = telephone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the speciality
|
||||
* @return An enum class representing the doctor's speciality.
|
||||
* @see Speciality
|
||||
*/
|
||||
public Speciality getSpeciality() {
|
||||
return speciality;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the speciality
|
||||
* @param speciality Must not be null.
|
||||
*/
|
||||
public void setSpeciality(Speciality speciality) {
|
||||
this.speciality = speciality;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the address
|
||||
* @return An object class representing the doctor's address.
|
||||
* @see Address
|
||||
*/
|
||||
public Address getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the address
|
||||
* @param address Must not be null.
|
||||
*/
|
||||
public void setAddress(Address address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user