Skip to content

Commit

Permalink
chore: allow delete organization when no pipeline-backend started (#187)
Browse files Browse the repository at this point in the history
Because

- We should allow organization deletion even if no pipeline-backend has
started.

This commit

- Allows deletion of an organization when no pipeline-backend has
started.
  • Loading branch information
donch1989 authored Feb 26, 2024
1 parent 9f54034 commit 85e698f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,14 @@ func (s *service) DeleteOrganization(ctx context.Context, ctxUserUID uuid.UUID,
pageToken := ""
pipelineIDList := []string{}
for {
resp, _ := s.pipelinePublicServiceClient.ListOrganizationPipelines(InjectOwnerToContext(ctx, ctxUserUID.String()),
// TODO: optimize this cascade delete
resp, err := s.pipelinePublicServiceClient.ListOrganizationPipelines(InjectOwnerToContext(ctx, ctxUserUID.String()),
&pipelinePB.ListOrganizationPipelinesRequest{
Parent: fmt.Sprintf("organizations/%s", id),
PageToken: &pageToken})
if err != nil {
break
}
for _, connector := range resp.Pipelines {
pipelineIDList = append(pipelineIDList, connector.Id)
}
Expand All @@ -441,10 +445,14 @@ func (s *service) DeleteOrganization(ctx context.Context, ctxUserUID uuid.UUID,
pageToken = ""
connectorIDList := []string{}
for {
resp, _ := s.pipelinePublicServiceClient.ListOrganizationConnectors(InjectOwnerToContext(ctx, ctxUserUID.String()),
// TODO: optimize this cascade delete
resp, err := s.pipelinePublicServiceClient.ListOrganizationConnectors(InjectOwnerToContext(ctx, ctxUserUID.String()),
&pipelinePB.ListOrganizationConnectorsRequest{
Parent: fmt.Sprintf("organizations/%s", id),
PageToken: &pageToken})
if err != nil {
break
}
for _, connector := range resp.Connectors {
connectorIDList = append(connectorIDList, connector.Id)
}
Expand Down

0 comments on commit 85e698f

Please sign in to comment.