project

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 10 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BoardColorPattern = regexp.MustCompile("^#[0-9a-fA-F]{6}$")

BoardColorPattern is a regexp witch can validate BoardColor

Functions

func ChangeProjectStatus

func ChangeProjectStatus(p *Project, isClosed bool) error

ChangeProjectStatus toggle a project between opened and closed

func ChangeProjectStatusByRepoIDAndID

func ChangeProjectStatusByRepoIDAndID(repoID, projectID int64, isClosed bool) error

ChangeProjectStatusByRepoIDAndID toggles a project between opened and closed

func DeleteBoardByID

func DeleteBoardByID(boardID int64) error

DeleteBoardByID removes all issues references to the project board.

func DeleteProjectByID

func DeleteProjectByID(id int64) error

DeleteProjectByID deletes a project from a repository.

func DeleteProjectByIDCtx

func DeleteProjectByIDCtx(ctx context.Context, id int64) error

DeleteProjectByIDCtx deletes a project from a repository.

func IsBoardTypeValid

func IsBoardTypeValid(p BoardType) bool

IsBoardTypeValid checks if the project board type is valid

func IsErrProjectBoardNotExist

func IsErrProjectBoardNotExist(err error) bool

IsErrProjectBoardNotExist checks if an error is a ErrProjectBoardNotExist

func IsErrProjectNotExist

func IsErrProjectNotExist(err error) bool

IsErrProjectNotExist checks if an error is a ErrProjectNotExist

func IsTypeValid

func IsTypeValid(p Type) bool

IsTypeValid checks if a project type is valid

func MoveIssuesOnProjectBoard

func MoveIssuesOnProjectBoard(board *Board, sortedIssueIDs map[int64]int64) error

MoveIssuesOnProjectBoard moves or keeps issues in a column and sorts them inside that column

func NewBoard

func NewBoard(board *Board) error

NewBoard adds a new project board to a given project

func NewProject

func NewProject(p *Project) error

NewProject creates a new Project

func SetDefaultBoard

func SetDefaultBoard(projectID, boardID int64) error

SetDefaultBoard represents a board for issues not assigned to one if boardID is 0 unset default

func UpdateBoard

func UpdateBoard(ctx context.Context, board *Board) error

UpdateBoard updates a project board

func UpdateBoardSorting

func UpdateBoardSorting(bs BoardList) error

UpdateBoardSorting update project board sorting

func UpdateProject

func UpdateProject(ctx context.Context, p *Project) error

UpdateProject updates project properties

Types

type Board

type Board struct {
	ID      int64 `xorm:"pk autoincr"`
	Title   string
	Default bool   `xorm:"NOT NULL DEFAULT false"` // issues not assigned to a specific board will be assigned to this board
	Sorting int8   `xorm:"NOT NULL DEFAULT 0"`
	Color   string `xorm:"VARCHAR(7)"`

	ProjectID int64 `xorm:"INDEX NOT NULL"`
	CreatorID int64 `xorm:"NOT NULL"`

	CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
	UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
}

Board is used to represent boards on a project

func GetBoard

func GetBoard(ctx context.Context, boardID int64) (*Board, error)

GetBoard fetches the current board of a project

func (*Board) NumIssues

func (b *Board) NumIssues() int

NumIssues return counter of all issues assigned to the board

func (Board) TableName

func (Board) TableName() string

TableName return the real table name

type BoardList

type BoardList []*Board

BoardList is a list of all project boards in a repository

func GetBoards

func GetBoards(ctx context.Context, projectID int64) (BoardList, error)

GetBoards fetches all boards related to a project if no default board set, first board is a temporary "Uncategorized" board

type BoardType

type BoardType uint8

BoardType is used to represent a project board type

const (
	// BoardTypeNone is a project board type that has no predefined columns
	BoardTypeNone BoardType = iota

	// BoardTypeBasicKanban is a project board type that has basic predefined columns
	BoardTypeBasicKanban

	// BoardTypeBugTriage is a project board type that has predefined columns suited to hunting down bugs
	BoardTypeBugTriage
)

type ErrProjectBoardNotExist

type ErrProjectBoardNotExist struct {
	BoardID int64
}

ErrProjectBoardNotExist represents a "ProjectBoardNotExist" kind of error.

func (ErrProjectBoardNotExist) Error

func (err ErrProjectBoardNotExist) Error() string

type ErrProjectNotExist

type ErrProjectNotExist struct {
	ID     int64
	RepoID int64
}

ErrProjectNotExist represents a "ProjectNotExist" kind of error.

func (ErrProjectNotExist) Error

func (err ErrProjectNotExist) Error() string

type Project

type Project struct {
	ID          int64  `xorm:"pk autoincr"`
	Title       string `xorm:"INDEX NOT NULL"`
	Description string `xorm:"TEXT"`
	RepoID      int64  `xorm:"INDEX"`
	CreatorID   int64  `xorm:"NOT NULL"`
	IsClosed    bool   `xorm:"INDEX"`
	BoardType   BoardType
	Type        Type

	RenderedContent string `xorm:"-"`

	CreatedUnix    timeutil.TimeStamp `xorm:"INDEX created"`
	UpdatedUnix    timeutil.TimeStamp `xorm:"INDEX updated"`
	ClosedDateUnix timeutil.TimeStamp
}

Project represents a project board

func GetProjectByID

func GetProjectByID(ctx context.Context, id int64) (*Project, error)

GetProjectByID returns the projects in a repository

func GetProjects

func GetProjects(ctx context.Context, opts SearchOptions) ([]*Project, int64, error)

GetProjects returns a list of all projects that have been created in the repository

func (*Project) NumClosedIssues

func (p *Project) NumClosedIssues() int

NumClosedIssues return counter of closed issues assigned to a project

func (*Project) NumIssues

func (p *Project) NumIssues() int

NumIssues return counter of all issues assigned to a project

func (*Project) NumOpenIssues

func (p *Project) NumOpenIssues() int

NumOpenIssues return counter of open issues assigned to a project

type ProjectIssue

type ProjectIssue struct {
	ID        int64 `xorm:"pk autoincr"`
	IssueID   int64 `xorm:"INDEX"`
	ProjectID int64 `xorm:"INDEX"`

	// If 0, then it has not been added to a specific board in the project
	ProjectBoardID int64 `xorm:"INDEX"`

	// the sorting order on the board
	Sorting int64 `xorm:"NOT NULL DEFAULT 0"`
}

ProjectIssue saves relation from issue to a project

type ProjectsConfig

type ProjectsConfig struct {
	BoardType   BoardType
	Translation string
}

ProjectsConfig is used to identify the type of board that is being created

func GetProjectsConfig

func GetProjectsConfig() []ProjectsConfig

GetProjectsConfig retrieves the types of configurations projects could have

type SearchOptions

type SearchOptions struct {
	RepoID   int64
	Page     int
	IsClosed util.OptionalBool
	SortType string
	Type     Type
}

SearchOptions are options for GetProjects

type Type

type Type uint8

Type is used to identify the type of project in question and ownership

const (
	// TypeIndividual is a type of project board that is owned by an individual
	TypeIndividual Type = iota + 1

	// TypeRepository is a project that is tied to a repository
	TypeRepository

	// TypeOrganization is a project that is tied to an organisation
	TypeOrganization
)

Jump to

Keyboard shortcuts

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