diff --git a/service/sourceMap.go b/service/sourceMap.go index a9c6ffc..133f0be 100644 --- a/service/sourceMap.go +++ b/service/sourceMap.go @@ -61,16 +61,16 @@ func (s *SourceMapService) GetSourceMapUploadUrl(ctx *gin.Context) { return } // save state in database - result := *s.dbClient.Create(&db.SourceMap{ - ProjectReferenceId: projectId, - ReleaseReferenceId: releaseId, - FileName: fileName, - State: "IN_PROGRESS", - }) - if result.Error != nil { - ctx.JSON(http.StatusInternalServerError, gin.H{"error": result.Error.Error(), "message": "Failed to source map"}) - return - } + //result := *s.dbClient.Create(&db.SourceMap{ + // ProjectReferenceId: projectId, + // ReleaseReferenceId: releaseId, + // FileName: fileName, + // State: "IN_PROGRESS", + //}) + //if result.Error != nil { + // ctx.JSON(http.StatusInternalServerError, gin.H{"error": result.Error.Error(), "message": "Failed to source map"}) + // return + //} ctx.JSON(http.StatusOK, gin.H{ "url": request.URL, }) @@ -79,27 +79,27 @@ func (s *SourceMapService) GetSourceMapUploadUrl(ctx *gin.Context) { } func (s *SourceMapService) SourceMapUploadAck(c *gin.Context) { - var sourceMapAckBody SourceMapAckBody - if err := c.BindJSON(&sourceMapAckBody); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) - return - } - - //find the record to update ack - var existingSourceMap db.SourceMap - existingRecordError := s.dbClient.First(&existingSourceMap, "project_reference_id = ? and release_reference_id= ? and file_name = ?", sourceMapAckBody.ProjectReferenceId, sourceMapAckBody.ReleaseId, sourceMapAckBody.FileName).Error - if existingRecordError != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": existingRecordError.Error()}) - return - } - - existingSourceMap.State = "DONE" - - err := s.dbClient.Save(&existingSourceMap).Error - if err != nil { - c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) - return - } + //var sourceMapAckBody SourceMapAckBody + //if err := c.BindJSON(&sourceMapAckBody); err != nil { + // c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + // return + //} + // + ////find the record to update ack + //var existingSourceMap db.SourceMap + //existingRecordError := s.dbClient.First(&existingSourceMap, "project_reference_id = ? and release_reference_id= ? and file_name = ?", sourceMapAckBody.ProjectReferenceId, sourceMapAckBody.ReleaseId, sourceMapAckBody.FileName).Error + //if existingRecordError != nil { + // c.JSON(http.StatusBadRequest, gin.H{"error": existingRecordError.Error()}) + // return + //} + // + //existingSourceMap.State = "DONE" + // + //err := s.dbClient.Save(&existingSourceMap).Error + //if err != nil { + // c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + // return + //} c.JSON(http.StatusOK, gin.H{"status": "Source map stored successfully"}) }