-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add slack client, feedback resolver and a lot of boilerplate
- Loading branch information
1 parent
facdb6a
commit 966c425
Showing
20 changed files
with
668 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package graph | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/nais/api/internal/graph/model" | ||
"k8s.io/utils/ptr" | ||
) | ||
|
||
func (r *mutationResolver) CreateFeedback(ctx context.Context, input model.CreateFeedbackInput) (*model.CreateFeedbackResult, error) { | ||
if len(input.Details) == 0 { | ||
return &model.CreateFeedbackResult{ | ||
Created: false, | ||
Error: ptr.To("Feedback details are required"), | ||
}, nil | ||
} | ||
if len(input.Details) > 3000 { | ||
return &model.CreateFeedbackResult{ | ||
Created: false, | ||
Error: ptr.To("Feedback details must be no more than 3000 characters"), | ||
}, nil | ||
} | ||
|
||
messageOptions := r.slackClient.GetFeedbackMessageOptions(ctx, r.tenant, input) | ||
if _, _, err := r.slackClient.PostFeedbackMessage(messageOptions); err != nil { | ||
return &model.CreateFeedbackResult{ | ||
Created: false, | ||
Error: ptr.To(err.Error()), | ||
}, err | ||
} | ||
|
||
return &model.CreateFeedbackResult{ | ||
Created: true, | ||
Error: nil, | ||
}, nil | ||
} |
Oops, something went wrong.