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:
@@ -0,0 +1,40 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.10.1
|
||||
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"img_infinite_canvas/internal/svc"
|
||||
"img_infinite_canvas/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeleteBrandKitLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeleteBrandKitLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteBrandKitLogic {
|
||||
return &DeleteBrandKitLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeleteBrandKitLogic) DeleteBrandKit(req *types.BrandKitIdRequest) (resp *types.DeleteBrandKitResponse, err error) {
|
||||
if _, err := l.svcCtx.BrandKitService.Get(l.ctx, req.Id); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := l.svcCtx.DesignService.ClearBrandKitBindings(l.ctx, req.Id); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := l.svcCtx.BrandKitService.Delete(l.ctx, req.Id); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &types.DeleteBrandKitResponse{Id: req.Id, Deleted: true}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user