From 7a818b818d7a39007525d81839baf947d0994781 Mon Sep 17 00:00:00 2001 From: ks2 Date: Tue, 1 Aug 2023 15:53:38 +0530 Subject: [PATCH 1/5] Removed validation for send_after to make it 0 by default --- notification/request.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/notification/request.go b/notification/request.go index 5b4bf73..660bef8 100644 --- a/notification/request.go +++ b/notification/request.go @@ -558,9 +558,6 @@ func validateStep(step *og.Step, actionType ActionType) error { if step.Contact.MethodOfContact == "" { return errors.New("Method cannot be empty.") } - if (actionType == CreateAlert || actionType == AssignedAlert) && step.SendAfter == nil { - return errors.New("SendAfter cannot be empty.") - } return nil } From c69324e0418e03a995f32fa745bd0102d5dcbea8 Mon Sep 17 00:00:00 2001 From: ks2 Date: Tue, 1 Aug 2023 20:07:56 +0530 Subject: [PATCH 2/5] Validate SendAfter to be true always --- notification/request.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/notification/request.go b/notification/request.go index 660bef8..f49e61d 100644 --- a/notification/request.go +++ b/notification/request.go @@ -558,6 +558,9 @@ func validateStep(step *og.Step, actionType ActionType) error { if step.Contact.MethodOfContact == "" { return errors.New("Method cannot be empty.") } + if (actionType == CreateAlert || actionType == AssignedAlert) && step.SendAfter == nil && false { + return errors.New("SendAfter cannot be empty.") + } return nil } From ab023dfac4dd336d2d8163c80d5ee2cf35e489c8 Mon Sep 17 00:00:00 2001 From: ks2 Date: Thu, 3 Aug 2023 15:04:06 +0530 Subject: [PATCH 3/5] Removes send after validation --- notification/request.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/notification/request.go b/notification/request.go index f49e61d..660bef8 100644 --- a/notification/request.go +++ b/notification/request.go @@ -558,9 +558,6 @@ func validateStep(step *og.Step, actionType ActionType) error { if step.Contact.MethodOfContact == "" { return errors.New("Method cannot be empty.") } - if (actionType == CreateAlert || actionType == AssignedAlert) && step.SendAfter == nil && false { - return errors.New("SendAfter cannot be empty.") - } return nil } From 0dce97e55578f0c0ef66d47ef977fba801fa0b7f Mon Sep 17 00:00:00 2001 From: ks2 Date: Thu, 3 Aug 2023 15:52:41 +0530 Subject: [PATCH 4/5] Removed omitempty from the SendAfter datatype --- notification/request.go | 3 +++ og/entity.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/notification/request.go b/notification/request.go index 660bef8..0ebe9e9 100644 --- a/notification/request.go +++ b/notification/request.go @@ -558,6 +558,9 @@ func validateStep(step *og.Step, actionType ActionType) error { if step.Contact.MethodOfContact == "" { return errors.New("Method cannot be empty.") } + if (actionType == CreateAlert || actionType == AssignedAlert) && step.SendAfter == nil{ + return errors.New("SendAfter cannot be empty.") + } return nil } diff --git a/og/entity.go b/og/entity.go index 2215d9a..2882459 100644 --- a/og/entity.go +++ b/og/entity.go @@ -346,7 +346,7 @@ const ( ) type SendAfter struct { - TimeAmount uint32 `json:"timeAmount,omitempty"` + TimeAmount uint32 `json:"timeAmount"` TimeUnit string `json:"timeUnit,omitempty"` } From fa4df0facdbe63ed379ee716bb2b0efa4657f18d Mon Sep 17 00:00:00 2001 From: ks2 Date: Thu, 3 Aug 2023 15:56:32 +0530 Subject: [PATCH 5/5] Indendation fix --- notification/request.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notification/request.go b/notification/request.go index 0ebe9e9..5b4bf73 100644 --- a/notification/request.go +++ b/notification/request.go @@ -558,7 +558,7 @@ func validateStep(step *og.Step, actionType ActionType) error { if step.Contact.MethodOfContact == "" { return errors.New("Method cannot be empty.") } - if (actionType == CreateAlert || actionType == AssignedAlert) && step.SendAfter == nil{ + if (actionType == CreateAlert || actionType == AssignedAlert) && step.SendAfter == nil { return errors.New("SendAfter cannot be empty.") }