refactor: ahora los repos se acceden con un singleton en vez de inyecion

de dependencias
This commit is contained in:
fede committed 2026-06-14 02:58:56 -03:00
1 parent 52fc779abd
commit 141715ee0a
22 files changed
+244 -211

No files matched your search

@@ -0,0 +1,33 @@
package usuarios
import (
"net/http"
r "repuestera_back/repositorios"
"strconv"
"github.com/gin-gonic/gin"
)
func ObtenerUsuarios(c *gin.Context) {
pagina, err1 := strconv.ParseInt(c.Query("p"), 10, 32)
tamaño, err2 := strconv.ParseInt(c.Query("s"), 10, 32)
if err1 != nil {
pagina = 0
}
if err2 != nil {
tamaño = 10
}
usuarios, total, err := r.ObtenerRepositorios().Usuario.ObtenerTodosPaginado(int(pagina), int(tamaño))
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
c.JSON(http.StatusOK, gin.H{
"usuarios": usuarios,
"total": total,
})
}