adding lastupdatedBy in team and severity, fixing empty user list issue (#40)
* 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
This commit is contained in:
committed by
GitHub Enterprise
parent
31d5a37868
commit
65913a8644
@@ -9,6 +9,9 @@ import (
|
||||
)
|
||||
|
||||
func (c *Client) GetUsersInfo(users ...string) (*[]slack.User, error) {
|
||||
if len(users) == 0 {
|
||||
return &[]slack.User{}, nil
|
||||
}
|
||||
userInfo, err := c.socketModeClient.GetUsersInfo(users...)
|
||||
if err != nil {
|
||||
c.logger.Error("get users info failed", zap.Any("users", users), zap.Error(err))
|
||||
|
||||
@@ -2,6 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"houston/model/severity"
|
||||
"time"
|
||||
|
||||
"github.com/lib/pq"
|
||||
)
|
||||
@@ -13,6 +14,7 @@ type SeverityResponse struct {
|
||||
Sla int `json:"sla"`
|
||||
SlackUserIds pq.StringArray `json:"slackUserIds"`
|
||||
Participants []UserResponse `json:"participants,omitempty"`
|
||||
UpdatedAt time.Time `json:"lastUpdatedAt,omitempty"`
|
||||
}
|
||||
|
||||
func ConvertToSeverityResponse(severityEntity severity.SeverityEntity) SeverityResponse {
|
||||
@@ -22,5 +24,6 @@ func ConvertToSeverityResponse(severityEntity severity.SeverityEntity) SeverityR
|
||||
Description: severityEntity.Description,
|
||||
Sla: severityEntity.Sla,
|
||||
SlackUserIds: severityEntity.SlackUserIds,
|
||||
UpdatedAt: severityEntity.Model.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,21 +2,24 @@ package service
|
||||
|
||||
import (
|
||||
"houston/model/team"
|
||||
"time"
|
||||
|
||||
"github.com/lib/pq"
|
||||
)
|
||||
|
||||
type TeamResponse struct {
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
SlackUserIds pq.StringArray `json:"slackUserIds"`
|
||||
Participants []UserResponse `json:"participants,omitempty"`
|
||||
ID uint `json:"id"`
|
||||
Name string `json:"name"`
|
||||
SlackUserIds pq.StringArray `json:"slackUserIds"`
|
||||
Participants []UserResponse `json:"participants,omitempty"`
|
||||
UpdatedAt time.Time `json:"lastUpdatedAt,omitempty"`
|
||||
}
|
||||
|
||||
func ConvertToTeamResponse(teamEntity team.TeamEntity) (TeamResponse) {
|
||||
return TeamResponse {
|
||||
ID: teamEntity.ID,
|
||||
Name: teamEntity.Name,
|
||||
func ConvertToTeamResponse(teamEntity team.TeamEntity) TeamResponse {
|
||||
return TeamResponse{
|
||||
ID: teamEntity.ID,
|
||||
Name: teamEntity.Name,
|
||||
SlackUserIds: teamEntity.SlackUserIds,
|
||||
UpdatedAt: teamEntity.Model.UpdatedAt,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ func (s *severityService) GetSeverities(c *gin.Context) {
|
||||
Description: severity.Description,
|
||||
Sla: severity.Sla,
|
||||
SlackUserIds: severity.SlackUserIds,
|
||||
UpdatedAt: severity.Model.UpdatedAt,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ func(u *userService) GetUsersInConversation(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
usersData := *usersInfo
|
||||
var usersResponses []service.UserResponse
|
||||
var usersResponses []service.UserResponse = []service.UserResponse{}
|
||||
|
||||
for userInfo := range usersData {
|
||||
usersResponses = append(usersResponses, service.UserResponse{
|
||||
|
||||
Reference in New Issue
Block a user