ongoing
This commit is contained in:
@@ -86,15 +86,6 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
|
||||
// Start log
|
||||
pl.SetLogInfo(&event, input, "started", "readList")
|
||||
|
||||
if input.Encounter_Id == nil {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "data-validation-fail",
|
||||
Detail: "Encounter-Id is required",
|
||||
}
|
||||
return nil, pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||
mwRunner := newMiddlewareRunner(&event, tx)
|
||||
mwRunner.setMwType(pu.MWTPre)
|
||||
@@ -155,6 +146,15 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
|
||||
// Start log
|
||||
pl.SetLogInfo(&event, input, "started", "readDetail")
|
||||
|
||||
if input.Encounter_Id == nil {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "data-validation-fail",
|
||||
Detail: "Encounter-Id is required",
|
||||
}
|
||||
return nil, pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||
mwRunner := newMiddlewareRunner(&event, tx)
|
||||
mwRunner.setMwType(pu.MWTPre)
|
||||
|
||||
@@ -86,6 +86,7 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
|
||||
if err := tx.
|
||||
Scopes(gh.Preload(input.Includes)).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
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