remove the CreateSource endpoint from backend api.

This commit is contained in:
Jason Kulatunga 2022-10-06 17:57:31 -07:00
parent e031163932
commit 349b627845
2 changed files with 0 additions and 31 deletions

View File

@ -14,36 +14,6 @@ import (
"strings" "strings"
) )
func CreateSource(c *gin.Context) {
logger := c.MustGet("LOGGER").(*logrus.Entry)
databaseRepo := c.MustGet("REPOSITORY").(database.DatabaseRepository)
sourceCred := models.Source{}
if err := c.ShouldBindJSON(&sourceCred); err != nil {
logger.Errorln("An error occurred while parsing posted source credential", err)
c.JSON(http.StatusBadRequest, gin.H{"success": false})
return
}
logger.Infof("Parsed Create Source Credentials Payload: %v", sourceCred)
err := databaseRepo.CreateSource(c, &sourceCred)
if err != nil {
logger.Errorln("An error occurred while storing source credential", err)
c.JSON(http.StatusInternalServerError, gin.H{"success": false})
return
}
// after creating the source, we should do a bulk import
err = syncSourceResources(c, logger, databaseRepo, sourceCred)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"success": false})
return
}
c.JSON(http.StatusOK, gin.H{"success": true, "data": sourceCred})
}
func SourceSync(c *gin.Context) { func SourceSync(c *gin.Context) {
logger := c.MustGet("LOGGER").(*logrus.Entry) logger := c.MustGet("LOGGER").(*logrus.Entry)
databaseRepo := c.MustGet("REPOSITORY").(database.DatabaseRepository) databaseRepo := c.MustGet("REPOSITORY").(database.DatabaseRepository)

View File

@ -47,7 +47,6 @@ func (ae *AppEngine) Setup(logger *logrus.Entry) *gin.Engine {
{ {
secure.GET("/summary", handler.GetSummary) secure.GET("/summary", handler.GetSummary)
secure.POST("/source", handler.CreateSource)
secure.POST("/source/manual", handler.CreateManualSource) secure.POST("/source/manual", handler.CreateManualSource)
secure.GET("/source", handler.ListSource) secure.GET("/source", handler.ListSource)
secure.GET("/source/:sourceId", handler.GetSource) secure.GET("/source/:sourceId", handler.GetSource)