membership

package
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package membership contains all logic for memberships.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateGlobalMembershipInput

type CreateGlobalMembershipInput struct {
	User           *models.User
	Team           *models.Team
	ServiceAccount *models.ServiceAccount
	RoleID         string
}

CreateGlobalMembershipInput is the input for creating a global membership

type CreateOrganizationMembershipInput

type CreateOrganizationMembershipInput struct {
	OrganizationID string
	User           *models.User
	Team           *models.Team
	ServiceAccount *models.ServiceAccount
	RoleID         string
}

CreateOrganizationMembershipInput is the input for creating an organization membership

type CreateProjectMembershipInput

type CreateProjectMembershipInput struct {
	ProjectID      string
	User           *models.User
	Team           *models.Team
	ServiceAccount *models.ServiceAccount
	RoleID         string
}

CreateProjectMembershipInput is the input for creating a project membership

type DeleteMembershipInput

type DeleteMembershipInput struct {
	Version *int
	ID      string
}

DeleteMembershipInput is the input for deleting a membership

type GetMembershipsInput

type GetMembershipsInput struct {
	// Sort specifies the field to sort on and direction
	Sort *db.MembershipSortableField
	// PaginationOptions supports cursor based pagination
	PaginationOptions *pagination.Options
	// OrganizationID filters the memberships by organization ID
	OrganizationID *string
	// ProjectID filters the memberships by project ID
	ProjectID *string
	// UserID filters the memberships by user ID
	UserID *string
	// ServiceAccount filters the memberships by service account
	ServiceAccount *models.ServiceAccount
	// MembershipScopes filters the memberships by scope
	MembershipScopes []models.ScopeType
}

GetMembershipsInput is the input for retrieving memberships for an organization or project.

type MockService

type MockService struct {
	mock.Mock
}

MockService is an autogenerated mock type for the Service type

func NewMockService

func NewMockService(t mockConstructorTestingTNewMockService) *MockService

NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockService) CreateGlobalMembership

func (_m *MockService) CreateGlobalMembership(ctx context.Context, input *CreateGlobalMembershipInput) (*models.Membership, error)

CreateGlobalMembership provides a mock function with given fields: ctx, input

func (*MockService) CreateOrganizationMembership

func (_m *MockService) CreateOrganizationMembership(ctx context.Context, input *CreateOrganizationMembershipInput) (*models.Membership, error)

CreateOrganizationMembership provides a mock function with given fields: ctx, input

func (*MockService) CreateProjectMembership

func (_m *MockService) CreateProjectMembership(ctx context.Context, input *CreateProjectMembershipInput) (*models.Membership, error)

CreateProjectMembership provides a mock function with given fields: ctx, input

func (*MockService) DeleteMembership

func (_m *MockService) DeleteMembership(ctx context.Context, input *DeleteMembershipInput) error

DeleteMembership provides a mock function with given fields: ctx, input

func (*MockService) GetMembershipByID

func (_m *MockService) GetMembershipByID(ctx context.Context, id string) (*models.Membership, error)

GetMembershipByID provides a mock function with given fields: ctx, id

func (*MockService) GetMembershipByPRN

func (_m *MockService) GetMembershipByPRN(ctx context.Context, prn string) (*models.Membership, error)

GetMembershipByPRN provides a mock function with given fields: ctx, prn

func (*MockService) GetMemberships

func (_m *MockService) GetMemberships(ctx context.Context, input *GetMembershipsInput) (*db.MembershipsResult, error)

GetMemberships provides a mock function with given fields: ctx, input

func (*MockService) GetMembershipsByIDs

func (_m *MockService) GetMembershipsByIDs(ctx context.Context, idList []string) ([]models.Membership, error)

GetMembershipsByIDs provides a mock function with given fields: ctx, idList

func (*MockService) UpdateMembership

func (_m *MockService) UpdateMembership(ctx context.Context, input *UpdateMembershipInput) (*models.Membership, error)

UpdateMembership provides a mock function with given fields: ctx, input

type Service

type Service interface {
	GetMemberships(ctx context.Context, input *GetMembershipsInput) (*db.MembershipsResult, error)
	GetMembershipByID(ctx context.Context, id string) (*models.Membership, error)
	GetMembershipByPRN(ctx context.Context, prn string) (*models.Membership, error)
	GetMembershipsByIDs(ctx context.Context, idList []string) ([]models.Membership, error)
	CreateOrganizationMembership(ctx context.Context, input *CreateOrganizationMembershipInput) (*models.Membership, error)
	CreateProjectMembership(ctx context.Context, input *CreateProjectMembershipInput) (*models.Membership, error)
	CreateGlobalMembership(ctx context.Context, input *CreateGlobalMembershipInput) (*models.Membership, error)
	UpdateMembership(ctx context.Context, input *UpdateMembershipInput) (*models.Membership, error)
	DeleteMembership(ctx context.Context, input *DeleteMembershipInput) error
}

Service implements all Membership related functionality

func NewService

func NewService(
	logger logger.Logger,
	dbClient *db.Client,
	activityService activityevent.Service,
) Service

NewService returns an instance of Service

type UpdateMembershipInput

type UpdateMembershipInput struct {
	Version *int
	RoleID  string
	ID      string
}

UpdateMembershipInput is the input for updating a membership

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL