change ids into codes for device-order,material-order,mcu-order
This commit is contained in:
No files matched your search
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/material-order"
|
||||
|
||||
ud "simrs-vx/internal/use-case/main-use-case/doctor"
|
||||
ue "simrs-vx/internal/use-case/main-use-case/encounter"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
@@ -56,11 +55,7 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
doctor_id, err := ud.GetIdByUserId(&input.AuthInfo.User_Id, &event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
input.Doctor_Id = doctor_id
|
||||
input.Doctor_Code = input.AuthInfo.Doctor_Code
|
||||
|
||||
if resData, err := CreateData(input, &event, tx); err != nil {
|
||||
return err
|
||||
@@ -233,12 +228,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
doctor_id, err := ud.GetIdByUserId(&input.AuthInfo.User_Id, &event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !data.IsSameDoctor(doctor_id) {
|
||||
if !data.IsSameDoctor(input.AuthInfo.Doctor_Code) {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "auth-forbidden",
|
||||
@@ -248,7 +238,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
input.Doctor_Id = doctor_id
|
||||
input.Doctor_Code = input.AuthInfo.Doctor_Code
|
||||
|
||||
if err := UpdateData(input, data, &event, tx); err != nil {
|
||||
return err
|
||||
|
||||
@@ -21,5 +21,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.MaterialOrder) {
|
||||
}
|
||||
|
||||
data.Encounter_Id = inputSrc.Encounter_Id
|
||||
data.Doctor_Id = inputSrc.Doctor_Id
|
||||
data.Doctor_Code = inputSrc.Doctor_Code
|
||||
}
|
||||
Reference in New Issue
Block a user