removal of python, uses golang testing

This commit is contained in:
samantha42
2026-03-21 08:14:36 +01:00
parent fa3faeec90
commit 771eb9d166
16 changed files with 1443 additions and 2158 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"net/http"
"strconv"
"strings"
"Engine/internal/model"
"Engine/internal/service"
@@ -23,6 +24,13 @@ func (h *BudgetHandler) Create(w http.ResponseWriter, r *http.Request) {
writeError(w, http.StatusBadRequest, "invalid request body")
return
}
errs := req.Valid()
if len(errs) > 0 {
writeError(w, http.StatusBadRequest, strings.Join(errs, "; "))
return
}
budget, err := h.svc.Create(r.Context(), req)
if err != nil {
writeError(w, http.StatusInternalServerError, err.Error())
@@ -42,6 +50,13 @@ func (h *BudgetHandler) Update(w http.ResponseWriter, r *http.Request) {
writeError(w, http.StatusBadRequest, "invalid request body")
return
}
errs := req.Valid()
if len(errs) > 0 {
writeError(w, http.StatusBadRequest, strings.Join(errs, "; "))
return
}
budget, err := h.svc.Update(r.Context(), id, req)
if err != nil {
writeError(w, http.StatusInternalServerError, err.Error())