This commit is contained in:
Maniaco 2024-04-29 08:45:14 +08:00 committed by GitHub
commit 1ad476e4a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -123,8 +123,14 @@ func ListRegistrations(ctx context.Context, query *q.Query) ([]*Registration, er
}
// Order the list
if query.Sorting != "" {
qs = qs.OrderBy(query.Sorting)
if len(query.Sorts) > 0 {
for _, sort := range query.Sorts {
sortKey := sort.Key
if sort.DESC {
sortKey += " DESC"
}
qs = qs.OrderBy(sortKey)
}
} else {
qs = qs.OrderBy("-is_default", "-create_time")
}