calendar.go 881 B

1234567891011121314151617181920212223242526272829303132333435
  1. package work
  2. import (
  3. "kpt-pasture/http/middleware"
  4. "net/http"
  5. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  6. "gitee.com/xuyiping_admin/pkg/apierr"
  7. "gitee.com/xuyiping_admin/pkg/ginutil"
  8. "gitee.com/xuyiping_admin/pkg/valid"
  9. "github.com/gin-gonic/gin"
  10. )
  11. func CalendarList(c *gin.Context) {
  12. var req pasturePb.WorkOrderCalendarRequest
  13. if err := ginutil.BindProto(c, &req); err != nil {
  14. apierr.AbortBadRequest(c, http.StatusBadRequest, err)
  15. return
  16. }
  17. if err := valid.ValidateStruct(&req,
  18. valid.Field(&req.ShowStartDay, valid.Required),
  19. valid.Field(&req.ShowEndDay, valid.Required),
  20. ); err != nil {
  21. apierr.AbortBadRequest(c, http.StatusBadRequest, err)
  22. return
  23. }
  24. res, err := middleware.Dependency(c).StoreEventHub.OpsService.CalendarList(c, &req)
  25. if err != nil {
  26. apierr.ClassifiedAbort(c, err)
  27. return
  28. }
  29. ginutil.JSONResp(c, res)
  30. }