Continue migration to echo
This commit is contained in:
@ -31,28 +31,25 @@ func (h *Handler) budgetingForMonth(c echo.Context) error {
|
||||
budgetID := c.Param("budgetid")
|
||||
budgetUUID, err := uuid.Parse(budgetID)
|
||||
if err != nil {
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, ErrorResponse{"budgetid missing from URL"})
|
||||
return
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "budgetid missing from URL")
|
||||
}
|
||||
|
||||
budget, err := h.Service.GetBudget(c.Request().Context(), budgetUUID)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, err)
|
||||
return
|
||||
}
|
||||
|
||||
month, err := getDate(c)
|
||||
if err != nil {
|
||||
c.Redirect(http.StatusTemporaryRedirect, "/budget/"+budget.ID.String())
|
||||
return
|
||||
}
|
||||
|
||||
data, err := h.getBudgetingViewForMonth(c.Request().Context(), budget, month)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, err)
|
||||
return
|
||||
return err
|
||||
}
|
||||
c.JSON(http.StatusOK, data)
|
||||
|
||||
return c.JSON(http.StatusOK, data)
|
||||
}
|
||||
|
||||
func (h *Handler) getBudgetingViewForMonth(ctx context.Context, budget postgres.Budget, month Month) (BudgetingForMonthResponse, error) {
|
||||
|
Reference in New Issue
Block a user