feat (division): add fk and preloads for parent and childrens

This commit is contained in:
dpurbosakti
2025-10-02 16:19:35 +07:00
parent b10db970d6
commit 47e855f91e
3 changed files with 16 additions and 1 deletions

No files matched your search

@@ -47,9 +47,15 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
tx = dg.I
}
if len(input.Preloads) > 0 {
for _, preload := range input.Preloads {
tx = tx.Preload(preload)
}
}
tx = tx.
Model(&e.Division{}).
Scopes(gh.Filter(input)).
Scopes(gh.Filter(input.FilterDto)).
Count(&count).
Scopes(gh.Paginate(input, &pagination)).
Order("\"CreatedAt\" DESC")