* INFRA-3664 : Make get users in conversation api more performant * INFRA-3664 : Add apis for incident user sync and get users in incident performance improvements * INFRA-3664 : Self review * INFRA-3664 : Add migration script * INFRA-3664 : Review comments * INFRA-3664 : Constant chanes * INFRA-3664 : Add rate limit constants * INFRA-3664 : Add rate limit constants * INFRA-3664 : Fix failing tests * INFRA-3664 : Add UT's
40 lines
889 B
Go
40 lines
889 B
Go
package requestStatus
|
|
|
|
type RequestType string
|
|
|
|
const SyncIncidentUsersRequestType RequestType = "SYNC_INCIDENT_USERS"
|
|
|
|
type RequestStatus interface {
|
|
Value() string
|
|
IsTerminal() bool
|
|
}
|
|
|
|
type Pending struct{}
|
|
|
|
func (Pending) Value() string { return "PENDING" }
|
|
|
|
func (Pending) IsTerminal() bool { return false }
|
|
|
|
type Success struct{}
|
|
|
|
func (Success) Value() string { return "SUCCESS" }
|
|
func (Success) IsTerminal() bool { return true }
|
|
|
|
type Failed struct{}
|
|
|
|
func (Failed) Value() string { return "FAILED" }
|
|
func (Failed) IsTerminal() bool { return true }
|
|
|
|
func GetAllStatusValuesByTerminalState(isTerminal bool) []string {
|
|
var statusValues []string
|
|
allStatuses := []RequestStatus{Pending{}, Success{}, Failed{}}
|
|
|
|
for _, status := range allStatuses {
|
|
if status.IsTerminal() == isTerminal {
|
|
statusValues = append(statusValues, status.Value())
|
|
}
|
|
}
|
|
|
|
return statusValues
|
|
}
|