Documentation ¶
Index ¶
- Variables
- func ChangeProjectStatus(ctx context.Context, p *Project, isClosed bool) error
- func ChangeProjectStatusByRepoIDAndID(ctx context.Context, repoID, projectID int64, isClosed bool) error
- func DeleteBoardByID(ctx context.Context, boardID int64) error
- func DeleteProjectByID(ctx context.Context, id int64) error
- func DeleteProjectByRepoID(ctx context.Context, repoID int64) error
- func GetSearchOrderByBySortType(sortType string) db.SearchOrderBy
- func IsBoardTypeValid(p BoardType) bool
- func IsCardTypeValid(p CardType) bool
- func IsErrProjectBoardNotExist(err error) bool
- func IsErrProjectNotExist(err error) bool
- func IsTypeValid(p Type) bool
- func MoveColumnsOnProject(ctx context.Context, project *Project, sortedColumnIDs map[int64]int64) error
- func MoveIssuesOnProjectBoard(ctx context.Context, board *Board, sortedIssueIDs map[int64]int64) error
- func NewBoard(ctx context.Context, board *Board) error
- func NewProject(ctx context.Context, p *Project) error
- func SetDefaultBoard(ctx context.Context, projectID, boardID int64) error
- func UpdateBoard(ctx context.Context, board *Board) error
- func UpdateBoardSorting(ctx context.Context, bs BoardList) error
- func UpdateProject(ctx context.Context, p *Project) error
- type Board
- type BoardConfig
- type BoardList
- type BoardType
- type CardConfig
- type CardType
- type ErrProjectBoardNotExist
- type ErrProjectNotExist
- type Project
- func (p *Project) CanBeAccessedByOwnerRepo(ownerID int64, repo *repo_model.Repository) bool
- func (p *Project) GetBoards(ctx context.Context) (BoardList, error)
- func (p *Project) GetDefaultBoard(ctx context.Context) (*Board, error)
- func (p *Project) IconName() string
- func (p *Project) IsOrganizationProject() bool
- func (p *Project) IsRepositoryProject() bool
- func (p *Project) Link(ctx context.Context) string
- func (p *Project) LoadOwner(ctx context.Context) (err error)
- func (p *Project) LoadRepo(ctx context.Context) (err error)
- func (p *Project) NumClosedIssues(ctx context.Context) int
- func (p *Project) NumIssues(ctx context.Context) int
- func (p *Project) NumOpenIssues(ctx context.Context) int
- type ProjectIssue
- type SearchOptions
- type Type
Constants ¶
This section is empty.
Variables ¶
var BoardColorPattern = regexp.MustCompile("^#[0-9a-fA-F]{6}$")
BoardColorPattern is a regexp witch can validate BoardColor
Functions ¶
func ChangeProjectStatus ¶
ChangeProjectStatus toggle a project between opened and closed
func ChangeProjectStatusByRepoIDAndID ¶
func ChangeProjectStatusByRepoIDAndID(ctx context.Context, repoID, projectID int64, isClosed bool) error
ChangeProjectStatusByRepoIDAndID toggles a project between opened and closed
func DeleteBoardByID ¶
DeleteBoardByID removes all issues references to the project board.
func DeleteProjectByID ¶
DeleteProjectByID deletes a project from a repository. if it's not in a database transaction, it will start a new database transaction
func DeleteProjectByRepoID ¶ added in v1.17.4
func GetSearchOrderByBySortType ¶ added in v1.20.0
func GetSearchOrderByBySortType(sortType string) db.SearchOrderBy
func IsBoardTypeValid ¶
IsBoardTypeValid checks if the project board type is valid
func IsCardTypeValid ¶ added in v1.19.0
IsCardTypeValid checks if the project board card type is valid
func IsErrProjectBoardNotExist ¶
IsErrProjectBoardNotExist checks if an error is a ErrProjectBoardNotExist
func IsErrProjectNotExist ¶
IsErrProjectNotExist checks if an error is a ErrProjectNotExist
func MoveColumnsOnProject ¶ added in v1.22.0
func MoveColumnsOnProject(ctx context.Context, project *Project, sortedColumnIDs map[int64]int64) error
MoveColumnsOnProject sorts columns in a project
func MoveIssuesOnProjectBoard ¶
func MoveIssuesOnProjectBoard(ctx context.Context, board *Board, sortedIssueIDs map[int64]int64) error
MoveIssuesOnProjectBoard moves or keeps issues in a column and sorts them inside that column
func NewProject ¶
NewProject creates a new Project
func SetDefaultBoard ¶
SetDefaultBoard represents a board for issues not assigned to one
func UpdateBoard ¶
UpdateBoard updates a project board
func UpdateBoardSorting ¶
UpdateBoardSorting update project board sorting
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 (*Board) GetIssues ¶ added in v1.22.0
func (b *Board) GetIssues(ctx context.Context) ([]*ProjectIssue, error)
type BoardConfig ¶ added in v1.19.0
BoardConfig is used to identify the type of board that is being created
func GetBoardConfig ¶ added in v1.19.0
func GetBoardConfig() []BoardConfig
GetBoardConfig retrieves the types of configurations project boards could have
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 CardConfig ¶ added in v1.19.0
CardConfig is used to identify the type of board card that is being used
func GetCardConfig ¶ added in v1.19.0
func GetCardConfig() []CardConfig
GetCardConfig retrieves the types of configurations project board cards could have
type CardType ¶ added in v1.19.0
type CardType uint8
CardType is used to represent a project board card type
type ErrProjectBoardNotExist ¶
type ErrProjectBoardNotExist struct {
BoardID int64
}
ErrProjectBoardNotExist represents a "ProjectBoardNotExist" kind of error.
func (ErrProjectBoardNotExist) Error ¶
func (err ErrProjectBoardNotExist) Error() string
func (ErrProjectBoardNotExist) Unwrap ¶ added in v1.17.4
func (err ErrProjectBoardNotExist) Unwrap() error
type ErrProjectNotExist ¶
ErrProjectNotExist represents a "ProjectNotExist" kind of error.
func (ErrProjectNotExist) Error ¶
func (err ErrProjectNotExist) Error() string
func (ErrProjectNotExist) Unwrap ¶ added in v1.17.4
func (err ErrProjectNotExist) Unwrap() error
type Project ¶
type Project struct { ID int64 `xorm:"pk autoincr"` Title string `xorm:"INDEX NOT NULL"` Description string `xorm:"TEXT"` OwnerID int64 `xorm:"INDEX"` Owner *user_model.User `xorm:"-"` RepoID int64 `xorm:"INDEX"` Repo *repo_model.Repository `xorm:"-"` CreatorID int64 `xorm:"NOT NULL"` IsClosed bool `xorm:"INDEX"` BoardType BoardType CardType CardType Type Type RenderedContent template.HTML `xorm:"-"` CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` ClosedDateUnix timeutil.TimeStamp }
Project represents a project board
func GetProjectByID ¶
GetProjectByID returns the projects in a repository
func GetProjectForRepoByID ¶ added in v1.20.6
GetProjectForRepoByID returns the projects in a repository
func (*Project) CanBeAccessedByOwnerRepo ¶ added in v1.22.0
func (p *Project) CanBeAccessedByOwnerRepo(ownerID int64, repo *repo_model.Repository) bool
func (*Project) GetDefaultBoard ¶ added in v1.22.0
GetDefaultBoard return default board and ensure only one exists
func (*Project) IsOrganizationProject ¶ added in v1.19.0
func (*Project) IsRepositoryProject ¶ added in v1.20.0
func (*Project) NumClosedIssues ¶
NumClosedIssues return counter of closed issues assigned to a project
type ProjectIssue ¶
type ProjectIssue struct { ID int64 `xorm:"pk autoincr"` IssueID int64 `xorm:"INDEX"` ProjectID int64 `xorm:"INDEX"` // ProjectBoardID should not be zero since 1.22. If it's zero, the issue will not be displayed on UI and it might result in errors. 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 SearchOptions ¶
type SearchOptions struct { db.ListOptions OwnerID int64 RepoID int64 IsClosed optional.Option[bool] OrderBy db.SearchOrderBy Type Type Title string }
SearchOptions are options for GetProjects
func (SearchOptions) ToConds ¶ added in v1.22.0
func (opts SearchOptions) ToConds() builder.Cond
func (SearchOptions) ToOrders ¶ added in v1.22.0
func (opts SearchOptions) ToOrders() string