A continuation of HomeBox the inventory and organization system built for the Home User
feat: order labels and locations by name (#86)
Haydenbb86a51b0577
diff --git a/backend/internal/repo/repo_items.go b/backend/internal/repo/repo_items.goindex 7dd81aec..64715ca4 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),)diff --git a/backend/internal/repo/repo_labels.go b/backend/internal/repo/repo_labels.goindex 567b3f81..b899d68e 100644--- a/backend/internal/repo/repo_labels.go+++ b/backend/internal/repo/repo_labels.go@@ -84,6 +84,7 @@ func (r *LabelRepository) GetOneByGroup(ctx context.Context, gid, ld uuid.UUID)func (r *LabelRepository) GetAll(ctx context.Context, groupId uuid.UUID) ([]LabelSummary, error) {return mapLabelsOut(r.db.Label.Query().Where(label.HasGroupWith(group.ID(groupId))).+ Order(ent.Asc(label.FieldName)).WithGroup().All(ctx),)diff --git a/backend/internal/repo/repo_locations.go b/backend/internal/repo/repo_locations.goindex 74946908..8a60202c 100644--- a/backend/internal/repo/repo_locations.go+++ b/backend/internal/repo/repo_locations.go@@ -94,7 +94,9 @@ func (r *LocationRepository) GetAll(ctx context.Context, groupId uuid.UUID) ([]LlocationsWHERElocations.group_locations = ?- `+ ORDER BY+ locations.name ASC+`rows, err := r.db.Sql().QueryContext(ctx, query, groupId)if err != nil {