@@ -6,7 +6,7 @@ import time
6
6
import api
7
7
8
8
@['/api/v1/:user/:repo_name/:branch_name/commits/count' ]
9
- fn (mut app App) handle_commits_count (username string , repo_name string , branch_name string ) veb.Result {
9
+ fn (mut app App) handle_commits_count (mut ctx Context, username string , repo_name string , branch_name string ) veb.Result {
10
10
has_access := app.has_user_repo_read_access_by_repo_name (ctx, ctx.user.id, username,
11
11
repo_name)
12
12
@@ -18,17 +18,20 @@ fn (mut app App) handle_commits_count(username string, repo_name string, branch_
18
18
return ctx.json_error ('Not found' )
19
19
}
20
20
21
+
21
22
branch := app.find_repo_branch_by_name (repo.id, branch_name)
22
23
count := app.get_repo_commit_count (repo.id, branch.id)
23
24
25
+ // app.debug("${branch} ${count}" )
26
+
24
27
return ctx.json (api.ApiCommitCount{
25
28
success: true
26
29
result: count
27
30
})
28
31
}
29
32
30
33
@['/:username/:repo_name/:branch_name/commits/:page' ]
31
- pub fn (mut app App) commits (username string , repo_name string , branch_name string , page int ) veb.Result {
34
+ pub fn (mut app App) commits (mut ctx Context, username string , repo_name string , branch_name string , page int ) veb.Result {
32
35
repo := app.find_repo_by_name_and_username (repo_name, username) or { return ctx.not_found () }
33
36
34
37
branch := app.find_repo_branch_by_name (repo.id, branch_name)
@@ -72,7 +75,7 @@ pub fn (mut app App) commits(username string, repo_name string, branch_name stri
72
75
}
73
76
74
77
@['/:username/:repo_name/commit/:hash' ]
75
- pub fn (mut app App) commit (username string , repo_name string , hash string ) veb.Result {
78
+ pub fn (mut app App) commit (mut ctx Context, username string , repo_name string , hash string ) veb.Result {
76
79
repo := app.find_repo_by_name_and_username (repo_name, username) or { return ctx.not_found () }
77
80
78
81
is_patch_request := hash.ends_with ('.patch' )
0 commit comments