project

package
v1.19.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: MIT Imports: 11 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 CountProjects added in v1.19.0

func CountProjects(ctx context.Context, opts SearchOptions) (int64, error)

CountProjects counts projects

func DeleteBoardByID

func DeleteBoardByID(boardID int64) error

DeleteBoardByID removes all issues references to the project board.

func DeleteProjectByID

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

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 DeleteProjectByRepoID(ctx context.Context, repoID int64) error

func IsBoardTypeValid

func IsBoardTypeValid(p BoardType) bool

IsBoardTypeValid checks if the project board type is valid

func IsCardTypeValid added in v1.19.0

func IsCardTypeValid(p CardType) bool

IsCardTypeValid checks if the project board card 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 BoardConfig added in v1.19.0

type BoardConfig struct {
	BoardType   BoardType
	Translation string
}

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 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 CardConfig added in v1.19.0

type CardConfig struct {
	CardType    CardType
	Translation string
}

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

const (
	// CardTypeTextOnly is a project board card type that is text only
	CardTypeTextOnly CardType = iota

	// CardTypeImagesAndText is a project board card type that has images and text
	CardTypeImagesAndText
)

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

type ErrProjectNotExist struct {
	ID     int64
	RepoID int64
}

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 string `xorm:"-"`

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

Project represents a project board

func FindProjects added in v1.19.0

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

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

func GetProjectByID

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

GetProjectByID returns the projects in a repository

func (*Project) IsOrganizationProject added in v1.19.0

func (p *Project) IsOrganizationProject() bool
func (p *Project) Link() string

Link returns the project's relative URL.

func (*Project) LoadOwner added in v1.19.0

func (p *Project) LoadOwner(ctx context.Context) (err error)

func (*Project) LoadRepo added in v1.19.0

func (p *Project) LoadRepo(ctx context.Context) (err error)

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 SearchOptions

type SearchOptions struct {
	OwnerID  int64
	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