Formatting changes (#46)
* TP-0000 | fixing get incident issue * TP-0000 | adding lastupdatedBy in team and severity, fixing empty user list issue * TP-0000 | reformatting * TP-0000 | reformatting * TP-0000 | reformatting * TP-0000 | reformatting * TP-0000 | formatting changes * TP-0000 | formatting changes * TP-0000 | formatting changes
This commit is contained in:
committed by
GitHub Enterprise
parent
3364635c2e
commit
a89525839d
@@ -111,7 +111,7 @@ func updatingSevForEachInc(logger *zap.Logger, incidents []incident.IncidentEnti
|
||||
s := action.NewIncidentChannelMessageUpdateAction(socketModeClient, logger, incidentService, teamService, severityService)
|
||||
s.ProcessAction(incidents[i].SlackChannel)
|
||||
|
||||
msgOption := slack.MsgOptionText(fmt.Sprintf("hoston escalated incident to %s", severityString), false)
|
||||
msgOption := slack.MsgOptionText(fmt.Sprintf("houston escalated incident to %s", severityString), false)
|
||||
_, _, errMessage := socketModeClient.PostMessage(incidents[i].SlackChannel, msgOption)
|
||||
if errMessage != nil {
|
||||
logger.Error("PostMessage failed for cronJob ", zap.Error(errMessage), zap.Int("incidentId", int(incidents[i].ID)))
|
||||
|
||||
@@ -66,7 +66,7 @@ func (cip *CreateIncidentAction) CreateIncidentModalCommandProcessing(callback s
|
||||
|
||||
go func() {
|
||||
// Post incident summary to Blaze Group channel and incident channel
|
||||
timestamp, err := cip.postIncidentSummary(callback.View.PrivateMetadata, *channelID, incidentEntity, teamEntity,
|
||||
_, err := cip.postIncidentSummary(callback.View.PrivateMetadata, *channelID, incidentEntity, teamEntity,
|
||||
severityEntity, incidentStatusEntity)
|
||||
if err != nil {
|
||||
cip.logger.Error("[CIP] error while posting incident summary", zap.Error(err))
|
||||
@@ -81,8 +81,7 @@ func (cip *CreateIncidentAction) CreateIncidentModalCommandProcessing(callback s
|
||||
}
|
||||
|
||||
if len(strings.TrimSpace(teamEntity.OncallHandle)) > 0 {
|
||||
cip.tagOncallToIncident(int(incidentEntity.TeamId), *channelID)
|
||||
cip.InviteOnCallPersonToIncident(*channelID, *timestamp)
|
||||
cip.tagOncallToIncident(int(incidentEntity.TeamId), *channelID)
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ func NewSeverityRepository(logger *zap.Logger, gormClient *gorm.DB) *Repository
|
||||
|
||||
func (r *Repository) GetAllActiveSeverity() (*[]SeverityEntity, error) {
|
||||
var severityEntity []SeverityEntity
|
||||
result := r.gormClient.Where("deleted_at is NULL").Find(&severityEntity)
|
||||
result := r.gormClient.Where("deleted_at is NULL").Order("id asc").Find(&severityEntity)
|
||||
if result.Error != nil {
|
||||
r.logger.Error("fetching severity query failed", zap.Error(result.Error))
|
||||
return nil, result.Error
|
||||
@@ -61,10 +61,10 @@ func (s *Repository) FindSeverityById(severityId uint) (*SeverityEntity, error)
|
||||
return &severityEntity, nil
|
||||
}
|
||||
|
||||
func (s *Repository) Update(severityEntity *SeverityEntity) (error) {
|
||||
func (s *Repository) Update(severityEntity *SeverityEntity) error {
|
||||
result := s.gormClient.Updates(severityEntity)
|
||||
if result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ func NewTeamRepository(logger *zap.Logger, gormClient *gorm.DB) *Repository {
|
||||
func (r *Repository) GetAllActiveTeams() (*[]TeamEntity, error) {
|
||||
var teamEntity []TeamEntity
|
||||
|
||||
result := r.gormClient.Find(&teamEntity, "active = ?", true)
|
||||
result := r.gormClient.Order("name asc").Find(&teamEntity, "active = ?", true)
|
||||
if result.Error != nil {
|
||||
return nil, result.Error
|
||||
} else if result.RowsAffected == 0 {
|
||||
@@ -48,4 +48,4 @@ func (r *Repository) UpdateTeam(teamEntity *TeamEntity) error {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ func (s *severityService) GetSeverities(c *gin.Context) {
|
||||
Description: severity.Description,
|
||||
Sla: severity.Sla,
|
||||
SlackUserIds: severity.SlackUserIds,
|
||||
UpdatedAt: severity.Model.UpdatedAt,
|
||||
UpdatedAt: severity.Model.UpdatedAt,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -93,12 +93,16 @@ func (s *severityService) GetSeverities(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (s *severityService) UpdateSeverities(c *gin.Context) {
|
||||
userEmail := c.GetHeader("X-User-Email")
|
||||
|
||||
var updateSeverityRequest request.UpdateSeveritiesRequest
|
||||
if err := c.ShouldBindJSON(&updateSeverityRequest); err != nil {
|
||||
c.JSON(http.StatusInternalServerError, common.ErrorResponse(err, http.StatusBadRequest, nil))
|
||||
return
|
||||
}
|
||||
|
||||
s.logger.Info("update request received", zap.String("userEmail", userEmail), zap.Any("request", updateSeverityRequest))
|
||||
|
||||
err := utils.ValidateUpdateSeverityRequest(updateSeverityRequest)
|
||||
if err != nil {
|
||||
s.logger.Error("error in validating update severties request", zap.Error(err))
|
||||
|
||||
@@ -88,6 +88,8 @@ func (t *teamService) GetTeams(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (t *teamService) UpdateTeam(c *gin.Context) {
|
||||
userEmail := c.GetHeader("X-User-Email")
|
||||
|
||||
teamRepository := team.NewTeamRepository(t.logger, t.db)
|
||||
|
||||
var updateTeamRequest request.UpdateTeamRequest
|
||||
@@ -96,6 +98,8 @@ func (t *teamService) UpdateTeam(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
t.logger.Info("update team request received", zap.String("userEmail", userEmail), zap.Any("request", updateTeamRequest))
|
||||
|
||||
err := utils.ValidateUpdateTeamRequest(updateTeamRequest)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, common.ErrorResponse(err, http.StatusBadRequest, nil))
|
||||
|
||||
Reference in New Issue
Block a user