Files
houston-be/internal/processor/start_incident_command_processor.go
Shashank Shekhar 233c632d38 INFRA-2866 | Create and update incident with assigner and responder from slack (#394)
* INFRA-2866 | create incident modal with product

* INFRA-2866 | Update product flow

* INFRA-2866 | Resolving review comments

* INFRA-2866 | Adding default values for product, assigner and responder

* INFRA-2866 | bug fix in getting assigner and responder team

* INFRA-2866 | bug-fix: users in no team are not getting products

* INFRA-2866 | adding log lines

* INFRA-2866 | adding assigner team members into incident

* INFRA-2866 | updated help command response text

* INFRA-2866 | adding assigner team members by severity

* INFRA-2866 | updating product list for users with no product

* INFRA-2866 | assigner teams = (teamsOfUser ++ teamsOfSelectedProducts)

* INFRA-2866 | renamed assigner to reporting team

* INFRA-2866 | query to seed product as others for current open incidents without any product
2024-03-19 16:26:30 +05:30

44 lines
1.4 KiB
Go

package processor
import (
"fmt"
"github.com/slack-go/slack/socketmode"
"houston/internal/processor/action"
"houston/logger"
"houston/pkg/slackbot"
"houston/service/orchestration"
"houston/service/products"
)
type StartIncidentCommandProcessor struct {
productsService products.ProductService
incidentOrchestrator orchestration.IncidentOrchestrator
socketModeClient *socketmode.Client
startIncidentCommandAction *action.StartIncidentCommandAction
}
const StartIncidentCommandProcessorLogTag = "[start_incident_command_processor]"
func NewStartIncidentCommandProcessor(
productsService products.ProductService,
incidentOrchestrator orchestration.IncidentOrchestrator,
socketModeClient *socketmode.Client,
slackBot *slackbot.Client,
) *StartIncidentCommandProcessor {
return &StartIncidentCommandProcessor{
productsService: productsService,
socketModeClient: socketModeClient,
startIncidentCommandAction: action.NewStartIncidentCommandAction(productsService, incidentOrchestrator, socketModeClient, slackBot),
}
}
func (processor *StartIncidentCommandProcessor) ProcessSlashCommand(event *socketmode.Event) {
defer func() {
if r := recover(); r != nil {
logger.Error(fmt.Sprintf("%s Exception occurred: %+v", StartIncidentCommandProcessorLogTag, r.(error)))
}
}()
processor.startIncidentCommandAction.PerformAction(event)
}