INFRA-3126 : Cleanup of deprecated API's and dead code (#414)
* INFRA-3126 : Cleanup of deprecated API's and dead code * INFRA-3126 : More cleanup
This commit is contained in:
@@ -43,28 +43,6 @@ func NewIncidentHandler(
|
||||
}
|
||||
}
|
||||
|
||||
func (handler *IncidentHandler) HandleCreateIncident(c *gin.Context) {
|
||||
var createIncidentRequest incident.CreateIncidentRequestV2
|
||||
if err := c.ShouldBindJSON(&createIncidentRequest); err != nil {
|
||||
c.JSON(http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err := utils.ValidateCreateIncidentRequestV2(createIncidentRequest); err != nil {
|
||||
logger.Error(fmt.Sprintf("%s Received invalid request to create new incident", logTag), zap.Error(err))
|
||||
c.JSON(http.StatusBadRequest, common.ErrorResponse(err, http.StatusBadRequest, nil))
|
||||
return
|
||||
}
|
||||
incidentResponse, err := handler.service.CreateIncident(createIncidentRequest, "API", "")
|
||||
if err != nil {
|
||||
logger.Error(fmt.Sprintf("%s Failed to create incident", logTag), zap.Error(err))
|
||||
metrics.PublishHoustonFlowFailureMetrics(incidentService.CREATE_INCIDENT, err.Error())
|
||||
c.JSON(http.StatusInternalServerError, common.ErrorResponse(err, http.StatusInternalServerError, nil))
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, common.SuccessResponse(incidentResponse, http.StatusOK))
|
||||
}
|
||||
|
||||
func (handler *IncidentHandler) HandleCreateIncidentV3(c *gin.Context) {
|
||||
var createIncidentRequest incident.CreateIncidentRequestV3
|
||||
if err := c.ShouldBindJSON(&createIncidentRequest); err != nil {
|
||||
|
||||
@@ -29,7 +29,7 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
logger "houston/logger"
|
||||
"houston/logger"
|
||||
)
|
||||
|
||||
type slackHandler struct {
|
||||
|
||||
@@ -161,12 +161,9 @@ func (s *Server) incidentClientHandler(houstonGroup *gin.RouterGroup) {
|
||||
origin := c.Request.Header.Get("Origin")
|
||||
c.Writer.Header().Set("Access-Control-Allow-Origin", origin)
|
||||
})
|
||||
//Will be deprecated because they are not using hosuton group
|
||||
s.gin.POST("/create-incident", incidentHandler.CreateIncident)
|
||||
|
||||
//TODO- Remove these api. Provide Multi Realm support in Internal Web BFF
|
||||
houstonGroup.GET("/incidents/unsecured/v2/:id", incidentHandler.GetIncidents)
|
||||
houstonGroup.POST("/create-incident", incidentHandler.CreateIncident)
|
||||
}
|
||||
|
||||
func (s *Server) productsHandler(houstonGroup *gin.RouterGroup) {
|
||||
@@ -216,7 +213,6 @@ func (s *Server) incidentClientHandlerV2(houstonGroup *gin.RouterGroup) {
|
||||
incidentServiceV2,
|
||||
)
|
||||
incidentHandler := handler.NewIncidentHandler(s.gin, s.db, incidentServiceV2, incidentOrchestrator)
|
||||
houstonGroup.POST("/create-incident-v2", incidentHandler.HandleCreateIncident)
|
||||
houstonGroup.POST("/create-incident-v3", incidentHandler.HandleCreateIncidentV3)
|
||||
|
||||
s.gin.POST("/incidents", authService.IfValidHoustonUser(incidentHandler.HandleUpdateIncident))
|
||||
|
||||
Reference in New Issue
Block a user