mirror of
https://github.com/MeshTender/MeshTender.git
synced 2026-09-16 08:32:37 +00:00
Sort by name on logged in page
This commit is contained in:
@@ -346,7 +346,7 @@ func (s *Store) ListOrgsForUser(ctx context.Context, userID int64) ([]OrgMembers
|
||||
rows, err := s.pool.Query(ctx, `
|
||||
SELECT o.id, o.slug, o.name, o.description, o.created_by, o.created_at, m.role
|
||||
FROM org_members m JOIN organizations o ON o.id = m.org_id
|
||||
WHERE m.user_id = $1 ORDER BY o.name`, userID)
|
||||
WHERE m.user_id = $1 ORDER BY lower(o.name), o.id`, userID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("list orgs: %w", err)
|
||||
}
|
||||
|
||||
@@ -126,14 +126,14 @@ func scanRepeater(row pgx.Row) (*Repeater, error) {
|
||||
}
|
||||
|
||||
// ListRepeatersForUser returns repeaters the user owns or has been granted
|
||||
// access to, owned ones first.
|
||||
// access to, owned ones first and then by name within each group.
|
||||
func (s *Store) ListRepeatersForUser(ctx context.Context, userID int64) ([]*Repeater, error) {
|
||||
// Dashboard listing: repeaters the user owns or has a direct share on. Org-
|
||||
// contributed repeaters are reached from the org page, not listed here.
|
||||
rows, err := s.pool.Query(ctx, repeaterSelect+`
|
||||
WHERE r.owner_id = $1
|
||||
OR r.id IN (SELECT repeater_id FROM repeater_shares WHERE user_id = $1)
|
||||
ORDER BY shared, r.created_at`, userID)
|
||||
ORDER BY shared, lower(r.name), r.id`, userID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("list repeaters: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user