action

package
v0.6.19 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidID     = errors.New("action id is invalid")
	ErrNotExist      = errors.New("action doesn't exist")
	ErrInvalidDetail = errors.New("invalid action detail")
	ErrLogActivity   = errors.New("error while logging activity")
)
View Source
var DefinitionCreateProject = Action{
	ID:          "create_project",
	Name:        "Create Project",
	NamespaceID: namespace.DefinitionOrg.ID,
}
View Source
var DefinitionCreateTeam = Action{
	ID:          "create_team",
	Name:        "Create Team",
	NamespaceID: namespace.DefinitionOrg.ID,
}
View Source
var DefinitionManageOrganization = Action{
	ID:          "manage_organization",
	Name:        "Manage Organization",
	NamespaceID: namespace.DefinitionOrg.ID,
}
View Source
var DefinitionManageProject = Action{
	ID:          "manage_project",
	Name:        "Manage Project",
	NamespaceID: namespace.DefinitionProject.ID,
}
View Source
var DefinitionManageTeam = Action{
	ID:          "manage_team",
	Name:        "Manage Team",
	NamespaceID: namespace.DefinitionTeam.ID,
}
View Source
var DefinitionProjectAll = Action{
	ID:          "all_actions_project",
	Name:        "All Actions Project",
	NamespaceID: namespace.DefinitionProject.ID,
}
View Source
var DefinitionTeamAll = Action{
	ID:          "all_actions_team",
	Name:        "All Actions Team",
	NamespaceID: namespace.DefinitionTeam.ID,
}
View Source
var DefinitionViewTeam = Action{
	ID:          "view_team",
	Name:        "View Team",
	NamespaceID: namespace.DefinitionTeam.ID,
}

Functions

This section is empty.

Types

type Action

type Action struct {
	ID          string
	Name        string
	NamespaceID string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (Action) ToActionLogData added in v0.6.15

func (action Action) ToActionLogData() ActionLogData

type ActionLogData added in v0.6.15

type ActionLogData struct {
	Entity      string `mapstructure:"entity"`
	ID          string `mapstructure:"id"`
	Name        string `mapstructure:"name"`
	NamespaceID string `mapstructure:"namespace_id"`
}

type ActivityService added in v0.6.15

type ActivityService interface {
	Log(ctx context.Context, action string, actor activity.Actor, data any) error
}

type Repository

type Repository interface {
	Get(ctx context.Context, id string) (Action, error)
	Create(ctx context.Context, action Action) (Action, error)
	List(ctx context.Context) ([]Action, error)
	Update(ctx context.Context, action Action) (Action, error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(logger log.Logger, repository Repository, userService UserService, activityService ActivityService) *Service

func (Service) Create

func (s Service) Create(ctx context.Context, action Action) (Action, error)

func (Service) Get

func (s Service) Get(ctx context.Context, id string) (Action, error)

func (Service) List

func (s Service) List(ctx context.Context) ([]Action, error)

func (Service) Update

func (s Service) Update(ctx context.Context, id string, action Action) (Action, error)

type UserService added in v0.6.15

type UserService interface {
	FetchCurrentUser(ctx context.Context) (user.User, error)
}

Jump to

Keyboard shortcuts

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