2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/data-service.git synced 2023-12-14 03:23:03 +01:00

Include data in JSON response for the branch page

Signed-off-by: Christopher Baines <mail@cbaines.net>
This commit is contained in:
spf50 2020-03-28 02:10:23 +01:00 committed by Christopher Baines
parent d1c243f7fd
commit f980b6c2ac

View file

@ -74,7 +74,22 @@
'(application/json text/html)
mime-types)
((application/json)
(render-json '((error . "unimplemented")))) ; TODO
(render-json
`((revisions
. ,(list->vector
(map (match-lambda
((date commit-hash _ _)
`((date . ,date)
(commit-hash . ,commit-hash))))
(most-recent-commits-for-branch
conn
(string->number repository-id)
branch-name
#:limit (assq-ref parsed-query-parameters 'limit_results)
#:after-date (assq-ref parsed-query-parameters
'after_date)
#:before-date (assq-ref parsed-query-parameters
'before_date))))))))
(else
(render-html
#:sxml (if (any-invalid-query-parameters? parsed-query-parameters)