Skip to content

Commit

Permalink
G4L-230 Encontrar usuario por ID
Browse files Browse the repository at this point in the history
  • Loading branch information
logos914 committed Nov 20, 2024
1 parent 01b3c2a commit 5cbdb81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions models/usuario.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def agregar(nombre, contrasena, rol):
@staticmethod
def buscar(nombre):
return Usuario.query.filter_by(nombre=nombre).first()

def buscarPorId(id):
return Usuario.query.get(id)


def is_active(self):
Expand Down
2 changes: 1 addition & 1 deletion routes/asig_operador_vehiculo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@asig_operador_vehiculo.route('/asignacion/<int:id_usuario>/vehiculos/<int:id_vehiculo>/', methods=['PUT'])
def asignar(id_vehiculo, id_usuario):
vehiculo = Vehiculo.encontrarPorId(id_vehiculo)
usuario = Usuario.encontrarPorId(id_usuario)
usuario = Usuario.buscarPorId(id_usuario)

bitacoraAsignaciones = BitacoraAsignaciones(
vehiculo=vehiculo,
Expand Down

0 comments on commit 5cbdb81

Please sign in to comment.