added operations
This commit is contained in:
1 parent
59f5a2cbc6
commit
e16edd7744
6 files changed
+130
-11
No files matched your search
@@ -1,13 +1,17 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"backend/internal/operation"
|
||||
"backend/database"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
)
|
||||
|
||||
func GetAllOperation(c *fiber.Ctx) error {
|
||||
operations, err := operation.GetAllOperation()
|
||||
user := c.Locals("user").(*jwt.Token)
|
||||
claims := user.Claims.(jwt.MapClaims)
|
||||
userid := claims["id"].(string)
|
||||
operations, err := database.GetAllOperations(userid)
|
||||
if err != nil {
|
||||
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||
"error": err.Error(),
|
||||
|
||||
Reference in new issue
Block a user