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
1 changed files with 2 additions and 1 deletions

View File

@ -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