aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-09-05 16:40:39 +0200
committerChristopher Baines <mail@cbaines.net>2019-09-05 16:40:39 +0200
commitfe8102e1dfbc6dd83cc4ad03e2869a967750ba4f (patch)
tree589c70335c67867098d91e8ba85f6344ecec43e6
parent38adedcedef44436e7510576c8a8804cd75b7e87 (diff)
downloaddata-service-fe8102e1dfbc6dd83cc4ad03e2869a967750ba4f.tar
data-service-fe8102e1dfbc6dd83cc4ad03e2869a967750ba4f.tar.gz
Use numeric ids for git repositories
-rw-r--r--guix-data-service/model/git-repository.scm15
-rw-r--r--guix-data-service/web/controller.scm5
-rw-r--r--guix-data-service/web/view/html.scm2
3 files changed, 15 insertions, 7 deletions
diff --git a/guix-data-service/model/git-repository.scm b/guix-data-service/model/git-repository.scm
index 610dc49..8c7cb14 100644
--- a/guix-data-service/model/git-repository.scm
+++ b/guix-data-service/model/git-repository.scm
@@ -11,10 +11,17 @@
guix-revisions-and-jobs-for-git-repository))
(define (all-git-repositories conn)
- (exec-query
- conn
- (string-append
- "SELECT id, label, url, cgit_url_base FROM git_repositories ORDER BY id ASC")))
+ (map
+ (match-lambda
+ ((id label url cgit-base-url)
+ (list (string->number id)
+ label
+ url
+ cgit-base-url)))
+ (exec-query
+ conn
+ (string-append
+ "SELECT id, label, url, cgit_url_base FROM git_repositories ORDER BY id ASC"))))
(define (select-git-repository conn id)
(match (exec-query
diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm
index 85c2b6a..038af58 100644
--- a/guix-data-service/web/controller.scm
+++ b/guix-data-service/web/controller.scm
@@ -829,7 +829,8 @@
(view-git-repository
id
label url cgit-url-base
- (all-branches-with-most-recent-commit conn id))))
+ (all-branches-with-most-recent-commit conn
+ (string->number id)))))
(#f
(render-html
#:sxml (general-not-found
@@ -853,7 +854,7 @@
parsed-query-parameters
(most-recent-commits-for-branch
conn
- repository-id
+ (string->number repository-id)
branch-name
#:limit (assq-ref parsed-query-parameters 'limit_results)
#:after-date (assq-ref parsed-query-parameters
diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm
index 382a19e..e8c7a09 100644
--- a/guix-data-service/web/view/html.scm
+++ b/guix-data-service/web/view/html.scm
@@ -916,7 +916,7 @@
`(tr
(td
(a (@ (href ,(string-append
- "/repository/" git-repository-id
+ "/repository/" (number->string git-repository-id)
"/branch/" name)))
,name))
(td ,date)