Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

When a location is requested by ID, sort its children location by name, it helps to organize the user interface. (#421)

EdWorth120b6c4815dd1a4
diff --git a/backend/internal/data/repo/repo_locations.go b/backend/internal/data/repo/repo_locations.go
index 7ece91b2..e4686c10 100644
--- a/backend/internal/data/repo/repo_locations.go
+++ b/backend/internal/data/repo/repo_locations.go
@@ -164,7 +164,9 @@ func (r *LocationRepository) getOne(ctx context.Context, where ...predicate.Loca
Where(where...).
WithGroup().
WithParent().
- WithChildren().
+ WithChildren(func(lq *ent.LocationQuery) {
+ lq.Order(location.ByName())
+ }).
Only(ctx))
}