feat(server): add brand kit management and project binding

Add a brand kit domain with memory and postgres stores, a BrandKitService
for CRUD and resolution, and REST endpoints to list, upsert, and delete
brand kits. Projects can bind a brand kit whose resolved context and
reference images feed into the agent's long-term memory and design prompts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-10 20:58:55 +08:00
parent 3653474355
commit 789f51b29e
38 changed files with 2165 additions and 135 deletions
+7
View File
@@ -5,6 +5,7 @@ import (
"errors"
"net/http"
"img_infinite_canvas/internal/domain/brandkit"
"img_infinite_canvas/internal/domain/design"
authmodule "img_infinite_canvas/internal/modules/auth"
sharingmodule "img_infinite_canvas/internal/modules/sharing"
@@ -34,6 +35,12 @@ func Handle(ctx context.Context, err error) (int, any) {
return http.StatusBadRequest, map[string]any{"error": err.Error(), "code": http.StatusBadRequest}
case errors.Is(err, design.ErrConflict):
return http.StatusConflict, map[string]any{"error": err.Error(), "code": http.StatusConflict}
case errors.Is(err, brandkit.ErrNotFound):
return http.StatusNotFound, map[string]any{"error": brandkit.ErrNotFound.Error(), "errorCode": "brand_kit.not_found", "code": http.StatusNotFound}
case errors.Is(err, brandkit.ErrInvalidInput):
return http.StatusBadRequest, map[string]any{"error": err.Error(), "errorCode": "brand_kit.invalid_input", "code": http.StatusBadRequest}
case errors.Is(err, brandkit.ErrConflict):
return http.StatusConflict, map[string]any{"error": err.Error(), "errorCode": "brand_kit.conflict", "code": http.StatusConflict}
case errors.Is(err, authmodule.ErrCodeInvalid):
return http.StatusUnauthorized, map[string]any{"error": err.Error(), "errorCode": "auth.code_invalid", "code": http.StatusUnauthorized}
case errors.Is(err, authmodule.ErrCodeExpired):