Merge pull request #44 from navi-ppl/TP-5555/log-remove
Tp 5555/log remove
This commit is contained in:
@@ -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"})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user