From f67c369a22d798cedee69e3a39efbd2e1a53c951 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sat, 3 Dec 2022 22:33:27 -0800 Subject: [PATCH] make SyncSourceResources exposed, so it can be used in Cloud version. --- backend/pkg/web/handler/source.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/pkg/web/handler/source.go b/backend/pkg/web/handler/source.go index 5624bddc..6fdbca11 100644 --- a/backend/pkg/web/handler/source.go +++ b/backend/pkg/web/handler/source.go @@ -1,6 +1,7 @@ package handler import ( + "context" "fmt" "github.com/fastenhealth/fasten-sources/clients/factory" sourceModels "github.com/fastenhealth/fasten-sources/clients/models" @@ -36,7 +37,7 @@ func CreateSource(c *gin.Context) { } // after creating the source, we should do a bulk import - summary, err := syncSourceResources(c, logger, databaseRepo, sourceCred) + summary, err := SyncSourceResources(c, logger, databaseRepo, sourceCred) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"success": false}) return @@ -59,7 +60,7 @@ func SourceSync(c *gin.Context) { } // after creating the source, we should do a bulk import - summary, err := syncSourceResources(c, logger, databaseRepo, *sourceCred) + summary, err := SyncSourceResources(c, logger, databaseRepo, *sourceCred) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"success": false}) return @@ -236,8 +237,7 @@ func RawRequestSource(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"success": true, "data": resp}) } -////// private functions -func syncSourceResources(c *gin.Context, logger *logrus.Entry, databaseRepo database.DatabaseRepository, sourceCred models.SourceCredential) (sourceModels.UpsertSummary, error) { +func SyncSourceResources(c context.Context, logger *logrus.Entry, databaseRepo database.DatabaseRepository, sourceCred models.SourceCredential) (sourceModels.UpsertSummary, error) { // after creating the source, we should do a bulk import sourceClient, updatedSource, err := factory.GetSourceClient(sourcePkg.GetFastenEnv(), sourceCred.SourceType, c, logger, sourceCred) if err != nil {