diff options
author | Christopher Baines <mail@cbaines.net> | 2019-06-13 23:14:04 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-06-13 23:14:04 +0100 |
commit | 13e2f875551b0122270a1c2fa0dd0b4d8f4db60c (patch) | |
tree | bb84ba426c9c5982c41bd0c2379fcc79e6047aad /guix-data-service/web/controller.scm | |
parent | 0bd1fc7e87a3f6702f4c1fd97a23d3b13be94efc (diff) | |
download | data-service-13e2f875551b0122270a1c2fa0dd0b4d8f4db60c.tar data-service-13e2f875551b0122270a1c2fa0dd0b4d8f4db60c.tar.gz |
Support accessing the latest processed revision for a branch
This makes is easier to get the latest data for a branch in a single request,
rather than making one request to find the latest revision, then another to
get the data.
Diffstat (limited to 'guix-data-service/web/controller.scm')
-rw-r--r-- | guix-data-service/web/controller.scm | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm index bc489b5..76b6a59 100644 --- a/guix-data-service/web/controller.scm +++ b/guix-data-service/web/controller.scm @@ -682,6 +682,44 @@ 'after_date) #:before-date (assq-ref parsed-query-parameters 'before_date))))))) + ((GET "branch" branch-name "latest-processed-revision") + (let ((commit-hash + (latest-processed-commit-for-branch conn branch-name))) + (if commit-hash + (render-view-revision mime-types + conn + commit-hash) + (render-unknown-revision mime-types + conn + commit-hash)))) + ((GET "branch" branch-name "latest-processed-revision" "packages") + (let ((commit-hash + (latest-processed-commit-for-branch conn branch-name))) + (if commit-hash + (let ((parsed-query-parameters + (guard-against-mutually-exclusive-query-parameters + (parse-query-parameters + request + `((after_name ,identity) + (field ,identity #:multi-value + #:default ("version" "synopsis")) + (search_query ,identity) + (limit_results ,parse-result-limit + #:no-default-when (all_results) + #:default 100) + (all_results ,parse-checkbox-value))) + ;; You can't specify a search query, but then also limit the + ;; results by filtering for after a particular package name + '((after_name search_query) + (limit_results all_results))))) + + (render-revision-packages mime-types + conn + commit-hash + parsed-query-parameters)) + (render-unknown-revision mime-types + conn + commit-hash)))) ((GET "gnu" "store" filename) ;; These routes are a little special, as the extensions aren't used for ;; content negotiation, so just use the path from the request |