ax(mining): replace prose DTO comments with usage examples in node_service.go
Eight struct type comments restated what the name already said (AX Principle 2 violation). Replaced all with concrete HTTP request/response examples showing actual field values, so agents can learn call shape from context alone. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
1b021a073b
commit
f78be454e4
1 changed files with 8 additions and 8 deletions
|
|
@ -126,7 +126,7 @@ func (ns *NodeService) handleNodeInfo(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
// NodeInitRequest is the request body for node initialization.
|
||||
// POST /node/init {"name": "my-node", "role": "worker"}
|
||||
type NodeInitRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Role string `json:"role"` // "controller", "worker", or "dual"
|
||||
|
|
@ -186,7 +186,7 @@ func (ns *NodeService) handleListPeers(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, peers)
|
||||
}
|
||||
|
||||
// AddPeerRequest is the request body for adding a peer.
|
||||
// POST /peers {"address": "10.0.0.2:9090", "name": "worker-1"}
|
||||
type AddPeerRequest struct {
|
||||
Address string `json:"address" binding:"required"`
|
||||
Name string `json:"name"`
|
||||
|
|
@ -356,7 +356,7 @@ func (ns *NodeService) handlePeerStats(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, stats)
|
||||
}
|
||||
|
||||
// RemoteStartRequest is the request body for starting a remote miner.
|
||||
// POST /remote/{peerId}/start {"minerType": "xmrig", "profileId": "abc123"}
|
||||
type RemoteStartRequest struct {
|
||||
MinerType string `json:"minerType" binding:"required"`
|
||||
ProfileID string `json:"profileId,omitempty"`
|
||||
|
|
@ -388,7 +388,7 @@ func (ns *NodeService) handleRemoteStart(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, gin.H{"status": "miner started"})
|
||||
}
|
||||
|
||||
// RemoteStopRequest is the request body for stopping a remote miner.
|
||||
// POST /remote/{peerId}/stop {"minerName": "xmrig-main"}
|
||||
type RemoteStopRequest struct {
|
||||
MinerName string `json:"minerName" binding:"required"`
|
||||
}
|
||||
|
|
@ -450,7 +450,7 @@ func (ns *NodeService) handleRemoteLogs(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, logs)
|
||||
}
|
||||
|
||||
// AuthModeResponse is the response for auth mode endpoints.
|
||||
// GET /peers/auth/mode → {"mode": "open"} or {"mode": "allowlist"}
|
||||
type AuthModeResponse struct {
|
||||
Mode string `json:"mode"`
|
||||
}
|
||||
|
|
@ -471,7 +471,7 @@ func (ns *NodeService) handleGetAuthMode(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, AuthModeResponse{Mode: modeStr})
|
||||
}
|
||||
|
||||
// SetAuthModeRequest is the request for setting auth mode.
|
||||
// PUT /peers/auth/mode {"mode": "allowlist"} // or "open"
|
||||
type SetAuthModeRequest struct {
|
||||
Mode string `json:"mode" binding:"required"`
|
||||
}
|
||||
|
|
@ -508,7 +508,7 @@ func (ns *NodeService) handleSetAuthMode(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, AuthModeResponse{Mode: req.Mode})
|
||||
}
|
||||
|
||||
// AllowlistResponse is the response for listing allowlisted keys.
|
||||
// GET /peers/auth/allowlist → {"publicKeys": ["ed25519:abc...", "ed25519:def..."]}
|
||||
type AllowlistResponse struct {
|
||||
PublicKeys []string `json:"publicKeys"`
|
||||
}
|
||||
|
|
@ -525,7 +525,7 @@ func (ns *NodeService) handleListAllowlist(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, AllowlistResponse{PublicKeys: keys})
|
||||
}
|
||||
|
||||
// AddAllowlistRequest is the request for adding a key to the allowlist.
|
||||
// POST /peers/auth/allowlist {"publicKey": "ed25519:abc123..."}
|
||||
type AddAllowlistRequest struct {
|
||||
PublicKey string `json:"publicKey" binding:"required"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue