mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-05-06 04:42:36 +02:00
Add get followers
This commit is contained in:
parent
b89296c249
commit
e8047c77a0
10 changed files with 162 additions and 17 deletions
|
@ -1,11 +1,11 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/julienschmidt/httprouter"
|
||||
"github.com/notherealmarco/WASAPhoto/service/api/authorization"
|
||||
"github.com/notherealmarco/WASAPhoto/service/api/helpers"
|
||||
"github.com/notherealmarco/WASAPhoto/service/api/reqcontext"
|
||||
"github.com/notherealmarco/WASAPhoto/service/structures"
|
||||
)
|
||||
|
@ -17,14 +17,18 @@ func (rt *_router) UpdateUsername(w http.ResponseWriter, r *http.Request, ps htt
|
|||
return
|
||||
}
|
||||
var req structures.UserDetails
|
||||
err := json.NewDecoder(r.Body).Decode(&req) //todo: capire se serve close
|
||||
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest) // todo: move to DecodeOrBadRequest helper
|
||||
if !helpers.DecodeJsonOrBadRequest(r.Body, w, &req, rt.baseLogger) {
|
||||
return
|
||||
}
|
||||
|
||||
err = rt.db.UpdateUsername(uid, req.Name)
|
||||
//err := json.NewDecoder(r.Body).Decode(&req) //todo: capire se serve close
|
||||
|
||||
//if err != nil {
|
||||
// w.WriteHeader(http.StatusBadRequest) // todo: move to DecodeOrBadRequest helper
|
||||
// return
|
||||
//}
|
||||
|
||||
err := rt.db.UpdateUsername(uid, req.Name)
|
||||
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError) // todo: is not ok, maybe let's use a helper
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue