1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-26 09:09:36 -05:00
forgejo/routers/api/v1/repo
qwerty287 9d943bf374
Add missing X-Total-Count and fix some related bugs (#17968)
* Add missing `X-Total-Count` and fix some related bugs

Adds `X-Total-Count` header to APIs that return a list but doesn't have it yet.
Fixed bugs:
* not returned after reporting error (39eb82446c/routers/api/v1/user/star.go (L70))
* crash with index out of bounds, API issue/issueSubscriptions

I also found various endpoints that return lists but do not apply/support pagination yet:
```
/repos/{owner}/{repo}/issues/{index}/labels
/repos/{owner}/{repo}/issues/comments/{id}/reactions
/repos/{owner}/{repo}/branch_protections
/repos/{owner}/{repo}/contents
/repos/{owner}/{repo}/hooks/git
/repos/{owner}/{repo}/issue_templates
/repos/{owner}/{repo}/releases/{id}/assets
/repos/{owner}/{repo}/reviewers
/repos/{owner}/{repo}/teams
/user/emails
/users/{username}/heatmap
```
If this is not expected, an new issue should be opened.

Closes #13043

* fmt

* Update routers/api/v1/repo/issue_subscription.go

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>

* Use FindAndCount

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: 6543 <6543@obermui.de>
2021-12-15 13:39:34 +08:00
..
blob.go Move repofiles from modules/repofiles to services/repository/files (#17774) 2021-11-24 15:56:24 +08:00
branch.go Move repository model into models/repo (#17933) 2021-12-10 09:27:50 +08:00
collaborators.go Move repository model into models/repo (#17933) 2021-12-10 09:27:50 +08:00
commits.go Move repository model into models/repo (#17933) 2021-12-10 09:27:50 +08:00
file.go Move repository model into models/repo (#17933) 2021-12-10 09:27:50 +08:00
fork.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
git_hook.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
git_ref.go Multiple Escaping Improvements (#17551) 2021-11-16 18:18:25 +00:00
hook.go Move accessmode into models/perm (#17828) 2021-11-28 12:58:28 +01:00
hook_test.go Decouple unit test, remove intermediate unittestbridge package (#17662) 2021-11-16 16:53:21 +08:00
issue.go Move user related model into models/user (#17781) 2021-11-24 17:49:20 +08:00
issue_comment.go [API] generalize list header (#16551) 2021-08-12 14:43:08 +02:00
issue_label.go Calculate label URL on API (#16186) 2021-09-10 18:03:16 +02:00
issue_reaction.go Add missing X-Total-Count and fix some related bugs (#17968) 2021-12-15 13:39:34 +08:00
issue_stopwatch.go Fix close issue but time watcher still running (#17643) 2021-11-21 17:11:48 +08:00
issue_subscription.go Add missing X-Total-Count and fix some related bugs (#17968) 2021-12-15 13:39:34 +08:00
issue_tracked_time.go Move user related model into models/user (#17781) 2021-11-24 17:49:20 +08:00
key.go Move keys to models/asymkey (#17917) 2021-12-10 16:14:24 +08:00
label.go Calculate label URL on API (#16186) 2021-09-10 18:03:16 +02:00
language.go Move repository model into models/repo (#17933) 2021-12-10 09:27:50 +08:00
main_test.go Decouple unit test code from business code (#17623) 2021-11-12 22:36:47 +08:00
migrate.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
milestone.go [API] generalize list header (#16551) 2021-08-12 14:43:08 +02:00
mirror.go Move unit into models/unit/ (#17576) 2021-11-09 20:57:58 +01:00
notes.go Add an api endpoint to fetch git notes (#15373) (#16649) 2021-08-11 03:01:40 +02:00
pull.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
pull_review.go Move user related model into models/user (#17781) 2021-11-24 17:49:20 +08:00
release.go Move accessmode into models/perm (#17828) 2021-11-28 12:58:28 +01:00
release_attachment.go Move attachment into models/repo/ (#17650) 2021-11-19 21:39:57 +08:00
release_tags.go [API] Add delete release by tag & fix unreleased inconsistency (#14563) 2021-02-07 19:32:18 +01:00
repo.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
repo_test.go Move repository model into models/repo (#17933) 2021-12-10 09:27:50 +08:00
star.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
status.go Add missing X-Total-Count and fix some related bugs (#17968) 2021-12-15 13:39:34 +08:00
subscriber.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
tag.go [API] generalize list header (#16551) 2021-08-12 14:43:08 +02:00
teams.go Move repository model into models/repo (#17933) 2021-12-10 09:27:50 +08:00
topic.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
transfer.go Some repository refactors (#17950) 2021-12-12 23:48:20 +08:00
tree.go Add missing X-Total-Count and fix some related bugs (#17968) 2021-12-15 13:39:34 +08:00
wiki.go Add missing X-Total-Count and fix some related bugs (#17968) 2021-12-15 13:39:34 +08:00