@@ -70,7 +70,8 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id uint16 `json:"id"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
@@ -119,8 +120,8 @@ type ResponseDto struct {
|
||||
Member_Number *string `json:"member_number"`
|
||||
Ref_Number *string `json:"ref_number"`
|
||||
Trx_Number *string `json:"trx_number"`
|
||||
Appointment_Doctor_Id *uint `json:"assignment_doctor_id"`
|
||||
Appointment_Doctor *ed.Doctor `json:"assignment_doctor,omitempty"`
|
||||
Appointment_Doctor_Id *uint `json:"appointment_doctor_id"`
|
||||
Appointment_Doctor *ed.Doctor `json:"appointment_doctor,omitempty"`
|
||||
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
|
||||
Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty"`
|
||||
Adm_Employee_Id *uint `json:"adm_employee_id"`
|
||||
|
||||
@@ -49,6 +49,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
|
||||
@@ -116,7 +116,6 @@ func SetRoutes() http.Handler {
|
||||
r.HandleFunc("/", home.Home)
|
||||
|
||||
r.HandleFunc("POST /v1/authentication/login", auth.Login)
|
||||
// r.HandleFunc("POST /v1/authentication/logout", auth.Logout)
|
||||
hk.Route("POST /v1/authentication/logout", r, auth.GuardMW, auth.Logout)
|
||||
hc.RegCrud(r, "/v1/practice-schedule", practiceschedule.O)
|
||||
hc.RegCrud(r, "/v1/counter", counter.O)
|
||||
|
||||
@@ -35,7 +35,7 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/encounter"
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
ero "simrs-vx/internal/domain/references/organization"
|
||||
erg "simrs-vx/internal/domain/references/organization"
|
||||
)
|
||||
|
||||
func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Encounter) {
|
||||
@@ -113,7 +113,7 @@ func checkSoapiByDocExists(encounter_id uint, event *pl.Event, tx *gorm.DB) erro
|
||||
}
|
||||
|
||||
for _, s := range soapies {
|
||||
if s.Employee != nil && s.Employee.User != nil && *s.Employee.Position_Code == ero.EPCDoc {
|
||||
if s.Employee != nil && *s.Employee.Position_Code == erg.EPCDoc {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
||||
if err := tx.Scopes(gh.Preload(input.Includes)).First(&data, input.Id).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user