From 5ed80d4516a8e70cc803a8f7a83d8d6bd13dd8f8 Mon Sep 17 00:00:00 2001 From: Amitesh Vijaykumar Magar Date: Wed, 5 Mar 2025 16:30:40 +0530 Subject: [PATCH] NTP-44973 | Return default Houston team when reporting team is inactive (#483) * NTP-44973 | Return default Houston team when reporting team is found inactive. * NTP-44973 | Changing defaultTeamId from constant to env_var. --- config/application.properties | 2 ++ service/incident_service.go | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/application.properties b/config/application.properties index 06462f4..565db9b 100644 --- a/config/application.properties +++ b/config/application.properties @@ -92,6 +92,8 @@ navi.jira.base.url=https://navihq.atlassian.net/browse/ houston.channel.help.message=/houston: General command to open the other options| /houston severity: Opens the view to update severity of the incident| /houston set severity to : Sets the incident severity| /houston team: Opens the view to update team| /houston status: Opens the view to set status| /houston set status to : Sets the incident status| /houston description: Opens the view to set incident description| /houston set description to : Sets the incident description| /houston resolve: Opens the view to fill RCA and resolve| /houston rca: Opens the view to fill RCA non.houston.channel.help.message=/houston: General command to open the other options| /houston start: Opens the view to start a new incident +houston.default.team.id=HOUSTON_DEFAULT_TEAM_ID + jira.base.url=JIRA_BASE_URL jira.username=JIRA_USERNAME jira.api.token=JIRA_API_TOKEN diff --git a/service/incident_service.go b/service/incident_service.go index 3aca28d..b51d239 100644 --- a/service/incident_service.go +++ b/service/incident_service.go @@ -237,8 +237,12 @@ func (i *incidentService) GetIncidentResponseFromIncidentEntity( if incidents[incidentIndex].ReportingTeamId != nil { reportingTeamEntity, err := i.teamService.GetTeamById(*incidents[incidentIndex].ReportingTeamId) if err != nil { - logger.Error("error in fetching reporting team", zap.Error(err)) - return nil, err + logger.Warn("error in fetching reporting team, returning default team") + reportingTeamEntity, err = i.teamService.GetTeamById(viper.GetUint("houston.default.team.id")) + if err != nil { + logger.Error("error in fetching default team", zap.Error(err)) + return nil, err + } } reportingTeamResponse = teamDTOToIncidentHeaderOption(reportingTeamEntity.ToDTO()) }