TP-55555/houston-integration (#21)
Co-authored-by: github-cicd <github.cicd@navi.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"cybertron/constants"
|
||||
"cybertron/models/db"
|
||||
"cybertron/pkg/houstonClient"
|
||||
"cybertron/pkg/kafka/producer"
|
||||
@@ -41,11 +42,14 @@ func NewHoustonService(logger *log.Logger, dbClient *gorm.DB, kafkaProducer prod
|
||||
|
||||
func (houstonService *HoustonService) CreateHouston(c *gin.Context) {
|
||||
var request CreateHoustonRequest
|
||||
userEmail := c.GetHeader(constants.EMAIL_HEADER_NAME)
|
||||
if err := c.BindJSON(&request); err != nil {
|
||||
fmt.Println("Error binding JSON:", err)
|
||||
createErrorResponse(c, http.StatusBadRequest, "Invalid request payload")
|
||||
return
|
||||
}
|
||||
request.CreatedBy = userEmail
|
||||
request.ErrorID = ""
|
||||
|
||||
fmt.Println("Received request payload:", request)
|
||||
|
||||
@@ -108,7 +112,7 @@ func (houstonService *HoustonService) GetProducts(c *gin.Context) {
|
||||
|
||||
func (houstonService *HoustonService) GetResponderTeam(c *gin.Context) {
|
||||
// read query params
|
||||
productID := c.QueryArray("productID")
|
||||
productID := c.QueryArray("productId")
|
||||
|
||||
// Get the responder team using the houstonClient
|
||||
responderTeam, err := houstonService.houstonClient.GetReportingAndResponder(productID)
|
||||
@@ -145,12 +149,6 @@ func validateCreateHoustonRequest(request CreateHoustonRequest) []string {
|
||||
if len(request.ProductIds) == 0 {
|
||||
missingFields = append(missingFields, "productIds")
|
||||
}
|
||||
if request.CreatedBy == "" {
|
||||
missingFields = append(missingFields, "createdBy")
|
||||
}
|
||||
if request.ErrorID == "" {
|
||||
missingFields = append(missingFields, "errorId")
|
||||
}
|
||||
return missingFields
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user