transactions.html can edit though needs some kinda user feedback of the changed row or something...
All checks were successful
cicd / ci (push) Successful in 1m28s
All checks were successful
cicd / ci (push) Successful in 1m28s
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"embed"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -110,7 +111,21 @@ func (router Router) APITransactions(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (router Router) APIAmend(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, http.StatusText(http.StatusNotImplemented), http.StatusNotImplemented)
|
||||
b, _ := io.ReadAll(r.Body)
|
||||
|
||||
var req struct {
|
||||
Old ledger.Delta
|
||||
Now ledger.Delta
|
||||
}
|
||||
if err := json.Unmarshal(b, &req); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if err := router.files.Amend(req.Old, req.Now); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (router Router) APIReg(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user