passwordhandler.go 582 B

12345678910111213141516171819202122232425262728
  1. package handler
  2. import (
  3. "net/http"
  4. "dag-jupyter/internal/logic"
  5. "dag-jupyter/internal/svc"
  6. "dag-jupyter/internal/types"
  7. "github.com/zeromicro/go-zero/rest/httpx"
  8. )
  9. func PasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  10. return func(w http.ResponseWriter, r *http.Request) {
  11. var req types.PasswordRequest
  12. if err := httpx.Parse(r, &req); err != nil {
  13. httpx.Error(w, err)
  14. return
  15. }
  16. l := logic.NewPasswordLogic(r.Context(), svcCtx)
  17. resp, err := l.Password(&req)
  18. if err != nil {
  19. httpx.Error(w, err)
  20. } else {
  21. httpx.OkJson(w, resp)
  22. }
  23. }
  24. }