remove query.Sorting from registration.go

Signed-off-by: Divya Pamecha <21123621+Its-Maniaco@users.noreply.github.com>
This commit is contained in:
Divya Pamecha 2024-02-06 13:29:58 +05:30
parent f910c5654b
commit 75df6195ac
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")
}