adjustment detail installation,specialis, subspecialist
This commit is contained in:
No files matched your search
@@ -2,6 +2,7 @@ package specialist
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
espb "simrs-vx/internal/domain/main-entities/specialist-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
@@ -25,8 +26,9 @@ type FilterDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint16 `json:"id"`
|
||||||
Code *string `json:"code"`
|
Code *string `json:"code"`
|
||||||
|
Includes string `json:"includes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateDto struct {
|
type UpdateDto struct {
|
||||||
@@ -46,16 +48,18 @@ type MetaDto struct {
|
|||||||
|
|
||||||
type ResponseDto struct {
|
type ResponseDto struct {
|
||||||
ecore.SmallMain
|
ecore.SmallMain
|
||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Unit_Id *uint16 `json:"unit_id"`
|
Unit_Id *uint16 `json:"unit_id"`
|
||||||
|
SpecialistPositions []espb.Basic `json:"specialistPositions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Specialist) ToResponse() ResponseDto {
|
func (d Specialist) ToResponse() ResponseDto {
|
||||||
resp := ResponseDto{
|
resp := ResponseDto{
|
||||||
Code: d.Code,
|
Code: d.Code,
|
||||||
Name: d.Name,
|
Name: d.Name,
|
||||||
Unit_Id: d.Unit_Id,
|
Unit_Id: d.Unit_Id,
|
||||||
|
SpecialistPositions: d.SpecialistPositions,
|
||||||
}
|
}
|
||||||
resp.SmallMain = d.SmallMain
|
resp.SmallMain = d.SmallMain
|
||||||
return resp
|
return resp
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package subspecialist
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
espb "simrs-vx/internal/domain/main-entities/subspecialist-position/base"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
@@ -25,8 +26,9 @@ type FilterDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint16 `json:"id"`
|
||||||
Code *string `json:"code"`
|
Code *string `json:"code"`
|
||||||
|
Includes string `json:"includes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateDto struct {
|
type UpdateDto struct {
|
||||||
@@ -46,9 +48,10 @@ type MetaDto struct {
|
|||||||
|
|
||||||
type ResponseDto struct {
|
type ResponseDto struct {
|
||||||
ecore.SmallMain
|
ecore.SmallMain
|
||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Specialist_Id *uint16 `json:"specialist_id"`
|
Specialist_Id *uint16 `json:"specialist_id"`
|
||||||
|
Subspecialist []espb.Basic `json:"subspecialistPositions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Subspecialist) ToResponse() ResponseDto {
|
func (d Subspecialist) ToResponse() ResponseDto {
|
||||||
@@ -56,6 +59,7 @@ func (d Subspecialist) ToResponse() ResponseDto {
|
|||||||
Code: d.Code,
|
Code: d.Code,
|
||||||
Name: d.Name,
|
Name: d.Name,
|
||||||
Specialist_Id: d.Specialist_Id,
|
Specialist_Id: d.Specialist_Id,
|
||||||
|
Subspecialist: d.SubspecialistPositions,
|
||||||
}
|
}
|
||||||
resp.SmallMain = d.SmallMain
|
resp.SmallMain = d.SmallMain
|
||||||
return resp
|
return resp
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dto := e.ReadDetailDto{}
|
dto := e.ReadDetailDto{}
|
||||||
|
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint16(id)
|
||||||
res, err := u.ReadDetail(dto)
|
res, err := u.ReadDetail(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dto := e.ReadDetailDto{}
|
dto := e.ReadDetailDto{}
|
||||||
|
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint16(id)
|
||||||
res, err := u.ReadDetail(dto)
|
res, err := u.ReadDetail(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
|||||||
tx = dg.I
|
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 {
|
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||||
return nil, processedErr
|
return nil, processedErr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
|||||||
tx = dg.I
|
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 {
|
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||||
return nil, processedErr
|
return nil, processedErr
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user