Skip to content

Commit

Permalink
fix: PluginInit should be implemented on struct (apache#6325)
Browse files Browse the repository at this point in the history
  • Loading branch information
klesh committed Oct 25, 2023
1 parent a0821bb commit 66e4f63
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 11 additions & 10 deletions backend/plugins/customize/impl/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ var _ interface {
plugin.PluginMigration
} = (*Customize)(nil)

var handlers *api.Handlers

type Customize struct {
handlers *api.Handlers
}

func (p *Customize) Init(basicRes context.BasicRes) errors.Error {
p.handlers = api.NewHandlers(basicRes.GetDal())
func (p Customize) Init(basicRes context.BasicRes) errors.Error {
handlers = api.NewHandlers(basicRes.GetDal())
return nil
}

Expand Down Expand Up @@ -89,23 +90,23 @@ func (p Customize) RootPkgPath() string {
return "github.com/apache/incubator-devlake/plugins/customize"
}

func (p *Customize) ApiResources() map[string]map[string]plugin.ApiResourceHandler {
func (p Customize) ApiResources() map[string]map[string]plugin.ApiResourceHandler {
return map[string]map[string]plugin.ApiResourceHandler{
":table/fields": {
"GET": p.handlers.ListFields,
"POST": p.handlers.CreateFields,
"GET": handlers.ListFields,
"POST": handlers.CreateFields,
},
":table/fields/:field": {
"DELETE": p.handlers.DeleteField,
"DELETE": handlers.DeleteField,
},
"csvfiles/issues.csv": {
"POST": p.handlers.ImportIssue,
"POST": handlers.ImportIssue,
},
"csvfiles/issue_commits.csv": {
"POST": p.handlers.ImportIssueCommit,
"POST": handlers.ImportIssueCommit,
},
"csvfiles/issue_repo_commits.csv": {
"POST": p.handlers.ImportIssueRepoCommit,
"POST": handlers.ImportIssueRepoCommit,
},
}
}
2 changes: 1 addition & 1 deletion backend/plugins/jira/impl/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (p Jira) ScopeConfig() dal.Tabler {
return &models.JiraScopeConfig{}
}

func (p *Jira) Init(basicRes context.BasicRes) errors.Error {
func (p Jira) Init(basicRes context.BasicRes) errors.Error {
api.Init(basicRes, p)

return nil
Expand Down

0 comments on commit 66e4f63

Please sign in to comment.