Merge branch 'dev' of https://github.com/dikstub-rssa/simrs-be into feat/sync-seeder
# Conflicts: # internal/interface/main-handler/main-handler.go # internal/use-case/main-use-case/encounter/tycovar.go
This commit is contained in:
@@ -338,3 +338,29 @@ func (obj myBase) CreateWithPatient(w http.ResponseWriter, r *http.Request) {
|
|||||||
res, err := u.CreateWithPatient(dto)
|
res, err := u.CreateWithPatient(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (obj myBase) CreateWithPatient(w http.ResponseWriter, r *http.Request) {
|
||||||
|
authInfo, err := pa.GetAuthInfo(r)
|
||||||
|
if err != nil {
|
||||||
|
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.CreateWithPatientDto{}
|
||||||
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate SubClass
|
||||||
|
if err := verifyClassCode(dto.Encounter); err != nil {
|
||||||
|
rw.DataResponse(w, nil, d.FieldError{
|
||||||
|
Code: dataValidationFail,
|
||||||
|
Message: err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto.Encounter.AuthInfo = *authInfo
|
||||||
|
dto.Patient.AuthInfo = *authInfo
|
||||||
|
res, err := u.CreateWithPatient(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user