feat/trx-orders: added includes on prescription

This commit is contained in:
2025-11-01 16:30:34 +07:00
parent e69fe7bbb1
commit 0997537c93
2 changed files with 4 additions and 3 deletions
@@ -34,8 +34,9 @@ type FilterDto struct {
Status_Code *erc.DataStatusCode `json:"status-code"`
}
type ReadDetailDto struct {
Id uint `json:"id"`
Encounter_Id *uint `json:"encounter_id"`
Id uint `json:"id"`
Encounter_Id *uint `json:"encounter_id"`
Includes string `json:"includes"`
}
type UpdateDto struct {
@@ -89,7 +89,7 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
tx = tx.Where("\"Id\" = ?", input.Id)
}
if err := tx.First(&data).Error; err != nil {
if err := tx.Scopes(gh.Preload(input.Includes)).First(&data).Error; err != nil {
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
return nil, processedErr
}