Start adding OrderBy Paramert for filterCDR

This commit is contained in:
TeoV
2018-08-31 10:34:49 -04:00
committed by Dan Christian Bogos
parent ce76251554
commit 2765a24a06
4 changed files with 22 additions and 1 deletions

View File

@@ -1042,6 +1042,11 @@ func (self *SQLStorage) GetCDRs(qryFltr *utils.CDRsFilter, remove bool) ([]*CDR,
if qryFltr.UpdatedAtEnd != nil && !qryFltr.UpdatedAtEnd.IsZero() {
q = q.Where("updated_at < ?", qryFltr.UpdatedAtEnd)
}
// need to check if it's descencent
// after that make a switch to make the parameter compatible
if qryFltr.OrderBy != "" {
q = q.Order(qryFltr.OrderBy)
}
if len(qryFltr.MinUsage) != 0 {
minUsage, err := utils.ParseDurationWithNanosecs(qryFltr.MinUsage)
if err != nil {