stopoplogic.go 760 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package logic
  2. import (
  3. "context"
  4. "net/http"
  5. "dag-jupyter/internal/api"
  6. "dag-jupyter/internal/svc"
  7. "dag-jupyter/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type StopOpLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewStopOpLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StopOpLogic {
  16. return &StopOpLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *StopOpLogic) StopOp(req *types.DeleteJupyterInfo) (resp *types.Response, err error) {
  23. err = api.Uninstall(req)
  24. if err != nil {
  25. return &types.Response{
  26. Data: err.Error(),
  27. Code: http.StatusBadRequest,
  28. }, nil
  29. }
  30. return &types.Response{
  31. Data: "success",
  32. Code: http.StatusOK,
  33. }, nil
  34. }