Added get APIs for Stored Procedures, Triggers and User Defined Functions

This commit is contained in:
Pijus Kamandulis
2024-02-10 21:05:08 +02:00
parent 0689119a64
commit a4181ef6bf
10 changed files with 173 additions and 1 deletions

22
api/handlers/triggers.go Normal file
View File

@@ -0,0 +1,22 @@
package handlers
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/pikami/cosmium/internal/repositories"
)
func GetAllTriggers(c *gin.Context) {
databaseId := c.Param("databaseId")
collectionId := c.Param("collId")
triggers, status := repositories.GetAllTriggers(databaseId, collectionId)
if status == repositories.StatusOk {
c.IndentedJSON(http.StatusOK, gin.H{"_rid": "", "Triggers": triggers, "_count": len(triggers)})
return
}
c.IndentedJSON(http.StatusInternalServerError, gin.H{"message": "Unknown error"})
}