diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
index 2eb8bcbb..bc641538 100644
--- a/.idea/dataSources.xml
+++ b/.idea/dataSources.xml
@@ -8,5 +8,17 @@
jdbc:sqlite:$PROJECT_DIR$/fasten.db
$ProjectFileDir$
+
+ sqlite.xerial
+ true
+ org.sqlite.JDBC
+ jdbc:sqlite:$PROJECT_DIR$/fasten-jason.db
+ $ProjectFileDir$
+
+
+ file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.40.1/org/xerial/sqlite-jdbc/3.40.1.0/sqlite-jdbc-3.40.1.0.jar
+
+
+
\ No newline at end of file
diff --git a/backend/pkg/web/handler/unsafe.go b/backend/pkg/web/handler/unsafe.go
index 0096fdc5..d7dc7822 100644
--- a/backend/pkg/web/handler/unsafe.go
+++ b/backend/pkg/web/handler/unsafe.go
@@ -1,11 +1,13 @@
package handler
import (
+ "fmt"
"github.com/fastenhealth/fasten-sources/clients/factory"
sourcePkg "github.com/fastenhealth/fasten-sources/pkg"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/config"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/database"
+ "github.com/fastenhealth/fastenhealth-onprem/backend/pkg/models"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
"net/http"
@@ -79,6 +81,22 @@ func UnsafeRequestSource(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"success": false, "error": err.Error(), "data": resp})
return
}
+
+ //update source incase the access token/refresh token has been updated
+ sourceCredential := client.GetSourceCredential()
+ sourceCredentialConcrete, ok := sourceCredential.(*models.SourceCredential)
+ if !ok {
+ logger.Errorln("An error occurred while updating source credential, source credential is not of type *models.SourceCredential")
+ c.JSON(http.StatusOK, gin.H{"success": false, "data": resp, "error": fmt.Errorf("An error occurred while updating source credential, source credential is not of type *models.SourceCredential")})
+ return
+ }
+ err = databaseRepo.UpdateSource(c, sourceCredentialConcrete)
+ if err != nil {
+ logger.Errorf("An error occurred while updating source credential: %v", err)
+ c.JSON(http.StatusOK, gin.H{"success": false, "data": resp, "error": fmt.Errorf("An error occurred while updating source credential: %v", err)})
+ return
+ }
+
c.JSON(http.StatusOK, gin.H{"success": true, "data": resp})
}