feat: expand companion platform, device controls, and memoir workflows
ci / verify (push) Canceled after 0s

Add customer and operator login, BLE provisioning, device fleet controls, call memory, memoir generation, and refreshed family and maintenance portals. Include API contracts, migrations, firmware sources, tests, assets, and deployment documentation.
This commit is contained in:
Codex Local
2026-10-08 10:06:44 +08:00
parent 98fb2965d0
commit bf1233d5df
861 changed files with 94614 additions and 3209 deletions
+41
View File
@@ -0,0 +1,41 @@
package httpapi
import (
"context"
"data-terminal-cloud/internal/identity"
"errors"
"net/http"
)
type profileUpdater interface {
UpdateDisplayName(context.Context, identity.Principal, string) error
}
func UpdateCustomerProfileHandler(repository profileUpdater) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
principal, ok := webPrincipal(w, r)
if !ok {
return
}
var input struct {
DisplayName string `json:"display_name"`
}
if !decodeWebJSON(w, r, &input, "请填写有效昵称") {
return
}
name, err := identity.ValidateDisplayName(input.DisplayName)
if err != nil {
writeValidation(w, r, "昵称须为1–80个字符,不能包含控制字符", FieldError{Field: "display_name", Message: "请填写有效昵称"})
return
}
if err = repository.UpdateDisplayName(r.Context(), principal, name); errors.Is(err, identity.ErrAccountNotFound) || errors.Is(err, identity.ErrAccessDenied) {
WriteError(w, r, http.StatusForbidden, "RESOURCE_ACCESS_DENIED", "当前账号不可修改")
return
} else if err != nil {
WriteError(w, r, http.StatusInternalServerError, "INTERNAL_ERROR", "保存失败,请重试")
return
}
w.Header().Set("Cache-Control", "no-store")
WriteJSON(w, r, http.StatusOK, map[string]string{"display_name": name})
})
}