feat: user creation

This commit is contained in:
Robin Dittmar
2026-07-20 21:57:43 +02:00
parent 49f1497f45
commit 14b82b787b
8 changed files with 178 additions and 13 deletions
+26
View File
@@ -0,0 +1,26 @@
package request
import (
"encoding/json"
"fmt"
"net/http"
)
type CreateUserPayload struct {
Email string `json:"email"`
Name string `json:"name"`
Password string `json:"password"`
}
func DecodeCreateUser(r *http.Request) (CreateUserPayload, error) {
var payload CreateUserPayload
decoder := json.NewDecoder(r.Body)
decoder.DisallowUnknownFields()
if err := decoder.Decode(&payload); err != nil {
return payload, fmt.Errorf("error decoding create user payload: %w", err)
}
return payload, nil
}