2024-02-10 19:05:08 +00:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/pikami/cosmium/internal/repositories"
|
2024-02-12 19:38:03 +00:00
|
|
|
repositorymodels "github.com/pikami/cosmium/internal/repository_models"
|
2024-02-10 19:05:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func GetAllStoredProcedures(c *gin.Context) {
|
|
|
|
databaseId := c.Param("databaseId")
|
|
|
|
collectionId := c.Param("collId")
|
|
|
|
|
|
|
|
sps, status := repositories.GetAllStoredProcedures(databaseId, collectionId)
|
|
|
|
|
2024-02-12 19:38:03 +00:00
|
|
|
if status == repositorymodels.StatusOk {
|
2024-02-10 19:05:08 +00:00
|
|
|
c.IndentedJSON(http.StatusOK, gin.H{"_rid": "", "StoredProcedures": sps, "_count": len(sps)})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
c.IndentedJSON(http.StatusInternalServerError, gin.H{"message": "Unknown error"})
|
|
|
|
}
|