Private
Public Access
feat: implementado un patron de repository
This commit is contained in:
1 parent
03df1c5264
commit
785bc7db6b
18 files changed
+505
-160
No files matched your search
@@ -5,10 +5,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"repuestera_back/config"
|
||||
"repuestera_back/dto"
|
||||
"repuestera_back/jwtutils"
|
||||
models_seguridad "repuestera_back/models/seguridad"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
@@ -52,8 +50,8 @@ func Me(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
userID, _ := strconv.ParseUint(sub, 10, 32)
|
||||
var user models_seguridad.Usuario
|
||||
if err := config.DB.First(&user, userID).Error; err != nil {
|
||||
user, err := usuarioRepo.ObtenerPorID(uint(userID))
|
||||
if err != nil {
|
||||
c.JSON(http.StatusNotFound, gin.H{"error": "user not found"})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user