-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
feat: api endpoints for projects #28111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dineshsalunke
wants to merge
51
commits into
go-gitea:main
Choose a base branch
from
dineshsalunke:feat/api-projects
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
4c0ec22
test: add 2 fixtures for project
dineshsalunke 6092b81
refactor: add structs for project
dineshsalunke b6f9d05
feat: api for projects
dineshsalunke b6d45c6
Merge branch 'main' into feat/api-projects
dineshsalunke 922cd13
Merge remote-tracking branch 'upstream/main' into feat/api-projects
dineshsalunke 0b8d198
Merge branch 'feat/api-projects' of https://github.com/dineshsalunke/…
dineshsalunke e0ae281
Merge branch 'main' into feat/api-projects
GiteaBot a0f8dbd
chore: remove unnecessary go lines formatting
dineshsalunke ac39273
Merge branch 'feat/api-projects' of https://github.com/dineshsalunke/…
dineshsalunke df22b6d
chore: remove the goline formatting
dineshsalunke 5bbbade
chore: remove unwanted indentation on the line
dineshsalunke c266568
Merge remote-tracking branch 'upstream/main' into feat/api-projects
dineshsalunke aa32ad7
refactor: update for db find method usage
dineshsalunke 81c3d0c
fix: add missing swagger tags
dineshsalunke 852c0df
chore: fix lint issues
dineshsalunke dbfecce
fix: return error when converting project to api project
dineshsalunke fec855e
chore: fix swagger documentation
dineshsalunke 6238b9e
fix: ignore errors when loading data for converting project to response
dineshsalunke 8819a0a
refactor: use the add token auth method for token in tests
dineshsalunke 3b2943a
test: use the add token auth method for token
dineshsalunke cf17f34
Merge remote-tracking branch 'upstream/main' into feat/api-projects
dineshsalunke 7eebc7c
Merge remote-tracking branch 'upstream/main' into feat/api-projects
dineshsalunke d2fd138
test: use the correct fields for the test case
dineshsalunke 34566ea
Merge branch 'main' into feat/api-projects
denyskon 897c67b
revert formatting changes
denyskon c7440bc
Merge branch 'main' into feat/api-projects
denyskon 065001c
more reverts
denyskon 24babd6
Merge branch 'feat/api-projects' of github.com:dineshsalunke/gitea in…
denyskon 58e56cd
more formatting fixes
denyskon 74043f7
fix project sort test
denyskon fac47d4
Merge remote-tracking branch 'upstream/main' into feat/api-projects
dineshsalunke 4475c4f
actually fix test!
denyskon e751d6c
Merge branch 'feat/api-projects' of github.com:dineshsalunke/gitea in…
denyskon 6a18cbe
Merge branch 'main' into feat/api-projects
denyskon 927da10
chore: swagger doc typo corrections
dineshsalunke 975d98d
chore: remove redundant comment
dineshsalunke d4ea5a5
fix: use the page field from parameters
dineshsalunke 24a302a
Merge branch 'feat/api-projects' of https://github.com/dineshsalunke/…
dineshsalunke c5c41e3
Merge remote-tracking branch 'upstream/main' into feat/api-projects
dineshsalunke 0a0837f
chore: update the swagger file
dineshsalunke 23d9697
Merge branch 'main' into feat/api-projects
denyskon a2a01df
Merge branch 'main' into feat/api-projects
denyskon b931054
Merge remote-tracking branch 'upstream/main' into feat/api-projects
a7aabc5
refactor: add the missing parameter bodies for project
7383e7b
refactor: rename BoardType to TemplateType
016aa72
refactor: add creator property to the project
d067b1d
refactor: add BoardType to TemplateType property
eeca89e
refactor: handle errors when converting to APIProject
20e9c58
Merge remote-tracking branch 'upstream/main' into feat/api-projects
dineshsalunke 185a594
refactor: update the context
dineshsalunke 30027ac
refactor: update the board type enums
dineshsalunke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2023 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package structs | ||
|
||
import "time" | ||
|
||
// swagger:model | ||
type NewProjectPayload struct { | ||
// required:true | ||
Title string `json:"title" binding:"Required"` | ||
// required:true | ||
BoardType uint8 `json:"board_type"` | ||
// required:true | ||
CardType uint8 `json:"card_type"` | ||
Description string `json:"description"` | ||
} | ||
|
||
// swagger:model | ||
type UpdateProjectPayload struct { | ||
// required:true | ||
Title string `json:"title" binding:"Required"` | ||
Description string `json:"description"` | ||
} | ||
|
||
// swagger:model | ||
type Project struct { | ||
ID int64 `json:"id"` | ||
Title string `json:"title"` | ||
Description string `json:"description"` | ||
TemplateType uint8 `json:"board_type"` | ||
IsClosed bool `json:"is_closed"` | ||
// swagger:strfmt date-time | ||
Created time.Time `json:"created_at"` | ||
// swagger:strfmt date-time | ||
Updated time.Time `json:"updated_at"` | ||
// swagger:strfmt date-time | ||
Closed time.Time `json:"closed_at"` | ||
|
||
Repo *RepositoryMeta `json:"repository"` | ||
Creator *User `json:"creator"` | ||
Owner *User `json:"owner"` | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,7 @@ import ( | |
"code.gitea.io/gitea/routers/api/v1/notify" | ||
"code.gitea.io/gitea/routers/api/v1/org" | ||
"code.gitea.io/gitea/routers/api/v1/packages" | ||
"code.gitea.io/gitea/routers/api/v1/projects" | ||
"code.gitea.io/gitea/routers/api/v1/repo" | ||
"code.gitea.io/gitea/routers/api/v1/settings" | ||
"code.gitea.io/gitea/routers/api/v1/user" | ||
|
@@ -1454,6 +1455,10 @@ func Routes() *web.Router { | |
Patch(reqToken(), reqRepoWriter(unit.TypeIssues, unit.TypePullRequests), bind(api.EditMilestoneOption{}), repo.EditMilestone). | ||
Delete(reqToken(), reqRepoWriter(unit.TypeIssues, unit.TypePullRequests), repo.DeleteMilestone) | ||
}) | ||
m.Group("/projects", func() { | ||
m.Combo("").Get(projects.ListRepoProjects). | ||
Post(bind(api.NewProjectPayload{}), projects.CreateRepoProject) | ||
}, mustEnableIssues) | ||
}, repoAssignment()) | ||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryIssue)) | ||
|
||
|
@@ -1598,6 +1603,11 @@ func Routes() *web.Router { | |
}) | ||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryAdmin), reqToken(), reqSiteAdmin()) | ||
|
||
m.Group("/projects", func() { | ||
m.Combo("/{id}").Get(projects.GetProject). | ||
Patch(bind(api.UpdateProjectPayload{}), projects.UpdateProject). | ||
Delete(projects.DeleteProject) | ||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryIssue), reqToken()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need a new token scope |
||
m.Group("/topics", func() { | ||
m.Get("/search", repo.TopicSearch) | ||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryRepository)) | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TemplateType to align with other places?