chore(api): start moving some types to the codegen types

This commit is contained in:
Gabe Kangas
2024-07-01 22:17:10 -07:00
parent 93c0a20935
commit 96119efa41
3 changed files with 14 additions and 20 deletions

View File

@@ -5,6 +5,7 @@ import (
"net/http"
"github.com/owncast/owncast/core/data"
"github.com/owncast/owncast/webserver/handlers/generated"
webutils "github.com/owncast/owncast/webserver/utils"
)
@@ -14,19 +15,15 @@ func SetCustomColorVariableValues(w http.ResponseWriter, r *http.Request) {
return
}
type request struct {
Value map[string]string `json:"value"`
}
decoder := json.NewDecoder(r.Body)
var values request
var values generated.SetCustomColorVariableValuesJSONBody
if err := decoder.Decode(&values); err != nil {
webutils.WriteSimpleResponse(w, false, "unable to update appearance variable values")
return
}
if err := data.SetCustomColorVariableValues(values.Value); err != nil {
if err := data.SetCustomColorVariableValues(*values.Value); err != nil {
webutils.WriteSimpleResponse(w, false, err.Error())
return
}