From 0210bd30149c037f75a5374f106ce4eb61025398 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 15 Oct 2022 13:23:51 -0800 Subject: [PATCH] sort items --- backend/internal/repo/repo_items.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/internal/repo/repo_items.go b/backend/internal/repo/repo_items.go index 7dd81ae..64715ca 100644 --- a/backend/internal/repo/repo_items.go +++ b/backend/internal/repo/repo_items.go @@ -24,6 +24,7 @@ type ( Search string `json:"search"` LocationIDs []uuid.UUID `json:"locationIds"` LabelIDs []uuid.UUID `json:"labelIds"` + SortBy string `json:"sortBy"` } ItemCreate struct { @@ -252,7 +253,8 @@ func (e *ItemsRepository) QueryByGroup(ctx context.Context, gid uuid.UUID, q Ite } items, err := mapItemsSummaryErr( - qb.WithLabel(). + qb.Order(ent.Asc(item.FieldName)). + WithLabel(). WithLocation(). All(ctx), )