feat (vaccine-data): add migration and fix entity
This commit is contained in:
@@ -37,11 +37,11 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if pu.IsDateBeforeNow(input.Vaccination_datetime) {
|
||||
return errors.New("vaccination date is in the past")
|
||||
if pu.IsDateBeforeNow(input.GivenDate) {
|
||||
return errors.New("given date is in the past")
|
||||
}
|
||||
if pu.IsDateBeforeNow(input.Vaccine_expiration_date) {
|
||||
return errors.New("vaccine expiration date is in the past")
|
||||
if pu.IsDateBeforeNow(input.ExpirationDate) {
|
||||
return errors.New("expiration date is in the past")
|
||||
}
|
||||
|
||||
// check if encounter is done
|
||||
@@ -206,10 +206,10 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if pu.IsDateBeforeNow(input.Vaccination_datetime) {
|
||||
if pu.IsDateBeforeNow(input.GivenDate) {
|
||||
return errors.New("vaccination date is in the past")
|
||||
}
|
||||
if pu.IsDateBeforeNow(input.Vaccine_expiration_date) {
|
||||
if pu.IsDateBeforeNow(input.ExpirationDate) {
|
||||
return errors.New("vaccine expiration date is in the past")
|
||||
}
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.VaccineData) {
|
||||
inputSrc = &inputTemp.CreateDto
|
||||
}
|
||||
|
||||
data.Type = inputSrc.Type
|
||||
data.Encounter_Id = inputSrc.Encounter_Id
|
||||
data.Vaccine_type_Code = inputSrc.Vaccine_type_Code
|
||||
data.Vaccine_batch_number = inputSrc.Vaccine_batch_number
|
||||
data.Vaccine_dose = inputSrc.Vaccine_dose
|
||||
data.Dose_order = inputSrc.Dose_order
|
||||
data.Injection_location = inputSrc.Injection_location
|
||||
data.Vaccination_datetime = inputSrc.Vaccination_datetime
|
||||
data.Vaccine_expiration_date = inputSrc.Vaccine_expiration_date
|
||||
data.BatchNumber = inputSrc.BatchNumber
|
||||
data.Dose = inputSrc.Dose
|
||||
data.DoseOrder = inputSrc.DoseOrder
|
||||
data.InjectionLocation = inputSrc.InjectionLocation
|
||||
data.GivenDate = inputSrc.GivenDate
|
||||
data.ExpirationDate = inputSrc.ExpirationDate
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user