create and get categories with database for user
Build and Test / build-and-test-backend (push) Successful in 31s
Build and Test / build-and-test-frontend (push) Successful in 34s

This commit is contained in:
wt committed 2025-08-09 17:32:18 +07:00
1 parent 2c06975a43
commit 90e5863adc
12 files changed
+189 -79

No files matched your search

+5 -1
View File
@@ -4,10 +4,14 @@ import (
"backend/database"
"github.com/gofiber/fiber/v2"
"github.com/golang-jwt/jwt/v5"
)
func GetAllCategories(c *fiber.Ctx) error {
categories, err := database.GetAllCategories()
user := c.Locals("user").(*jwt.Token)
claims := user.Claims.(jwt.MapClaims)
userid := claims["id"].(string)
categories, err := database.GetAllCategories(userid)
if err != nil {
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"error": err.Error(),