// Code scaffolded by goctl. Safe to edit. // goctl 1.10.1 package persona import ( "context" contentops "haixun-backend/internal/model/content_ops/domain/usecase" "haixun-backend/internal/svc" "haixun-backend/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type UpdateContentPlanLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewUpdateContentPlanLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateContentPlanLogic { return &UpdateContentPlanLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *UpdateContentPlanLogic) UpdateContentPlan(req *types.UpdateContentPlanHandlerReq) (resp *types.ContentPlanData, err error) { tenantID, uid, err := actorFrom(l.ctx) if err != nil { return nil, err } item, err := l.svcCtx.ContentOps.UpdateContentPlan(l.ctx, tenantID, uid, req.ID, req.ContentPlanID, contentops.ContentPlanPatch{Topic: req.Topic, Mission: req.Mission, TargetAudience: req.TargetAudience, Angle: req.Angle, OpeningType: req.OpeningType, BodyType: req.BodyType, Emotion: req.Emotion, EndingType: req.EndingType, CtaType: req.CtaType, RiskLevel: req.RiskLevel, RequiresHumanReview: req.RequiresHumanReview, Avoid: req.Avoid, SelectedKnowledge: req.SelectedKnowledge, Status: req.Status}) if err != nil { return nil, err } data := toContentPlanData(*item) return &data, nil }