Add slug return on post
This commit is contained in:
parent
f5a37e34d4
commit
38e7f62c15
1 changed files with 3 additions and 2 deletions
|
@ -50,6 +50,7 @@ type ReturnError struct {
|
|||
type ReturnSuccess struct {
|
||||
Message string `json:"success"`
|
||||
ID int `json:"id"`
|
||||
Slug string `json:"slug",db:"slug"`
|
||||
}
|
||||
|
||||
type ReferenceID struct {
|
||||
|
@ -169,7 +170,7 @@ func createBlogPost(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
}
|
||||
returnSuccess := ReturnSuccess{Message: "post created", ID: article_id}
|
||||
returnSuccess := ReturnSuccess{Message: "post created", ID: article_id, Slug: as}
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
render.JSON(w, r, returnSuccess)
|
||||
return
|
||||
|
@ -224,7 +225,7 @@ func updateBlogPostById(w http.ResponseWriter, r *http.Request) {
|
|||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
returnSuccess := ReturnSuccess{Message: "post updated", ID: post.ID}
|
||||
returnSuccess := ReturnSuccess{Message: "post updated", ID: post.ID, Slug: post.Slug}
|
||||
w.WriteHeader(http.StatusOK)
|
||||
render.JSON(w, r, returnSuccess)
|
||||
return
|
||||
|
|
Reference in a new issue