adjustment detail installation,specialis, subspecialist
This commit is contained in:
@@ -2,6 +2,7 @@ package specialist
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
espb "simrs-vx/internal/domain/main-entities/specialist-position/base"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
@@ -25,8 +26,9 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
@@ -46,16 +48,18 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
SpecialistPositions []espb.Basic `json:"specialistPositions,omitempty"`
|
||||
}
|
||||
|
||||
func (d Specialist) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Unit_Id: d.Unit_Id,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Unit_Id: d.Unit_Id,
|
||||
SpecialistPositions: d.SpecialistPositions,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -2,6 +2,7 @@ package subspecialist
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
espb "simrs-vx/internal/domain/main-entities/subspecialist-position/base"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
@@ -25,8 +26,9 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
@@ -46,9 +48,10 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Subspecialist []espb.Basic `json:"subspecialistPositions,omitempty"`
|
||||
}
|
||||
|
||||
func (d Subspecialist) ToResponse() ResponseDto {
|
||||
@@ -56,6 +59,7 @@ func (d Subspecialist) ToResponse() ResponseDto {
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Specialist_Id: d.Specialist_Id,
|
||||
Subspecialist: d.SubspecialistPositions,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -38,6 +38,8 @@ 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)
|
||||
|
||||
@@ -38,6 +38,8 @@ 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)
|
||||
|
||||
@@ -81,7 +81,9 @@ 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
|
||||
}
|
||||
|
||||
@@ -81,7 +81,9 @@ 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