project

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const AuditEntity = "project"

Variables

View Source
var (
	ErrNotExist      = errors.New("project doesn't exist")
	ErrInvalidUUID   = errors.New("invalid syntax of uuid")
	ErrInvalidID     = errors.New("project id is invalid")
	ErrConflict      = errors.New("project already exist")
	ErrInvalidDetail = errors.New("invalid project detail")
	ErrLogActivity   = errors.New("error while logging activity")
)

Functions

This section is empty.

Types

type ActivityService added in v0.6.15

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

type LogData added in v0.6.25

type LogData struct {
	Entity         string `mapstructure:"entity"`
	ID             string `mapstructure:"id"`
	Name           string `mapstructure:"name"`
	Slug           string `mapstructure:"slug"`
	OrganizationID string `mapstructure:"organization_id"`
}

type Project

type Project struct {
	ID           string
	Name         string
	Slug         string
	Organization organization.Organization
	Metadata     metadata.Metadata
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

func (Project) ToLogData added in v0.6.25

func (project Project) ToLogData() LogData

type RelationService

type RelationService interface {
	Create(ctx context.Context, rel relation.RelationV2) (relation.RelationV2, error)
	Delete(ctx context.Context, rel relation.Relation) error
	CheckPermission(ctx context.Context, usr user.User, resourceNS namespace.Namespace, resourceIdxa string, action action.Action) (bool, error)
}

type Repository

type Repository interface {
	GetByID(ctx context.Context, id string) (Project, error)
	GetBySlug(ctx context.Context, slug string) (Project, error)
	Create(ctx context.Context, org Project) (Project, error)
	List(ctx context.Context) ([]Project, error)
	UpdateByID(ctx context.Context, toUpdate Project) (Project, error)
	UpdateBySlug(ctx context.Context, toUpdate Project) (Project, error)
	ListAdmins(ctx context.Context, id string) ([]user.User, error)
}

type Service

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

func NewService

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

func (Service) AddAdmins

func (s Service) AddAdmins(ctx context.Context, idOrSlug string, userIds []string) ([]user.User, error)

func (Service) Create

func (s Service) Create(ctx context.Context, prj Project) (Project, error)

func (Service) Get

func (s Service) Get(ctx context.Context, idOrSlug string) (Project, error)

func (Service) List

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

func (Service) ListAdmins

func (s Service) ListAdmins(ctx context.Context, id string) ([]user.User, error)

func (Service) RemoveAdmin

func (s Service) RemoveAdmin(ctx context.Context, idOrSlug string, userId string) ([]user.User, error)

func (Service) Update

func (s Service) Update(ctx context.Context, prj Project) (Project, error)

type UserService

type UserService interface {
	FetchCurrentUser(ctx context.Context) (user.User, error)
	GetByID(ctx context.Context, id string) (user.User, error)
	GetByIDs(ctx context.Context, userIDs []string) ([]user.User, error)
}

Jump to

Keyboard shortcuts

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