Skip to content

Commit 1948a61

Browse files
return full status for cases, including snoozed & waiting for action
1 parent 5ea3804 commit 1948a61

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

dto/case_dto.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func AdaptCaseDto(c models.Case) APICase {
3939
Events: pure_utils.Map(c.Events, NewAPICaseEvent),
4040
InboxId: c.InboxId,
4141
Name: c.Name,
42-
Status: string(c.Status),
42+
Status: c.Status.EnrichedStatus(c.SnoozedUntil, c.Boost),
4343
Outcome: string(c.Outcome),
4444
Tags: pure_utils.Map(c.Tags, NewAPICaseTag),
4545
Files: pure_utils.Map(c.Files, NewAPICaseFile),

models/case.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ func (s CaseStatus) CanTransition(newStatus CaseStatus) bool {
7878
}
7979
}
8080

81+
func (s CaseStatus) EnrichedStatus(snoozedUntil *time.Time, boost *BoostReason) string {
82+
if s == CaseInvestigating && snoozedUntil != nil && snoozedUntil.After(time.Now()) {
83+
return "snoozed"
84+
}
85+
if s == CaseInvestigating && boost != nil {
86+
return "waiting_for_action"
87+
}
88+
return string(s)
89+
}
90+
8191
type CaseOutcome string
8292

8393
const (

0 commit comments

Comments
 (0)