From a197647933d2ab8e112582f98877a7885389dd85 Mon Sep 17 00:00:00 2001 From: Howl Date: Mon, 26 Sep 2016 17:16:56 +0200 Subject: [PATCH] Include doc title in documentation content get --- app/v1/doc.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/v1/doc.go b/app/v1/doc.go index 49da85d..3e0bd60 100644 --- a/app/v1/doc.go +++ b/app/v1/doc.go @@ -45,6 +45,7 @@ func DocGET(md common.MethodData) common.CodeMessager { type docContentResponse struct { common.ResponseBase + Title string `json:"title"` Content string `json:"content"` } @@ -59,7 +60,7 @@ func DocContentGET(md common.MethodData) common.CodeMessager { wc = "AND public = '1'" } var r docContentResponse - err := md.DB.QueryRow("SELECT doc_contents FROM docs WHERE id = ? "+wc+" LIMIT 1", docID).Scan(&r.Content) + err := md.DB.QueryRow("SELECT doc_name, doc_contents FROM docs WHERE id = ? "+wc+" LIMIT 1", docID).Scan(&r.Title, &r.Content) switch { case err == sql.ErrNoRows: r.Code = 404