added backend and 2 endpoints fetch

This commit is contained in:
wt committed 2025-07-30 00:01:45 +07:00
1 parent 7c6db3dfbd
commit ca99cfcf6d
56 files changed
+344 -29

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
package api
import (
"backend/internal/category"
"github.com/gofiber/fiber/v2"
)
func GetAllCategories(c *fiber.Ctx) error {
categories, err := category.GetAllCategories()
if err != nil {
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"error": err.Error(),
})
}
return c.JSON(categories)
}
+17
View File
@@ -0,0 +1,17 @@
package api
import (
"backend/internal/operation"
"github.com/gofiber/fiber/v2"
)
func GetAllOperation(c *fiber.Ctx) error {
operations, err := operation.GetAllOperation()
if err != nil {
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"error": err.Error(),
})
}
return c.JSON(operations)
}