Use uuid.UUID everywhere and have postgres generate ids
This commit is contained in:
@ -14,6 +14,7 @@ import (
|
||||
"git.javil.eu/jacob1123/budgeteer/web"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Handler handles incoming requests
|
||||
@ -72,7 +73,13 @@ func (h *Handler) budget(c *gin.Context) {
|
||||
}
|
||||
|
||||
budgetID := c.Param("budgetid")
|
||||
budget, err := h.Service.DB.GetBudget(context.Background(), budgetID)
|
||||
budgetUUID, err := uuid.Parse(budgetID)
|
||||
if err != nil {
|
||||
c.Redirect(http.StatusTemporaryRedirect, "/login")
|
||||
return
|
||||
}
|
||||
|
||||
budget, err := h.Service.DB.GetBudget(context.Background(), budgetUUID)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusUnauthorized, err)
|
||||
return
|
||||
|
Reference in New Issue
Block a user