This is a pretty big refactor of how communication works to start moving us in the direction we want to go long-term. This adds the new communication row and migrates existing reports to add rows for communication. There's also a bunch of automatic fixes from the new linter. I should have added them separately, but whatever.
29 lines
588 B
Go
29 lines
588 B
Go
package resource
|
|
|
|
import (
|
|
// "github.com/gorilla/schema"
|
|
)
|
|
|
|
type QueryParams struct {
|
|
Limit *int `schema:"limit"`
|
|
OrganizationID *int `schema:"org"`
|
|
Query *string `schema:"query"`
|
|
Sort *string `schema:"sort"`
|
|
Type *string `schema:"type"`
|
|
}
|
|
|
|
func (qp QueryParams) SortOrDefault(default_name string, ascending bool) (string, bool) {
|
|
if qp.Sort == nil {
|
|
return default_name, ascending
|
|
}
|
|
s := *qp.Sort
|
|
if s == "" {
|
|
return default_name, ascending
|
|
}
|
|
a := !(s[0] == '-')
|
|
|
|
if s[0] == '+' || s[0] == '-' {
|
|
s = s[1:]
|
|
}
|
|
return s, a
|
|
}
|