Resolved conflicts
This commit is contained in:
@@ -2,32 +2,19 @@ package blogs
|
||||
|
||||
import (
|
||||
"context"
|
||||
<<<<<<< HEAD
|
||||
"fmt"
|
||||
=======
|
||||
>>>>>>> dev/cedric
|
||||
"net/http"
|
||||
|
||||
core "fr.latosa-escrima/core"
|
||||
"fr.latosa-escrima/core/models"
|
||||
)
|
||||
|
||||
<<<<<<< HEAD
|
||||
func HandleGetBlogs(w http.ResponseWriter, r *http.Request) {
|
||||
var blog []models.Blog
|
||||
count, err := core.DB.NewSelect().
|
||||
Model(&blog).
|
||||
=======
|
||||
func HandleBlog(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
blog_uuid := r.PathValue("uuid")
|
||||
|
||||
var blog models.Blog
|
||||
_, err := core.DB.NewSelect().
|
||||
Model(&blog).
|
||||
Where("blog_id = ?", blog_uuid).
|
||||
>>>>>>> dev/cedric
|
||||
Relation("Author").
|
||||
ScanAndCount(context.Background())
|
||||
if err != nil {
|
||||
@@ -40,40 +27,8 @@ func HandleBlog(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
core.JSONSuccess{
|
||||
Status: core.Success,
|
||||
<<<<<<< HEAD
|
||||
Message: fmt.Sprintf("%d blogs objects sent", count),
|
||||
=======
|
||||
Message: "Status OK",
|
||||
>>>>>>> dev/cedric
|
||||
Message: "Blog retrieved.",
|
||||
Data: blog,
|
||||
}.Respond(w, http.StatusOK)
|
||||
return
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<<< HEAD:backend/api/blogs/blog.go
|
||||
|
||||
func HandleBlogs(w http.ResponseWriter, r *http.Request) {
|
||||
var blog []core.Blog
|
||||
count, err := core.DB.NewSelect().
|
||||
Model(&blog).
|
||||
Relation("Author").
|
||||
ScanAndCount(context.Background())
|
||||
if err != nil {
|
||||
core.JSONError{
|
||||
Status: core.Error,
|
||||
Message: err.Error(),
|
||||
}.Respond(w, http.StatusNotAcceptable)
|
||||
return
|
||||
}
|
||||
|
||||
core.JSONSuccess{
|
||||
Status: core.Success,
|
||||
Message: fmt.Sprint("%d blogs objects sent", count),
|
||||
Data: blog,
|
||||
}.Respond(w, http.StatusOK)
|
||||
return
|
||||
}
|
||||
========
|
||||
>>>>>>>> dev/cedric:backend/api/blogs/blogs.go
|
||||
=======
|
||||
>>>>>>> dev/cedric
|
||||
|
||||
Reference in New Issue
Block a user