feat(api): add REST API for repository project boards
Cherry-pick of upstream PR go-gitea/gitea#37518 onto feat/projects-api. The PR is itself a rebase of #36831 onto main, adapted for the multi-projects-per-issue model added in #36784. Endpoints (all under /repos/{owner}/{repo}/projects...): GET . list projects POST . create project GET /{id} get project PATCH /{id} update project DELETE /{id} delete project GET /{id}/columns list columns POST /{id}/columns create column PATCH /columns/{id} update column DELETE /columns/{id} delete column GET /columns/{id}/issues list issues in column POST /columns/{id}/issues/{issue_id} add/move issue to column DELETE /columns/{id}/issues/{issue_id} remove issue from column POST /columns/{id}/issues/{issue_id}/move move between columns Source: https://github.com/go-gitea/gitea/pull/37518
This commit is contained in:
@@ -97,7 +97,7 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
|
||||
searchOpt.SortBy = SortByDeadlineAsc
|
||||
case "farduedate":
|
||||
searchOpt.SortBy = SortByDeadlineDesc
|
||||
case "priority", "priorityrepo", "project-column-sorting":
|
||||
case "priority", "priorityrepo", issues_model.SortTypeProjectColumnSorting:
|
||||
// Unsupported sort type for search
|
||||
fallthrough
|
||||
default:
|
||||
|
||||
+92
-18
@@ -7,27 +7,101 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Project represents a project
|
||||
// Project represents a project.
|
||||
//
|
||||
// Gitea projects can only contain issues — note cards and pull requests are
|
||||
// not modeled as project items.
|
||||
//
|
||||
// swagger:model
|
||||
type Project struct {
|
||||
// ID is the unique identifier for the project
|
||||
ID int64 `json:"id"`
|
||||
// Title is the title of the project
|
||||
Title string `json:"title"`
|
||||
// Description provides details about the project
|
||||
Description string `json:"description"`
|
||||
// OwnerID is the owner of the project (for org-level projects)
|
||||
OwnerID int64 `json:"owner_id,omitempty"`
|
||||
// RepoID is the repository this project belongs to (for repo-level projects)
|
||||
RepoID int64 `json:"repo_id,omitempty"`
|
||||
// CreatorID is the user who created the project
|
||||
CreatorID int64 `json:"creator_id"`
|
||||
// IsClosed indicates if the project is closed
|
||||
IsClosed bool `json:"is_closed"`
|
||||
ID int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
OwnerID int64 `json:"owner_id,omitempty"`
|
||||
RepoID int64 `json:"repo_id,omitempty"`
|
||||
Creator *User `json:"creator,omitempty"`
|
||||
State StateType `json:"state"`
|
||||
// Template type: "none", "basic_kanban" or "bug_triage"
|
||||
TemplateType string `json:"template_type"`
|
||||
// Card type: "text_only" or "images_and_text"
|
||||
CardType string `json:"card_type"`
|
||||
// Project type: "individual", "repository" or "organization"
|
||||
Type string `json:"type"`
|
||||
NumOpenIssues int64 `json:"num_open_issues,omitempty"`
|
||||
NumClosedIssues int64 `json:"num_closed_issues,omitempty"`
|
||||
NumIssues int64 `json:"num_issues,omitempty"`
|
||||
// swagger:strfmt date-time
|
||||
Created time.Time `json:"created_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
// swagger:strfmt date-time
|
||||
Updated time.Time `json:"updated_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
// swagger:strfmt date-time
|
||||
Closed *time.Time `json:"closed_at,omitempty"`
|
||||
ClosedAt *time.Time `json:"closed_at,omitempty"`
|
||||
HTMLURL string `json:"html_url,omitempty"`
|
||||
}
|
||||
|
||||
// CreateProjectOption represents options for creating a project
|
||||
// swagger:model
|
||||
type CreateProjectOption struct {
|
||||
// required: true
|
||||
Title string `json:"title" binding:"Required"`
|
||||
Description string `json:"description"`
|
||||
// Template type: "none", "basic_kanban" or "bug_triage"
|
||||
TemplateType string `json:"template_type"`
|
||||
// Card type: "text_only" or "images_and_text"
|
||||
CardType string `json:"card_type"`
|
||||
}
|
||||
|
||||
// EditProjectOption represents options for editing a project
|
||||
// swagger:model
|
||||
type EditProjectOption struct {
|
||||
Title *string `json:"title,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
// Card type: "text_only" or "images_and_text"
|
||||
CardType *string `json:"card_type,omitempty"`
|
||||
State *StateType `json:"state,omitempty"`
|
||||
}
|
||||
|
||||
// ProjectColumn represents a project column (board)
|
||||
// swagger:model
|
||||
type ProjectColumn struct {
|
||||
ID int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Default bool `json:"default"`
|
||||
Sorting int `json:"sorting"`
|
||||
Color string `json:"color,omitempty"`
|
||||
ProjectID int64 `json:"project_id"`
|
||||
Creator *User `json:"creator,omitempty"`
|
||||
NumIssues int64 `json:"num_issues,omitempty"`
|
||||
// swagger:strfmt date-time
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
// swagger:strfmt date-time
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// CreateProjectColumnOption represents options for creating a project column
|
||||
// swagger:model
|
||||
type CreateProjectColumnOption struct {
|
||||
// required: true
|
||||
Title string `json:"title" binding:"Required"`
|
||||
// Column color in 6-digit hex format, e.g. #FF0000
|
||||
Color string `json:"color,omitempty"`
|
||||
}
|
||||
|
||||
// EditProjectColumnOption represents options for editing a project column
|
||||
// swagger:model
|
||||
type EditProjectColumnOption struct {
|
||||
Title *string `json:"title,omitempty"`
|
||||
// Column color in 6-digit hex format, e.g. #FF0000
|
||||
Color *string `json:"color,omitempty"`
|
||||
Sorting *int `json:"sorting,omitempty"`
|
||||
}
|
||||
|
||||
// MoveProjectIssueOption represents options for moving an issue between columns
|
||||
// swagger:model
|
||||
type MoveProjectIssueOption struct {
|
||||
// Target column to move the issue into
|
||||
// required: true
|
||||
ColumnID int64 `json:"column_id" binding:"Required"`
|
||||
// Optional sorting position within the target column
|
||||
Sorting *int64 `json:"sorting,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user