fix(ticket): guard stale responses and stale hours
This commit is contained in:
@@ -2,12 +2,10 @@ package dashboard
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"cs-agent/internal/builders"
|
||||
"cs-agent/internal/pkg/constants"
|
||||
"cs-agent/internal/pkg/dto/request"
|
||||
"cs-agent/internal/pkg/enums"
|
||||
"cs-agent/internal/services"
|
||||
|
||||
"github.com/kataras/iris/v12"
|
||||
@@ -46,9 +44,7 @@ func (c *TicketController) AnyList() *web.JsonResult {
|
||||
cnd.Eq("current_assignee_id", 0)
|
||||
}
|
||||
if staleHours, _ := params.GetInt(c.Ctx, "staleHours"); staleHours > 0 {
|
||||
cnd.
|
||||
NotEq("status", enums.TicketStatusDone).
|
||||
Where("updated_at < ?", time.Now().Add(-time.Duration(staleHours)*time.Hour))
|
||||
services.TicketService.ApplyStaleFilter(cnd, staleHours)
|
||||
}
|
||||
aggregate, err := services.TicketService.FindPageAggregateByCnd(cnd, operator.UserID)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user