package logic import ( "context" "net/http" "dag-jupyter/internal/api" "dag-jupyter/internal/svc" "dag-jupyter/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type UpgradeOpLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewUpgradeOpLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpgradeOpLogic { return &UpgradeOpLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *UpgradeOpLogic) UpgradeOp(req *types.CreateJupyterInfo) (resp *types.Response, err error) { req.Password = formatPassword(req.Password) err = api.Upgrade(req) data := map[string]interface{}{ "namespace": req.Namespace, "release_name": req.ReleaseName, "base_url": req.BaseUrl, "image": req.Image, "host": req.Host, "tag": req.Tag, "path": req.Path, "workspace": req.Workspace, } if err != nil { return &types.Response{ Data: err.Error(), Code: http.StatusBadRequest, }, nil } return &types.Response{ Data: data, Code: http.StatusOK, }, nil return }