fix(api): add snake_case json tags to Endpoint/Task/request bodies for frontend contract

Go's encoding/json does not bridge snake_case <-> PascalCase field names,
so store.Endpoint, store.Task and the anonymous request bodies in
accounts.go/auth.go were silently decoding empty/zero values from the
frontend's snake_case JSON contract (tls_mode, role_label,
src_endpoint_id, dst_endpoint_id, src_login/pass, dst_login/pass).
Adds explicit json tags; DB layer is unaffected since pgx binds by
positional params, not struct-tag reflection.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMHQTtnQtQqL8muAXHr9kd
This commit is contained in:
2026-07-01 19:04:46 +07:00
parent 1a451f9dbb
commit 38005c0618
5 changed files with 54 additions and 13 deletions
+5 -5
View File
@@ -3,11 +3,11 @@ package store
import "context"
type Endpoint struct {
ID int64
RoleLabel string
Host string
Port int
TLSMode string
ID int64 `json:"id"`
RoleLabel string `json:"role_label"`
Host string `json:"host"`
Port int `json:"port"`
TLSMode string `json:"tls_mode"`
}
func (s *Store) CreateEndpoint(ctx context.Context, e Endpoint) (int64, error) {