package projects import ( db "ttime/internal/database" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/log" "github.com/golang-jwt/jwt/v5" ) func RemoveProject(c *fiber.Ctx) error { user := c.Locals("user").(*jwt.Token) claims := user.Claims.(jwt.MapClaims) username := claims["name"].(string) // Check if the user is a site admin isAdmin, err := db.GetDb(c).IsSiteAdmin(username) if err != nil { log.Info("Error checking admin status:", err) return c.Status(500).SendString(err.Error()) } if !isAdmin { log.Info("User is not a site admin:", username) return c.Status(403).SendString("User is not a site admin") } projectName := c.Params("projectName") if err := db.GetDb(c).RemoveProject(projectName); err != nil { return c.Status(500).SendString((err.Error())) } return c.Status(200).SendString("Project deleted") }