added backend and 2 endpoints fetch
This commit is contained in:
1 parent
7c6db3dfbd
commit
ca99cfcf6d
56 files changed
+344
-29
No files matched your search
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user