Skip to content

Commit

Permalink
Merge pull request #14 from klovercloud-ci-cd/13_remove_process_depen…
Browse files Browse the repository at this point in the history
…dency_in_pipeline

Fix #13 removed process dependency in pipeline
  • Loading branch information
zeromsi authored Aug 1, 2022
2 parents 300034a + 1464b37 commit d2ae572
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/v1/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func ProcessRouter(g *echo.Group) {

// PipelineRouter api/v1/pipelines router/*
func PipelineRouter(g *echo.Group) {
pipelineRouter := NewPipelineApi(dependency.GetV1PipelineService(), dependency.GetV1LogEventService(), dependency.GetV1ProcessEventService(), dependency.GetV1ProcessService())
pipelineRouter := NewPipelineApi(dependency.GetV1PipelineService(), dependency.GetV1LogEventService(), dependency.GetV1ProcessEventService())
g.GET("", pipelineRouter.Get, AuthenticationAndAuthorizationHandler)
g.GET("/:processId", pipelineRouter.GetById, AuthenticationAndAuthorizationHandler)
g.GET("/ws", pipelineRouter.GetEvents, AuthenticationAndAuthorizationHandlerForWebSocket)
Expand Down
9 changes: 3 additions & 6 deletions api/v1/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ type pipelineApi struct {
pipelineService service.Pipeline
logEventService service.LogEvent
processEventService service.ProcessEvent
processService service.Process
}

var (
Expand Down Expand Up @@ -98,11 +97,10 @@ func (p pipelineApi) GetById(context echo.Context) error {
func (p pipelineApi) GetByProcessId(context echo.Context) error {
processId := context.Param("processId")
companyId := context.QueryParam("companyId")
process := p.processService.GetById(companyId, processId)
if process.ProcessId == "" {
data := p.pipelineService.GetByProcessId(processId)
if data.MetaData.CompanyId != companyId {
return common.GenerateSuccessResponse(context, v1.Pipeline{}, nil, "")
}
data := p.pipelineService.GetByProcessId(processId)
return common.GenerateSuccessResponse(context, data, nil, "")
}

Expand Down Expand Up @@ -189,11 +187,10 @@ func (p pipelineApi) GetEvents(context echo.Context) error {
}

// NewPipelineApi returns Pipeline type api
func NewPipelineApi(pipelineService service.Pipeline, logEventService service.LogEvent, processEventService service.ProcessEvent, processService service.Process) api.Pipeline {
func NewPipelineApi(pipelineService service.Pipeline, logEventService service.LogEvent, processEventService service.ProcessEvent) api.Pipeline {
return &pipelineApi{
pipelineService: pipelineService,
logEventService: logEventService,
processEventService: processEventService,
processService: processService,
}
}

0 comments on commit d2ae572

Please sign in to comment.