Clean queue after sending
This commit is contained in:
parent
1c3116d9dc
commit
dfd6260a7a
3 changed files with 49 additions and 16 deletions
7
main.go
7
main.go
|
|
@ -299,19 +299,18 @@ func actionNodeRetrieve(w http.ResponseWriter, r *http.Request) { // {{{
|
|||
func actionSyncToServer(w http.ResponseWriter, r *http.Request) { // {{{
|
||||
user := getUser(r)
|
||||
|
||||
body, _ := r.GetBody()
|
||||
data, _ := io.ReadAll(body)
|
||||
body, _ := io.ReadAll(r.Body)
|
||||
var request struct {
|
||||
ClientUUID string
|
||||
NodeData string
|
||||
}
|
||||
err := json.Unmarshal(data, &request)
|
||||
err := json.Unmarshal(body, &request)
|
||||
if err != nil {
|
||||
httpError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
db.Exec(`CALL add_nodes(%d, %s::jsonb)`, user.ID, request.ClientUUID, request.NodeData)
|
||||
db.Exec(`CALL add_nodes($1, $2, $3::jsonb)`, user.ID, request.ClientUUID, request.NodeData)
|
||||
|
||||
responseData(w, map[string]interface{}{
|
||||
"OK": true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue