feat (infra): add filter data that only have children

This commit is contained in:
dpurbosakti
2025-10-04 15:42:40 +07:00
parent 208a1e6123
commit 10ef340d63
2 changed files with 15 additions and 4 deletions
@@ -55,6 +55,16 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.In
plh.SearchCodeOrName(input.Search, tx)
if input.OnlyHaveChildren {
tx = tx.Where(`
EXISTS (
SELECT 1
FROM "Infra" c
WHERE c."Parent_Id" = "Infra"."Id"
)
`)
}
tx = tx.
Model(&e.Infra{}).
Scopes(gh.Filter(input.FilterDto)).