[R4] Add active attribute to doctor entity

This commit is contained in:
Mirna Gama 2024-01-05 18:39:07 -03:00 committed by Mirna Gama
parent 2ee9727c80
commit 34071ec1d8
2 changed files with 24 additions and 0 deletions

View File

@ -30,6 +30,7 @@ public class Doctor {
* @see DoctorDTO
*/
public Doctor(DoctorDTO doctorDTO) {
this.active=true;
this.name=doctorDTO.name();
this.email=doctorDTO.email();
this.crm=doctorDTO.crm();
@ -63,6 +64,10 @@ public class Doctor {
@Enumerated(EnumType.STRING)
private Specialty specialty;
@NotNull(message="active cannot be null")
@Column(name="active")
private Boolean active;
@NotNull(message="address cannot be null")
@Embedded
private Address address;
@ -164,6 +169,22 @@ public class Doctor {
this.specialty = specialty;
}
/**
* Returns the active
* @return A boolean value that states whether the doctor is active in the system
*/
public Boolean getActive() {
return active;
}
/**
* Sets the active
* @param active Must not be null. Starts with the true value by default
*/
public void setActive(Boolean active) {
this.active = active;
}
/**
* Returns the address
* @return An object class representing the doctor's address.

View File

@ -0,0 +1,3 @@
alter table doctors add active tinyint;
update doctors set active = 1;