Added "create list" handler, service + repository

This commit is contained in:
Robin Dittmar
2026-07-10 14:08:47 +02:00
parent d17eb34c25
commit 85602dbf95
8 changed files with 183 additions and 5 deletions
+27
View File
@@ -0,0 +1,27 @@
package request
import (
"encoding/json"
"fmt"
"net/http"
)
type CreateListPayload struct {
Name string `json:"name"`
UserIDs []string `json:"user_ids"`
}
func DecodeCreateList(r *http.Request) (CreateListPayload, error) {
var payload CreateListPayload
r.Body = http.MaxBytesReader(nil, r.Body, 1024*64)
decoder := json.NewDecoder(r.Body)
decoder.DisallowUnknownFields()
if err := decoder.Decode(&payload); err != nil {
return payload, fmt.Errorf("error decoding create list payload: %w", err)
}
return payload, nil
}