-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
wip: API for projects and boards #20208
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
Closed
Closed
Changes from all commits
Commits
Show all changes
121 commits
Select commit
Hold shift + click to select a range
091b549
test(projects): start of the implementations
dineshsalunke ce3dbfd
refactor(project): project and board swagger documentation
dineshsalunke 781b1cc
refactor(project): fix some swagger errors
dineshsalunke 7103a2c
refactor(project): minor cleanup
dineshsalunke 45f44cb
refactor(api): try to match with github api
dineshsalunke d32ab45
Remove `GO111MODULE` (#20221)
fa3dc73
Allow enable LDAP source and disable user sync via CLI (#20206)
justusbunsi a7f1f6a
Allow dev i18n to be more concurrent (#20159)
zeripath 31c847c
Add integration tests for the Gitea migration form (#20121)
realaravinth 3814116
Adjust template for #20069 smallbell (#20108)
tyroneyeh db82c7c
Adjust class for mobile has the problem of double small bells (#20236)
tyroneyeh 33eb19b
Display full name (#20171)
kimbj95 be710da
Adjust max-widths for the repository file table (#20243)
zeripath 1890c80
Bypass Firefox (iOS) bug (#20244)
wxiaoguang 2b86075
Init popup for new code comment (#20234)
b010ac6
Only show Followers that current user can access (#20220)
zeripath e0b93f5
EscapeFilter the group dn membership (#20200)
zeripath 559b2bf
Bump mermaid from 9.1.1 to 9.1.2 (#20256)
dependabot[bot] 957836f
Refix notification bell placement (#20251)
zeripath 053c5f6
Allow RSA 2047 bit keys (#20272)
zeripath 4d769e5
Fix toolip on mobile notification bell (#20270)
zeripath 392f27f
Modify milestone search keywords to be case insensitive (#20266)
tyroneyeh 92aede0
Fix NPE when using non-numeric (#20277)
176015c
Add tooltip to repo icons in explore page (#20241)
renbaoshuo c59d9c4
Use git.HOME_PATH for Git HOME directory (#20114)
wxiaoguang b9fbab3
Implement sync push mirror on commit (#19411)
harryzcy 0b19a3b
Do not create empty ".ssh" directory when loading config (#20289)
wxiaoguang 1a33414
Merge branch 'main' into projects-api
6543 a94f127
refactor(swagger): added the missing comments
dineshsalunke 6fb081b
refactor(api): add paging query for list endpoints
dineshsalunke e192014
chore(swagger): add missing swagger documentation
dineshsalunke c060beb
refactor(integrations): add boilerplate file project and board tests
dineshsalunke cef8c54
feat(projects): api for projects
dineshsalunke ed8543a
Merge branch 'main' into projects-api
dineshsalunke 649042f
Include login_name in adminCreateUser response (#20283)
kimbj95 03d146c
Fix eslint parsing errors, remove eslint-plugin-html (#20323)
silverwind c759cb9
Fix commit status icon when in subdirectory (#20285)
silverwind a6f1d33
Allow access to the Public Organization Member lists with minimal per…
a1012112796 498dd78
Initialize cron last (#20373)
zeripath 264f02d
Set target on create release with existing tag (#20381)
3b81e40
Use git.HOME_PATH for Git HOME directory (#20114)
wxiaoguang 16d9f5c
Implement sync push mirror on commit (#19411)
harryzcy 3916df6
refactor(): add missing return statement
dineshsalunke 23d883f
feat(board): endpoints for board
dineshsalunke 9a9ae85
chore(): swagger def update
dineshsalunke 62a3eb0
Merge branch 'main' into projects-api
dineshsalunke 1fd61f8
refactor(): fix swagger lint issues
dineshsalunke 23e5fd0
Merge branch 'main' into projects-api
dineshsalunke 11a55a0
Merge branch 'main' into projects-api
6543 b73c091
adjust to latest refactors
6543 e26057d
Apply suggestions from code review
6543 d3e7f2c
Update models/project/board.go
6543 8bf5e48
Update models/project/board.go
6543 503d2c1
fix build
6543 8804733
update unit tests
6543 6fbcb6e
use caching to load Attributes on lists
6543 855758b
fix revive
6543 2023f56
fix lint
6543 21d1dfb
Merge branch 'main' into projects-api
6543 317a361
Merge branch 'main' into projects-api
6543 8fd34df
Merge branch 'main' into projects-api
6543 252ecd8
Merge branch 'main' into projects-api
dineshsalunke b9a3748
refactor: remove Ctx suffix
dineshsalunke c64e6b6
refactor: split the list in new file
dineshsalunke b5d9130
refactor: check if the repos are same
dineshsalunke 857225e
fix: add permissions check
dineshsalunke 221b659
chore: add copyright header
dineshsalunke 8ffbea8
Merge branch 'main' into projects-api
dineshsalunke 12b2816
Merge branch 'main' into projects-api
dineshsalunke f10c990
Merge branch 'main' into projects-api
dineshsalunke 8f93aa6
Merge branch 'main' into projects-api
dineshsalunke 8c6d45c
chore: update the copyrights
dineshsalunke c5880c7
Merge branch 'main' into projects-api
dineshsalunke dd364c9
Merge branch 'main' of https://github.com/dineshsalunke/gitea into pr…
dineshsalunke 22959c4
Merge branch 'projects-api' of https://github.com/dineshsalunke/gitea…
dineshsalunke 9161303
Merge branch 'main' into projects-api
dineshsalunke 461950e
refactor: update the imports
dineshsalunke f2c55f6
refactor: update imports and remove redundant condition
dineshsalunke 88f7ae0
refactor: check for the repo ids
dineshsalunke 187e27b
Merge branch 'main' into projects-api
dineshsalunke edc3446
refactor: add permissions
dineshsalunke 78aa83b
Merge branch 'main' into projects-api
dineshsalunke 0f4be83
Merge branch 'main' of https://github.com/go-gitea/gitea into project…
dineshsalunke 58ef609
Merge branch 'projects-api' of https://github.com/dineshsalunke/gitea…
dineshsalunke 79667a3
Merge branch 'main' into projects-api
techknowlogick 479014c
Update modules/structs/project.go
techknowlogick 85e0a0b
Update routers/api/v1/repo/board.go
techknowlogick e8769cd
Update routers/api/v1/repo/project.go
techknowlogick dd422c3
placate lint
techknowlogick f2369e4
refactor: remove trace line
dineshsalunke 93ee056
Merge branch 'main' into projects-api
6543 957f0a3
Merge branch 'main' into projects-api
dineshsalunke bdb217c
Merge branch 'main' into projects-api
GiteaBot ff5a443
Merge branch 'main' into projects-api
dineshsalunke 2fce167
Merge branch 'main' into projects-api
GiteaBot f3b5447
Merge remote-tracking branch 'upstream/main' into projects-api
dineshsalunke 89914eb
Merge branch 'projects-api' of https://github.com/dineshsalunke/gitea…
dineshsalunke aa7e2a4
Merge remote-tracking branch 'upstream/main' into projects-api
dineshsalunke f1aa661
refactor; remove the redudant functions
dineshsalunke 43ff02a
refactor: add method on project struct instead of exposing it from mo…
dineshsalunke a9d6f0d
refactor: add the context parameter
dineshsalunke 4b99ba2
refactor: add the context parameter
dineshsalunke 2570b39
refactor: use the method on project struct
dineshsalunke ce9a62a
refactor: add the context parameter
dineshsalunke 2fb7328
refactor: organize everything related to projects api in its own module
dineshsalunke c552a56
refactor: update the swagger documentation
dineshsalunke e405015
chore: remove the redundant test fixture
dineshsalunke eb0d417
refactor: add empty some empty methods with swagger docs
dineshsalunke edeed31
refactor: update the swagger documentation
dineshsalunke bc4420c
Merge branch 'main' into projects-api
dineshsalunke 47ce10c
refactor: empty the previous test's in order to write anew
dineshsalunke 7d68621
Merge branch 'projects-api' of https://github.com/dineshsalunke/gitea…
dineshsalunke 575c3b1
refactor: add cardtype field to create project payload
dineshsalunke db684a9
refactor: add the projects endpoints to the router
dineshsalunke 92722d8
Merge remote-tracking branch 'upstream/main' into projects-api
dineshsalunke 3d0a4e9
Merge remote-tracking branch 'upstream/main' into projects-api
dineshsalunke 1676b4d
Merge remote-tracking branch 'upstream/main' into projects-api
dineshsalunke ff9ac96
Merge branch 'projects-api' of https://github.com/dineshsalunke/gitea…
dineshsalunke 22177d4
chore: add fixture for project on organization
dineshsalunke 732727c
fix: ignore loading and converting of Repo on projects assgined to org
dineshsalunke ac02a7c
test: add test for list org projects
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
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,51 @@ | ||||||
// Copyright 2020 The Gitea Authors. All rights reserved. | ||||||
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.
Suggested change
... |
||||||
// SPDX-License-Identifier: MIT | ||||||
package project | ||||||
dineshsalunke marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
import ( | ||||||
"context" | ||||||
"fmt" | ||||||
|
||||||
repo_model "code.gitea.io/gitea/models/repo" | ||||||
user_model "code.gitea.io/gitea/models/user" | ||||||
) | ||||||
|
||||||
// List is a list of projects | ||||||
type List []*Project | ||||||
|
||||||
// LoadAttributes load repos and creators of projects. | ||||||
func (pl List) LoadAttributes(ctx context.Context) (err error) { | ||||||
repos := make(map[int64]*repo_model.Repository) | ||||||
creators := make(map[int64]*user_model.User) | ||||||
var ok bool | ||||||
|
||||||
for i := range pl { | ||||||
// Organization projects don't have a Repo assgined and the repo_id for it is 0 | ||||||
// So lets make sure we handle that case as well | ||||||
if pl[i].Repo == nil && pl[i].RepoID != 0 { | ||||||
pl[i].Repo, ok = repos[pl[i].RepoID] | ||||||
if !ok { | ||||||
repo, err := repo_model.GetRepositoryByID(ctx, pl[i].RepoID) | ||||||
if err != nil { | ||||||
return fmt.Errorf("getRepositoryByID [%d]: %v", pl[i].RepoID, err) | ||||||
} | ||||||
pl[i].Repo = repo | ||||||
repos[pl[i].RepoID] = repo | ||||||
} | ||||||
} | ||||||
|
||||||
if pl[i].Creator == nil { | ||||||
pl[i].Creator, ok = creators[pl[i].CreatorID] | ||||||
if !ok { | ||||||
creator, err := user_model.GetUserByID(ctx, pl[i].CreatorID) | ||||||
if err != nil { | ||||||
return fmt.Errorf("getUserByID [%d]: %v", pl[i].CreatorID, err) | ||||||
} | ||||||
pl[i].Creator = creator | ||||||
creators[pl[i].CreatorID] = creator | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
return nil | ||||||
} |
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,70 @@ | ||
// 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"` | ||
} | ||
|
||
type Project struct { | ||
ID int64 `json:"id"` | ||
Title string `json:"title"` | ||
Description string `json:"description"` | ||
BoardType 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"` | ||
} | ||
|
||
type ProjectBoard struct { | ||
ID int64 `json:"id"` | ||
Title string `json:"title"` | ||
Default bool `json:"default"` | ||
Color string `json:"color"` | ||
Sorting int8 `json:"sorting"` | ||
Project *Project `json:"project"` | ||
Creator *User `json:"creator"` | ||
// swagger:strfmt date-time | ||
Created time.Time `json:"created_at"` | ||
// swagger:strfmt date-time | ||
Updated time.Time `json:"updated_at"` | ||
} | ||
|
||
// swagger:model | ||
type NewProjectBoardPayload struct { | ||
// required:true | ||
Title string `json:"title"` | ||
Default bool `json:"default"` | ||
Color string `json:"color"` | ||
Sorting int8 `json:"sorting"` | ||
} | ||
|
||
// swagger:model | ||
type UpdateProjectBoardPayload struct { | ||
Title string `json:"title"` | ||
Color string `json:"color"` | ||
} |
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
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.
?