mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-03 00:45:22 +02:00
[API] generalize list header (#16551)
* Add info about list endpoints to CONTRIBUTING.md * Let all list endpoints return X-Total-Count header * Add TODOs for GetCombinedCommitStatusByRef * Fix models/issue_stopwatch.go * Rrefactor models.ListDeployKeys * Introduce helper func and use them for SetLinkHeader related func
This commit is contained in:
parent
ca13e1d56c
commit
2289580bb7
88 changed files with 637 additions and 329 deletions
|
@ -444,6 +444,11 @@ func GetLabelsByRepoID(repoID int64, sortType string, listOptions ListOptions) (
|
|||
return getLabelsByRepoID(x, repoID, sortType, listOptions)
|
||||
}
|
||||
|
||||
// CountLabelsByRepoID count number of all labels that belong to given repository by ID.
|
||||
func CountLabelsByRepoID(repoID int64) (int64, error) {
|
||||
return x.Where("repo_id = ?", repoID).Count(&Label{})
|
||||
}
|
||||
|
||||
// ________
|
||||
// \_____ \_______ ____
|
||||
// / | \_ __ \/ ___\
|
||||
|
@ -556,6 +561,11 @@ func GetLabelsByOrgID(orgID int64, sortType string, listOptions ListOptions) ([]
|
|||
return getLabelsByOrgID(x, orgID, sortType, listOptions)
|
||||
}
|
||||
|
||||
// CountLabelsByOrgID count all labels that belong to given organization by ID.
|
||||
func CountLabelsByOrgID(orgID int64) (int64, error) {
|
||||
return x.Where("org_id = ?", orgID).Count(&Label{})
|
||||
}
|
||||
|
||||
// .___
|
||||
// | | ______ ________ __ ____
|
||||
// | |/ ___// ___/ | \_/ __ \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue