Merging with dev/cedric

This commit is contained in:
gom-by
2025-01-28 18:30:56 +01:00
54 changed files with 1083 additions and 624 deletions

View File

@@ -1,4 +1,4 @@
package api
package blogs
import (
"context"
@@ -8,10 +8,12 @@ import (
core "fr.latosa-escrima/api/core"
)
func HandleGetBlog(w http.ResponseWriter, r *http.Request) {
func HandleBlog(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
blog_uuid := r.PathValue("uuid")
var blog core.Blog
var blog core.Blog
_, err := core.DB.NewSelect().
Model(&blog).
Where("blog_id = ?", blog_uuid).
@@ -19,18 +21,18 @@ func HandleGetBlog(w http.ResponseWriter, r *http.Request) {
ScanAndCount(context.Background())
if err != nil {
core.JSONError{
Status: core.Error,
Status: core.Error,
Message: err.Error(),
}.Respond(w, http.StatusNotAcceptable)
return
return
}
core.JSONSuccess{
Status: core.Success,
Message: "Status OK",
Data: blog,
Data: blog,
}.Respond(w, http.StatusOK)
return
return
}
func HandleGetBlogs(w http.ResponseWriter, r *http.Request) {