Skip to content

Commit

Permalink
feat: upsert service data (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
FemiNoviaLina authored Jun 3, 2024
1 parent 4220b2b commit 17e3f21
Show file tree
Hide file tree
Showing 38 changed files with 5,507 additions and 4,721 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ GOVERSION := $(shell go version | cut -d ' ' -f 3 | cut -d '.' -f 2)

.PHONY: build check fmt lint test test-race vet test-cover-html help install proto
.DEFAULT_GOAL := build
PROTON_COMMIT := "7e380e055d82cd8378989354785f6434d8615d70"
PROTON_COMMIT := "633ae3ee704338ef2620c9387849dfede86e8ddf"

install:
@echo "Clean up imports..."
Expand Down
2 changes: 1 addition & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func StartServer(logger *log.Zap, cfg *config.Shield) error {
return err
}

schemaMigrationConfig := schema.NewSchemaMigrationConfig(cfg.App.DefaultSystemEmail, cfg.App.BootstrapServiceDataKey)
schemaMigrationConfig := schema.NewSchemaMigrationConfig(cfg.App.DefaultSystemEmail, cfg.App.ServiceData.BootstrapEnabled)

appConfig := activity.AppConfig{Version: config.Version}
var activityRepository activity.Repository
Expand Down
7 changes: 1 addition & 6 deletions core/namespace/definition.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package namespace

var systemIdsDefinition = []string{DefinitionTeam.ID, DefinitionUser.ID, DefinitionOrg.ID, DefinitionProject.ID, DefinitionServiceDataKey.ID}
var systemIdsDefinition = []string{DefinitionTeam.ID, DefinitionUser.ID, DefinitionOrg.ID, DefinitionProject.ID}

var DefinitionOrg = Namespace{
ID: "shield/organization",
Expand All @@ -21,8 +21,3 @@ var DefinitionUser = Namespace{
ID: "shield/user",
Name: "User",
}

var DefinitionServiceDataKey = Namespace{
ID: "shield/servicedata_key",
Name: "Service Data Key",
}
4 changes: 4 additions & 0 deletions core/resource/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ func NewService(logger log.Logger, repository Repository, configRepository Confi
}
}

func (s Service) GetByURN(ctx context.Context, id string) (Resource, error) {
return s.repository.GetByURN(ctx, id)
}

func (s Service) Get(ctx context.Context, id string) (Resource, error) {
return s.repository.GetByID(ctx, id)
}
Expand Down
1 change: 1 addition & 0 deletions core/servicedata/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ import "errors"
var (
ErrInvalidDetail = errors.New("invalid service data detail")
ErrConflict = errors.New("key already exist")
ErrNotExist = errors.New("service data not exist")
)
69 changes: 68 additions & 1 deletion core/servicedata/mocks/relation_service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions core/servicedata/mocks/resource_service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 114 additions & 0 deletions core/servicedata/mocks/servicedata_repository.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 17e3f21

Please sign in to comment.