Skip to content

Commit 0d1fe83

Browse files
tommytroenybelMekk
andcommitted
refactor: default direction should be asc
Co-authored-by: ybelmekk <[email protected]>
1 parent 3f94d83 commit 0d1fe83

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Diff for: internal/api/grpcvulnerabilities/vulnerabilities.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (s *Server) ListVulnerabilitiesForImage(ctx context.Context, request *vulne
100100
IncludeSuppressed: &request.IncludeSuppressed,
101101
Offset: offset,
102102
Limit: limit,
103-
OrderBy: sanitizeOrderBy(request.OrderBy, ""),
103+
OrderBy: sanitizeOrderBy(request.OrderBy, vulnerabilities.OrderBySeverity),
104104
})
105105

106106
if err != nil {
@@ -246,7 +246,7 @@ func sanitizeOrderBy(orderBy *vulnerabilities.OrderBy, defaultOrder vulnerabilit
246246
if orderBy == nil {
247247
orderBy = &vulnerabilities.OrderBy{
248248
Field: string(defaultOrder),
249-
Direction: vulnerabilities.Direction_DESC,
249+
Direction: vulnerabilities.Direction_ASC,
250250
}
251251
}
252252

Diff for: pkg/api/vulnerabilities/options.go

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package vulnerabilities
22

33
import (
4-
"fmt"
54
"google.golang.org/grpc"
65
)
76

@@ -138,7 +137,6 @@ func Offset(offset int32) Option {
138137
}
139138

140139
func Order(field OrderByField, direction Direction) Option {
141-
fmt.Println(field)
142140
return newFuncOption(func(o *options) {
143141
o.orderBy = &OrderBy{
144142
Field: string(field),

0 commit comments

Comments
 (0)