Documentation ¶
Index ¶
- Constants
- Variables
- func ChangeProjectStatus(ctx context.Context, p *Project, isClosed bool) error
- func ChangeProjectStatusByRepoIDAndID(ctx context.Context, repoID, projectID int64, isClosed bool) error
- func DeleteAllProjectIssueByIssueIDsAndProjectIDs(ctx context.Context, issueIDs, projectIDs []int64) error
- func DeleteColumnByID(ctx context.Context, columnID int64) error
- func DeleteProjectByID(ctx context.Context, id int64) error
- func DeleteProjectByRepoID(ctx context.Context, repoID int64) error
- func GetAllProjectsIDsByOwnerIDAndType(ctx context.Context, ownerID int64, projectType Type) ([]int64, error)
- func GetSearchOrderByBySortType(sortType string) db.SearchOrderBy
- func IsCardTypeValid(p CardType) bool
- func IsErrProjectColumnNotExist(err error) bool
- func IsErrProjectNotExist(err error) bool
- func IsTemplateTypeValid(p TemplateType) bool
- func IsTypeValid(p Type) bool
- func MoveColumnsOnProject(ctx context.Context, project *Project, sortedColumnIDs map[int64]int64) error
- func NewColumn(ctx context.Context, column *Column) error
- func NewProject(ctx context.Context, p *Project) error
- func SetDefaultColumn(ctx context.Context, projectID, columnID int64) error
- func UpdateColumn(ctx context.Context, column *Column) error
- func UpdateColumnSorting(ctx context.Context, cl ColumnList) error
- func UpdateProject(ctx context.Context, p *Project) error
- type CardConfig
- type CardType
- type Column
- type ColumnList
- type ErrProjectColumnNotExist
- type ErrProjectNotExist
- type Project
- func (p *Project) CanBeAccessedByOwnerRepo(ownerID int64, repo *repo_model.Repository) bool
- func (p *Project) GetColumns(ctx context.Context) (ColumnList, error)
- func (p *Project) GetDefaultColumn(ctx context.Context) (*Column, error)
- func (p *Project) IconName() string
- func (p *Project) IsGhost() bool
- 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 TemplateConfig
- type TemplateType
- type Type
Constants ¶
const GhostProjectID = -1
Ghost Project is a project which has been deleted
Variables ¶
var ColumnColorPattern = regexp.MustCompile("^#[0-9a-fA-F]{6}$")
ColumnColorPattern is a regexp witch can validate ColumnColor
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 DeleteAllProjectIssueByIssueIDsAndProjectIDs ¶
func DeleteAllProjectIssueByIssueIDsAndProjectIDs(ctx context.Context, issueIDs, projectIDs []int64) error
DeleteAllProjectIssueByIssueIDsAndProjectIDs delete all project's issues by issue's and project's ids
func DeleteColumnByID ¶
DeleteColumnByID removes all issues references to the project column.
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 GetAllProjectsIDsByOwnerIDAndType ¶
func GetAllProjectsIDsByOwnerIDAndType(ctx context.Context, ownerID int64, projectType Type) ([]int64, error)
GetAllProjectsIDsByOwnerID returns the all projects ids it owns
func GetSearchOrderByBySortType ¶
func GetSearchOrderByBySortType(sortType string) db.SearchOrderBy
func IsCardTypeValid ¶
IsCardTypeValid checks if the project column card type is valid
func IsErrProjectColumnNotExist ¶
IsErrProjectColumnNotExist checks if an error is a ErrProjectColumnNotExist
func IsErrProjectNotExist ¶
IsErrProjectNotExist checks if an error is a ErrProjectNotExist
func IsTemplateTypeValid ¶
func IsTemplateTypeValid(p TemplateType) bool
IsTemplateTypeValid checks if the project template type is valid
func MoveColumnsOnProject ¶
func MoveColumnsOnProject(ctx context.Context, project *Project, sortedColumnIDs map[int64]int64) error
MoveColumnsOnProject sorts columns in a project
func NewProject ¶
NewProject creates a new Project The title will be cut off at 255 characters if it's longer than 255 characters.
func SetDefaultColumn ¶
SetDefaultColumn represents a column for issues not assigned to one
func UpdateColumn ¶
UpdateColumn updates a project column
func UpdateColumnSorting ¶
func UpdateColumnSorting(ctx context.Context, cl ColumnList) error
UpdateColumnSorting update project column sorting
Types ¶
type CardConfig ¶
CardConfig is used to identify the type of column card that is being used
func GetCardConfig ¶
func GetCardConfig() []CardConfig
GetCardConfig retrieves the types of configurations project column cards could have
type Column ¶
type Column struct { ID int64 `xorm:"pk autoincr"` Title string Default bool `xorm:"NOT NULL DEFAULT false"` // issues not assigned to a specific column will be assigned to this column 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"` }
Column is used to represent column on a project
type ColumnList ¶
type ColumnList []*Column
ColumnList is a list of all project columns in a repository
func GetColumnsByIDs ¶
type ErrProjectColumnNotExist ¶
type ErrProjectColumnNotExist struct {
ColumnID int64
}
ErrProjectColumnNotExist represents a "ErrProjectColumnNotExist" kind of error.
func (ErrProjectColumnNotExist) Error ¶
func (err ErrProjectColumnNotExist) Error() string
func (ErrProjectColumnNotExist) Unwrap ¶
func (err ErrProjectColumnNotExist) Unwrap() error
type ErrProjectNotExist ¶
ErrProjectNotExist represents a "ProjectNotExist" kind of error.
func (ErrProjectNotExist) Error ¶
func (err ErrProjectNotExist) Error() string
func (ErrProjectNotExist) Unwrap ¶
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"` TemplateType TemplateType `xorm:"'board_type'"` // TODO: rename the column to template_type 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
func GetProjectByID ¶
GetProjectByID returns the projects in a repository
func GetProjectForRepoByID ¶
GetProjectForRepoByID returns the projects in a repository
func (*Project) CanBeAccessedByOwnerRepo ¶
func (p *Project) CanBeAccessedByOwnerRepo(ownerID int64, repo *repo_model.Repository) bool
func (*Project) GetColumns ¶
func (p *Project) GetColumns(ctx context.Context) (ColumnList, error)
GetColumns fetches all columns related to a project
func (*Project) GetDefaultColumn ¶
GetDefaultColumn return default column and ensure only one exists
func (*Project) IsOrganizationProject ¶
func (*Project) IsRepositoryProject ¶
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"` // ProjectColumnID 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. ProjectColumnID int64 `xorm:"'project_board_id' INDEX"` // the sorting order on the column 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 ¶
func (opts SearchOptions) ToConds() builder.Cond
func (SearchOptions) ToOrders ¶
func (opts SearchOptions) ToOrders() string
type TemplateConfig ¶
type TemplateConfig struct { TemplateType TemplateType Translation string }
TemplateConfig is used to identify the template type of project that is being created
func GetTemplateConfigs ¶
func GetTemplateConfigs() []TemplateConfig
GetTemplateConfigs retrieves the template configs of configurations project columns could have
type TemplateType ¶
type TemplateType uint8
TemplateType is used to represent a project template type
const ( // TemplateTypeNone is a project template type that has no predefined columns TemplateTypeNone TemplateType = iota // TemplateTypeBasicKanban is a project template type that has basic predefined columns TemplateTypeBasicKanban // TemplateTypeBugTriage is a project template type that has predefined columns suited to hunting down bugs TemplateTypeBugTriage )