Documentation ¶
Overview ¶
Package project is a generated GoMock package.
Index ¶
- Constants
- Variables
- type AddMembersOption
- type CreateProjectOption
- type DeleteProjectOption
- type MockRepository
- func (m *MockRepository) AddMembers(ctx context.Context, projectID string, members []entity.Member) error
- func (m *MockRepository) Create(ctx context.Context, project entity.Project) (string, error)
- func (m *MockRepository) DeleteOne(ctx context.Context, projectID string) error
- func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
- func (m *MockRepository) FindAll(ctx context.Context) ([]entity.Project, error)
- func (m *MockRepository) Get(ctx context.Context, projectID string) (entity.Project, error)
- func (m *MockRepository) RemoveMembers(ctx context.Context, projectID string, users []entity.User) error
- func (m *MockRepository) UpdateArchived(ctx context.Context, projectID string, archived bool) error
- func (m *MockRepository) UpdateDescription(ctx context.Context, projectID, description string) error
- func (m *MockRepository) UpdateMembersAccessLevel(ctx context.Context, projectID string, users []entity.User, ...) error
- func (m *MockRepository) UpdateName(ctx context.Context, projectID, name string) error
- type MockRepositoryMockRecorder
- func (mr *MockRepositoryMockRecorder) AddMembers(ctx, projectID, members interface{}) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Create(ctx, project interface{}) *gomock.Call
- func (mr *MockRepositoryMockRecorder) DeleteOne(ctx, projectID interface{}) *gomock.Call
- func (mr *MockRepositoryMockRecorder) FindAll(ctx interface{}) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Get(ctx, projectID interface{}) *gomock.Call
- func (mr *MockRepositoryMockRecorder) RemoveMembers(ctx, projectID, users interface{}) *gomock.Call
- func (mr *MockRepositoryMockRecorder) UpdateArchived(ctx, projectID, archived interface{}) *gomock.Call
- func (mr *MockRepositoryMockRecorder) UpdateDescription(ctx, projectID, description interface{}) *gomock.Call
- func (mr *MockRepositoryMockRecorder) UpdateMembersAccessLevel(ctx, projectID, users, accessLevel interface{}) *gomock.Call
- func (mr *MockRepositoryMockRecorder) UpdateName(ctx, projectID, name interface{}) *gomock.Call
- type MockUseCase
- func (m *MockUseCase) AddMembers(ctx context.Context, opt AddMembersOption) (entity.Project, error)
- func (m *MockUseCase) Create(ctx context.Context, opt CreateProjectOption) (entity.Project, error)
- func (m *MockUseCase) Delete(ctx context.Context, opt DeleteProjectOption) (*entity.Project, error)
- func (m *MockUseCase) EXPECT() *MockUseCaseMockRecorder
- func (m *MockUseCase) FindAll(ctx context.Context) ([]entity.Project, error)
- func (m *MockUseCase) GetByID(ctx context.Context, projectID string) (entity.Project, error)
- func (m *MockUseCase) RemoveMembers(ctx context.Context, opt RemoveMembersOption) (entity.Project, error)
- func (m *MockUseCase) Update(ctx context.Context, opt UpdateProjectOption) (entity.Project, error)
- func (m *MockUseCase) UpdateKDLProjects(ctx context.Context) error
- func (m *MockUseCase) UpdateMembers(ctx context.Context, opt UpdateMembersOption) (entity.Project, error)
- type MockUseCaseMockRecorder
- func (mr *MockUseCaseMockRecorder) AddMembers(ctx, opt interface{}) *gomock.Call
- func (mr *MockUseCaseMockRecorder) Create(ctx, opt interface{}) *gomock.Call
- func (mr *MockUseCaseMockRecorder) Delete(ctx, opt interface{}) *gomock.Call
- func (mr *MockUseCaseMockRecorder) FindAll(ctx interface{}) *gomock.Call
- func (mr *MockUseCaseMockRecorder) GetByID(ctx, projectID interface{}) *gomock.Call
- func (mr *MockUseCaseMockRecorder) RemoveMembers(ctx, opt interface{}) *gomock.Call
- func (mr *MockUseCaseMockRecorder) Update(ctx, opt interface{}) *gomock.Call
- func (mr *MockUseCaseMockRecorder) UpdateKDLProjects(ctx interface{}) *gomock.Call
- func (mr *MockUseCaseMockRecorder) UpdateMembers(ctx, opt interface{}) *gomock.Call
- type MockUserActivityRepo
- type MockUserActivityRepoMockRecorder
- type RemoveMembersOption
- type Repository
- type UpdateMembersOption
- type UpdateProjectOption
- type UseCase
- type UserActivityRepo
Constants ¶
const (
MemberAccessLevelOnCreation = entity.AccessLevelViewer
)
Variables ¶
var ( ErrWrongAccessLevel = errors.New("only admin users can delete projects") ErrRepoNotFound = errors.New("repo not found") )
var ( ErrRemoveNoMoreAdmins = errors.New("there are not more admin members so the user cannot be removed") ErrUpdateNoMoreAdmins = errors.New("there are not more admin members so the user cannot be updated") ErrOnlyAdminCanAddMember = errors.New("only admins can add members") ErrOnlyAdminCanRemoveMember = errors.New("only admins can remove members") ErrOnlyAdminCanUpdateMember = errors.New("only admins can update members") ErrMemberAlreadyExists = errors.New("member already exists") ErrMemberNotExists = errors.New("member not exists in the project") )
var (
ErrCreateProjectValidation = errors.New("create project validation error")
)
Functions ¶
This section is empty.
Types ¶
type AddMembersOption ¶
AddMembersOption options when removing a project member.
type CreateProjectOption ¶
type CreateProjectOption struct { ProjectID string Name string Description string URL *string Username *string Owner entity.User }
CreateProjectOption options when creating project.
func (CreateProjectOption) Validate ¶
func (c CreateProjectOption) Validate() error
Validate check that the CreateProjectOption properties are valid.
type DeleteProjectOption ¶
DeleteProjectOption options when deleting a project.
type MockRepository ¶
type MockRepository struct {
// contains filtered or unexported fields
}
MockRepository is a mock of Repository interface.
func NewMockRepository ¶
func NewMockRepository(ctrl *gomock.Controller) *MockRepository
NewMockRepository creates a new mock instance.
func (*MockRepository) AddMembers ¶
func (m *MockRepository) AddMembers(ctx context.Context, projectID string, members []entity.Member) error
AddMembers mocks base method.
func (*MockRepository) DeleteOne ¶
func (m *MockRepository) DeleteOne(ctx context.Context, projectID string) error
DeleteOne mocks base method.
func (*MockRepository) EXPECT ¶
func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRepository) RemoveMembers ¶
func (m *MockRepository) RemoveMembers(ctx context.Context, projectID string, users []entity.User) error
RemoveMembers mocks base method.
func (*MockRepository) UpdateArchived ¶
UpdateArchived mocks base method.
func (*MockRepository) UpdateDescription ¶
func (m *MockRepository) UpdateDescription(ctx context.Context, projectID, description string) error
UpdateDescription mocks base method.
func (*MockRepository) UpdateMembersAccessLevel ¶
func (m *MockRepository) UpdateMembersAccessLevel(ctx context.Context, projectID string, users []entity.User, accessLevel entity.AccessLevel) error
UpdateMembersAccessLevel mocks base method.
func (*MockRepository) UpdateName ¶
func (m *MockRepository) UpdateName(ctx context.Context, projectID, name string) error
UpdateName mocks base method.
type MockRepositoryMockRecorder ¶
type MockRepositoryMockRecorder struct {
// contains filtered or unexported fields
}
MockRepositoryMockRecorder is the mock recorder for MockRepository.
func (*MockRepositoryMockRecorder) AddMembers ¶
func (mr *MockRepositoryMockRecorder) AddMembers(ctx, projectID, members interface{}) *gomock.Call
AddMembers indicates an expected call of AddMembers.
func (*MockRepositoryMockRecorder) Create ¶
func (mr *MockRepositoryMockRecorder) Create(ctx, project interface{}) *gomock.Call
Create indicates an expected call of Create.
func (*MockRepositoryMockRecorder) DeleteOne ¶
func (mr *MockRepositoryMockRecorder) DeleteOne(ctx, projectID interface{}) *gomock.Call
DeleteOne indicates an expected call of DeleteOne.
func (*MockRepositoryMockRecorder) FindAll ¶
func (mr *MockRepositoryMockRecorder) FindAll(ctx interface{}) *gomock.Call
FindAll indicates an expected call of FindAll.
func (*MockRepositoryMockRecorder) Get ¶
func (mr *MockRepositoryMockRecorder) Get(ctx, projectID interface{}) *gomock.Call
Get indicates an expected call of Get.
func (*MockRepositoryMockRecorder) RemoveMembers ¶
func (mr *MockRepositoryMockRecorder) RemoveMembers(ctx, projectID, users interface{}) *gomock.Call
RemoveMembers indicates an expected call of RemoveMembers.
func (*MockRepositoryMockRecorder) UpdateArchived ¶
func (mr *MockRepositoryMockRecorder) UpdateArchived(ctx, projectID, archived interface{}) *gomock.Call
UpdateArchived indicates an expected call of UpdateArchived.
func (*MockRepositoryMockRecorder) UpdateDescription ¶
func (mr *MockRepositoryMockRecorder) UpdateDescription(ctx, projectID, description interface{}) *gomock.Call
UpdateDescription indicates an expected call of UpdateDescription.
func (*MockRepositoryMockRecorder) UpdateMembersAccessLevel ¶
func (mr *MockRepositoryMockRecorder) UpdateMembersAccessLevel(ctx, projectID, users, accessLevel interface{}) *gomock.Call
UpdateMembersAccessLevel indicates an expected call of UpdateMembersAccessLevel.
func (*MockRepositoryMockRecorder) UpdateName ¶
func (mr *MockRepositoryMockRecorder) UpdateName(ctx, projectID, name interface{}) *gomock.Call
UpdateName indicates an expected call of UpdateName.
type MockUseCase ¶
type MockUseCase struct {
// contains filtered or unexported fields
}
MockUseCase is a mock of UseCase interface.
func NewMockUseCase ¶
func NewMockUseCase(ctrl *gomock.Controller) *MockUseCase
NewMockUseCase creates a new mock instance.
func (*MockUseCase) AddMembers ¶
func (m *MockUseCase) AddMembers(ctx context.Context, opt AddMembersOption) (entity.Project, error)
AddMembers mocks base method.
func (*MockUseCase) Create ¶
func (m *MockUseCase) Create(ctx context.Context, opt CreateProjectOption) (entity.Project, error)
Create mocks base method.
func (*MockUseCase) Delete ¶
func (m *MockUseCase) Delete(ctx context.Context, opt DeleteProjectOption) (*entity.Project, error)
Delete mocks base method.
func (*MockUseCase) EXPECT ¶
func (m *MockUseCase) EXPECT() *MockUseCaseMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockUseCase) RemoveMembers ¶
func (m *MockUseCase) RemoveMembers(ctx context.Context, opt RemoveMembersOption) (entity.Project, error)
RemoveMembers mocks base method.
func (*MockUseCase) Update ¶
func (m *MockUseCase) Update(ctx context.Context, opt UpdateProjectOption) (entity.Project, error)
Update mocks base method.
func (*MockUseCase) UpdateKDLProjects ¶
func (m *MockUseCase) UpdateKDLProjects(ctx context.Context) error
UpdateKDLProjects mocks base method.
func (*MockUseCase) UpdateMembers ¶
func (m *MockUseCase) UpdateMembers(ctx context.Context, opt UpdateMembersOption) (entity.Project, error)
UpdateMembers mocks base method.
type MockUseCaseMockRecorder ¶
type MockUseCaseMockRecorder struct {
// contains filtered or unexported fields
}
MockUseCaseMockRecorder is the mock recorder for MockUseCase.
func (*MockUseCaseMockRecorder) AddMembers ¶
func (mr *MockUseCaseMockRecorder) AddMembers(ctx, opt interface{}) *gomock.Call
AddMembers indicates an expected call of AddMembers.
func (*MockUseCaseMockRecorder) Create ¶
func (mr *MockUseCaseMockRecorder) Create(ctx, opt interface{}) *gomock.Call
Create indicates an expected call of Create.
func (*MockUseCaseMockRecorder) Delete ¶
func (mr *MockUseCaseMockRecorder) Delete(ctx, opt interface{}) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockUseCaseMockRecorder) FindAll ¶
func (mr *MockUseCaseMockRecorder) FindAll(ctx interface{}) *gomock.Call
FindAll indicates an expected call of FindAll.
func (*MockUseCaseMockRecorder) GetByID ¶
func (mr *MockUseCaseMockRecorder) GetByID(ctx, projectID interface{}) *gomock.Call
GetByID indicates an expected call of GetByID.
func (*MockUseCaseMockRecorder) RemoveMembers ¶
func (mr *MockUseCaseMockRecorder) RemoveMembers(ctx, opt interface{}) *gomock.Call
RemoveMembers indicates an expected call of RemoveMembers.
func (*MockUseCaseMockRecorder) Update ¶
func (mr *MockUseCaseMockRecorder) Update(ctx, opt interface{}) *gomock.Call
Update indicates an expected call of Update.
func (*MockUseCaseMockRecorder) UpdateKDLProjects ¶
func (mr *MockUseCaseMockRecorder) UpdateKDLProjects(ctx interface{}) *gomock.Call
UpdateKDLProjects indicates an expected call of UpdateKDLProjects.
func (*MockUseCaseMockRecorder) UpdateMembers ¶
func (mr *MockUseCaseMockRecorder) UpdateMembers(ctx, opt interface{}) *gomock.Call
UpdateMembers indicates an expected call of UpdateMembers.
type MockUserActivityRepo ¶
type MockUserActivityRepo struct {
// contains filtered or unexported fields
}
MockUserActivityRepo is a mock of UserActivityRepo interface.
func NewMockUserActivityRepo ¶
func NewMockUserActivityRepo(ctrl *gomock.Controller) *MockUserActivityRepo
NewMockUserActivityRepo creates a new mock instance.
func (*MockUserActivityRepo) Create ¶
func (m *MockUserActivityRepo) Create(ctx context.Context, activity entity.UserActivity) error
Create mocks base method.
func (*MockUserActivityRepo) EXPECT ¶
func (m *MockUserActivityRepo) EXPECT() *MockUserActivityRepoMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockUserActivityRepoMockRecorder ¶
type MockUserActivityRepoMockRecorder struct {
// contains filtered or unexported fields
}
MockUserActivityRepoMockRecorder is the mock recorder for MockUserActivityRepo.
func (*MockUserActivityRepoMockRecorder) Create ¶
func (mr *MockUserActivityRepoMockRecorder) Create(ctx, activity interface{}) *gomock.Call
Create indicates an expected call of Create.
type RemoveMembersOption ¶
RemoveMembersOption options when removing a project member.
type Repository ¶
type Repository interface { Get(ctx context.Context, projectID string) (entity.Project, error) Create(ctx context.Context, project entity.Project) (string, error) FindAll(ctx context.Context) ([]entity.Project, error) AddMembers(ctx context.Context, projectID string, members []entity.Member) error RemoveMembers(ctx context.Context, projectID string, users []entity.User) error UpdateMembersAccessLevel(ctx context.Context, projectID string, users []entity.User, accessLevel entity.AccessLevel) error UpdateName(ctx context.Context, projectID, name string) error UpdateDescription(ctx context.Context, projectID, description string) error UpdateArchived(ctx context.Context, projectID string, archived bool) error DeleteOne(ctx context.Context, projectID string) error }
Repository interface to retrieve and persists projects.
type UpdateMembersOption ¶
type UpdateMembersOption struct { ProjectID string Users []entity.User AccessLevel entity.AccessLevel LoggedUser entity.User }
UpdateMembersOption options when updating a project member.
type UpdateProjectOption ¶
type UpdateProjectOption struct { ProjectID string Name *string Description *string Archived *bool }
UpdateProjectOption options when updating a project member.
type UseCase ¶
type UseCase interface { Create(ctx context.Context, opt CreateProjectOption) (entity.Project, error) FindAll(ctx context.Context) ([]entity.Project, error) GetByID(ctx context.Context, projectID string) (entity.Project, error) AddMembers(ctx context.Context, opt AddMembersOption) (entity.Project, error) RemoveMembers(ctx context.Context, opt RemoveMembersOption) (entity.Project, error) UpdateMembers(ctx context.Context, opt UpdateMembersOption) (entity.Project, error) Update(ctx context.Context, opt UpdateProjectOption) (entity.Project, error) Delete(ctx context.Context, opt DeleteProjectOption) (*entity.Project, error) UpdateKDLProjects(ctx context.Context) error }
UseCase interface to manage all operations related with projects.
func NewInteractor ¶
func NewInteractor( logger logr.Logger, k8sClient k8s.ClientInterface, minioService minioservice.MinioService, realClock clock.Clock, projectRepo Repository, userActivityRepo UserActivityRepo, ) UseCase
NewInteractor is a constructor function.
type UserActivityRepo ¶
type UserActivityRepo interface {
Create(ctx context.Context, activity entity.UserActivity) error
}
UserActivityRepo interface to persist user actions for audit purposes.