Private
Public Access
funcionalidad de logs andando
This commit is contained in:
1 parent
06ed4a518b
commit
aac88856ac
21 files changed
+627
-31
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package logs
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
r "repuestera_back/repositorios"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func ObtenerLog(c *gin.Context) {
|
||||
pag, err := strconv.ParseUint(c.Param("p"), 10, 64)
|
||||
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
logs, err := r.ObtenerRepositorios().Logs.ObtenerPorPaginas(uint(pag))
|
||||
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, logs)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package logs
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
r "repuestera_back/repositorios"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func ObtenerLogs(c *gin.Context) {
|
||||
pag, err := strconv.ParseUint(c.Param("p"), 10, 64)
|
||||
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
repo := r.ObtenerRepositorios().Logs
|
||||
|
||||
logs, err := repo.ObtenerPorPaginas(uint(pag))
|
||||
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
cantpags, err := repo.CantPaginas()
|
||||
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"logs": logs,
|
||||
"maxlenght": cantpags,
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user