TP-5555 | last seen support

This commit is contained in:
varnit goyal
2024-11-18 14:45:04 +05:30
parent 8bf9d72fe2
commit 697b105fe1

View File

@@ -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"})
}