chore: seal Design Vision v1 and monorepo scaffold
Archive the differentiated YuXinGu product docs, AI engineering system, design contract, and Go/Vue scaffold. Next execution prioritizes Cece-parity over early innovation (see .ai/product/STRATEGY.md). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
//go:build ignore
|
||||
|
||||
// EXAMPLE — reference shape for AI. Not compiled into apps/api.
|
||||
package examples
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type apiBody struct {
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
type DecodeInput struct {
|
||||
Year int
|
||||
Month int
|
||||
Day int
|
||||
}
|
||||
|
||||
type DecodeOutput struct {
|
||||
Summary string `json:"summary"`
|
||||
}
|
||||
|
||||
type DecodeService interface {
|
||||
Decode(ctx context.Context, in DecodeInput) (*DecodeOutput, error)
|
||||
}
|
||||
|
||||
type DecodeHandler struct {
|
||||
Svc DecodeService
|
||||
}
|
||||
|
||||
// Decode handles POST /api/v1/reports/decode
|
||||
func (h *DecodeHandler) Decode(c *gin.Context) {
|
||||
var req struct {
|
||||
Year int `json:"year" binding:"required"`
|
||||
Month int `json:"month" binding:"required"`
|
||||
Day int `json:"day" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, apiBody{Code: 10000, Message: "invalid request"})
|
||||
return
|
||||
}
|
||||
out, err := h.Svc.Decode(c.Request.Context(), DecodeInput(req))
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, apiBody{Code: 30001, Message: err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, apiBody{Code: 0, Message: "success", Data: out})
|
||||
}
|
||||
Reference in New Issue
Block a user