From e6c77e64a88bb259b367aa59b3c38092810f7e53 Mon Sep 17 00:00:00 2001 From: Howl Date: Thu, 1 Sep 2016 22:58:21 +0200 Subject: [PATCH] Pagination in badgesGET --- app/v1/badge.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/v1/badge.go b/app/v1/badge.go index e444ba2..04aaa5c 100644 --- a/app/v1/badge.go +++ b/app/v1/badge.go @@ -25,10 +25,9 @@ func BadgesGET(md common.MethodData) common.CodeMessager { err error ) if md.Query("id") != "" { - // TODO(howl): ID validation - rows, err = md.DB.Query("SELECT id, name, icon FROM badges WHERE id = ?", md.Query("id")) + rows, err = md.DB.Query("SELECT id, name, icon FROM badges WHERE id = ? LIMIT 1", md.Query("id")) } else { - rows, err = md.DB.Query("SELECT id, name, icon FROM badges") + rows, err = md.DB.Query("SELECT id, name, icon FROM badges " + common.Paginate(md.Query("p"), md.Query("l"), 50)) } if err != nil { md.Err(err)