Rename http package to server

This commit is contained in:
2022-02-19 21:28:04 +00:00
parent 72b5bdde4f
commit daadfd45bc
13 changed files with 26 additions and 25 deletions

26
server/dashboard.go Normal file
View File

@ -0,0 +1,26 @@
package server
import (
"net/http"
"git.javil.eu/jacob1123/budgeteer"
"git.javil.eu/jacob1123/budgeteer/postgres"
"github.com/gin-gonic/gin"
)
func (h *Handler) dashboard(c *gin.Context) {
userID := c.MustGet("token").(budgeteer.Token).GetID()
budgets, err := h.Service.GetBudgetsForUser(c.Request.Context(), userID)
if err != nil {
return
}
d := DashboardData{
Budgets: budgets,
}
c.JSON(http.StatusOK, d)
}
type DashboardData struct {
Budgets []postgres.Budget
}