@@ -6,7 +6,7 @@ import time
66import api
77
88@['/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 {
1010 has_access := app.has_user_repo_read_access_by_repo_name (ctx, ctx.user.id, username,
1111 repo_name)
1212
@@ -18,17 +18,20 @@ fn (mut app App) handle_commits_count(username string, repo_name string, branch_
1818 return ctx.json_error ('Not found' )
1919 }
2020
21+
2122 branch := app.find_repo_branch_by_name (repo.id, branch_name)
2223 count := app.get_repo_commit_count (repo.id, branch.id)
2324
25+ // app.debug("${branch} ${count}" )
26+
2427 return ctx.json (api.ApiCommitCount{
2528 success: true
2629 result: count
2730 })
2831}
2932
3033@['/: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 {
3235 repo := app.find_repo_by_name_and_username (repo_name, username) or { return ctx.not_found () }
3336
3437 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
7275}
7376
7477@['/: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 {
7679 repo := app.find_repo_by_name_and_username (repo_name, username) or { return ctx.not_found () }
7780
7881 is_patch_request := hash.ends_with ('.patch' )
0 commit comments