Private
Public Access
35 lines
737 B
Go
35 lines
737 B
Go
package logs
|
|
|
|
import (
|
|
"net/http"
|
|
dto_directors "repuestera_back/dto/Builders/Directors"
|
|
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(c).Logs.ObtenerPorPaginas(uint(pag))
|
|
|
|
if err != nil {
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
|
return
|
|
}
|
|
|
|
respuesta, err := dto_directors.NewLogResponseDirector().Listar(logs)
|
|
if err != nil {
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, respuesta)
|
|
}
|