Include doc title in documentation content get

This commit is contained in:
Howl 2016-09-26 17:16:56 +02:00
parent 0e27793d25
commit a197647933

View File

@ -45,6 +45,7 @@ func DocGET(md common.MethodData) common.CodeMessager {
type docContentResponse struct { type docContentResponse struct {
common.ResponseBase common.ResponseBase
Title string `json:"title"`
Content string `json:"content"` Content string `json:"content"`
} }
@ -59,7 +60,7 @@ func DocContentGET(md common.MethodData) common.CodeMessager {
wc = "AND public = '1'" wc = "AND public = '1'"
} }
var r docContentResponse 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 { switch {
case err == sql.ErrNoRows: case err == sql.ErrNoRows:
r.Code = 404 r.Code = 404