project

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExist      = errors.New("project or its relations 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")
)
View Source
var AdminPermission = schema.DeletePermission
View Source
var MemberPermission = schema.GetPermission

Functions

This section is empty.

Types

type Filter

type Filter struct {
	OrgID string
	State State
}

type Project

type Project struct {
	ID           string
	Name         string
	Title        string
	Organization organization.Organization
	State        State
	Metadata     metadata.Metadata

	CreatedAt time.Time
	UpdatedAt time.Time
}

type RelationService

type RelationService interface {
	Create(ctx context.Context, rel relation.Relation) (relation.Relation, error)
	LookupSubjects(ctx context.Context, rel relation.Relation) ([]string, error)
	LookupResources(ctx context.Context, rel relation.Relation) ([]string, error)
	Delete(ctx context.Context, rel relation.Relation) error
}

type Repository

type Repository interface {
	GetByID(ctx context.Context, id string) (Project, error)
	GetByIDs(ctx context.Context, ids []string) ([]Project, error)
	GetByName(ctx context.Context, slug string) (Project, error)
	Create(ctx context.Context, org Project) (Project, error)
	List(ctx context.Context, f Filter) ([]Project, error)
	UpdateByID(ctx context.Context, toUpdate Project) (Project, error)
	UpdateByName(ctx context.Context, toUpdate Project) (Project, error)
	Delete(ctx context.Context, id string) error
	SetState(ctx context.Context, id string, state State) error
}

type Service

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

func NewService

func NewService(repository Repository, relationService RelationService, userService UserService) *Service

func (Service) Create

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

func (Service) DeleteModel

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

DeleteModel doesn't delete the nested resource, only itself

func (Service) Disable

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

func (Service) Enable

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

func (Service) Get

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

func (Service) GetByIDs

func (s Service) GetByIDs(ctx context.Context, ids []string) ([]Project, error)

func (Service) List

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

func (Service) ListByUser

func (s Service) ListByUser(ctx context.Context, userID string) ([]Project, error)

func (Service) ListUsers

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

func (Service) Update

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

type State

type State string
const (
	Enabled  State = "enabled"
	Disabled State = "disabled"
)

func (State) String

func (s State) String() string

type UserService

type UserService interface {
	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