abeizn commented on code in PR #6146:
URL: 
https://github.com/apache/incubator-devlake/pull/6146#discussion_r1338507265


##########
backend/plugins/github/api/init.go:
##########
@@ -18,69 +18,44 @@ limitations under the License.
 package api
 
 import (
-       "strconv"
-
        "github.com/apache/incubator-devlake/core/plugin"
 
        "github.com/apache/incubator-devlake/core/context"
-       "github.com/apache/incubator-devlake/core/dal"
-       "github.com/apache/incubator-devlake/core/errors"
        "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
+       "github.com/apache/incubator-devlake/helpers/srvhelper"
        "github.com/apache/incubator-devlake/plugins/github/models"
        "github.com/go-playground/validator/v10"
 )
 
 var vld *validator.Validate
+
+// var connSrv *srvhelper.ConnectionSrvHelper[models.GithubConnection, 
models.GithubRepo, models.GithubScopeConfig]
+var connApi *api.DsConnectionApiHelper[models.GithubConnection, 
models.GithubRepo, models.GithubScopeConfig]
+var scopeSrv *srvhelper.ScopeSrvHelper[models.GithubConnection, 
models.GithubRepo, models.GithubScopeConfig]
+var scopeApi *api.DsScopeApiHelper[models.GithubConnection, models.GithubRepo, 
models.GithubScopeConfig]
+var scSrv *srvhelper.ScopeConfigSrvHelper[models.GithubConnection, 
models.GithubRepo, models.GithubScopeConfig]
+var scApi *api.DsScopeConfigApiHelper[models.GithubConnection, 
models.GithubRepo, models.GithubScopeConfig]
 var connectionHelper *api.ConnectionApiHelper
-var scopeHelper *api.ScopeApiHelper[models.GithubConnection, 
models.GithubRepo, models.GithubScopeConfig]
 var basicRes context.BasicRes
-var scHelper *api.ScopeConfigHelper[models.GithubScopeConfig]
 var remoteHelper *api.RemoteApiHelper[models.GithubConnection, 
models.GithubRepo, repo, plugin.ApiGroup]
 
 func Init(br context.BasicRes, p plugin.PluginMeta) {
-
        basicRes = br
+       _, connApi, scopeSrv, scopeApi, scSrv, scApi = api.NewDataSourceHelpers[
+               models.GithubConnection,
+               models.GithubRepo, models.GithubScopeConfig,
+       ](
+               br,
+               "github",
+               []string{"full_name"},
+       )
+       // TODO: refactor remoteHelper
        vld = validator.New()
        connectionHelper = api.NewConnectionHelper(
                basicRes,
                vld,
                p.Name(),
        )
-       params := &api.ReflectionParameters{
-               ScopeIdFieldName:     "GithubId",
-               ScopeIdColumnName:    "github_id",
-               RawScopeParamName:    "Name",
-               SearchScopeParamName: "name",

Review Comment:
   If these are removed, how to implement the data scope search function. I 
don't see any assignment operations to these anywhere else?
   
   
![image](https://github.com/apache/incubator-devlake/assets/101256042/957ff95d-518b-4b24-a3a8-7e6f901e636f)
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@devlake.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to