mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-25 16:52:17 +00:00
# Which Problems Are Solved This PR implements the endpoints listed in https://github.com/zitadel/zitadel/issues/10443 . # How the Problems Are Solved The implementation follows the same pattern as the Organization one. There are no peculiarities to this PR. The `Update`, `Delete` are implementing the `Commander` interface, while `Get` and `List` instance(s) endpoints are implementing the `Querier` interace. # Additional Context - Closes #10443 - Depends on #10445
57 lines
1.6 KiB
Go
57 lines
1.6 KiB
Go
package domainmock
|
|
|
|
import (
|
|
context "context"
|
|
|
|
gomock "go.uber.org/mock/gomock"
|
|
|
|
domain "github.com/zitadel/zitadel/backend/v3/domain"
|
|
database "github.com/zitadel/zitadel/backend/v3/storage/database"
|
|
"github.com/zitadel/zitadel/backend/v3/storage/database/repository"
|
|
)
|
|
|
|
type InstanceRepo struct {
|
|
domain.InstanceRepository
|
|
mock *MockInstanceRepository
|
|
}
|
|
|
|
func NewInstanceRepo(ctrl *gomock.Controller) *InstanceRepo {
|
|
return &InstanceRepo{
|
|
mock: NewMockInstanceRepository(ctrl),
|
|
InstanceRepository: repository.InstanceRepository(),
|
|
}
|
|
}
|
|
|
|
func (r *InstanceRepo) EXPECT() *MockInstanceRepositoryMockRecorder {
|
|
return r.mock.EXPECT()
|
|
}
|
|
|
|
func (r *InstanceRepo) Get(ctx context.Context, client database.QueryExecutor, opts ...database.QueryOption) (*domain.Instance, error) {
|
|
return r.mock.Get(ctx, client, opts...)
|
|
|
|
}
|
|
|
|
func (r *InstanceRepo) List(ctx context.Context, client database.QueryExecutor, opts ...database.QueryOption) ([]*domain.Instance, error) {
|
|
return r.mock.List(ctx, client, opts...)
|
|
|
|
}
|
|
|
|
func (r *InstanceRepo) Create(ctx context.Context, client database.QueryExecutor, instance *domain.Instance) error {
|
|
return r.mock.Create(ctx, client, instance)
|
|
|
|
}
|
|
|
|
func (r *InstanceRepo) Update(ctx context.Context, client database.QueryExecutor, instanceID string, changes ...database.Change) (int64, error) {
|
|
return r.mock.Update(ctx, client, instanceID, changes...)
|
|
|
|
}
|
|
|
|
func (r *InstanceRepo) Delete(ctx context.Context, client database.QueryExecutor, instanceID string) (int64, error) {
|
|
return r.mock.Delete(ctx, client, instanceID)
|
|
|
|
}
|
|
|
|
func (r *InstanceRepo) LoadDomains() domain.InstanceRepository {
|
|
return r.mock.LoadDomains()
|
|
}
|