Skip to content

Commit

Permalink
Merge pull request #25 from Saca-la-Bici/fix/0.1/ControllersSession
Browse files Browse the repository at this point in the history
fix: Cambiar importacion de modulo de usuario
  • Loading branch information
Zathiald authored Sep 24, 2024
2 parents 439940c + 645cdef commit 3d93403
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
28 changes: 12 additions & 16 deletions models/perfil/usuario.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,18 @@ const Usuario = mongoose.model("Usuario", usuarioSchema);


async function putUsuario(IDUsuario, Username, nombre, tipoSangre, numeroEmergencia){
try {
const usuario = await Usuario.findById(IDUsuario);
if (usuario) {
usuario.username = Username;
usuario.nombre = nombre
usuario.tipoSangre = tipoSangre;
usuario.numeroEmergencia = numeroEmergencia;

await usuario.save();
return usuario;
} else {
throw new Error('Usuario no encontrado');
}
} catch (error) {
throw error;
}
const usuario = await Usuario.findById(IDUsuario);
if (usuario) {
usuario.username = Username;
usuario.nombre = nombre
usuario.tipoSangre = tipoSangre;
usuario.numeroEmergencia = numeroEmergencia;

await usuario.save();
return usuario;
} else {
throw new Error('Usuario no encontrado');
}
}


Expand Down
4 changes: 3 additions & 1 deletion modules/session/controllers/getUserEmail.controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const Usuario = require('../../../models/perfil/usuario.model');
const {
Usuario
} = require('../../../models/perfil/usuario.model');

exports.getUserEmail = async (request, response) => {
const username = request.query.username;
Expand Down
4 changes: 3 additions & 1 deletion modules/session/controllers/getUsername.controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const Usuario = require('../../../models/perfil/usuario.model');
const {
Usuario
} = require('../../../models/perfil/usuario.model');

exports.getUsername = async (request, response) => {
try {
Expand Down
4 changes: 3 additions & 1 deletion modules/session/controllers/perfilCompleto.controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const Usuario = require('../../../models/perfil/usuario.model');
const {
Usuario
} = require('../../../models/perfil/usuario.model');

exports.perfilCompleto = async (request, response) => {

Expand Down
4 changes: 3 additions & 1 deletion modules/session/controllers/registrarUsuario.controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const Usuario = require("../../../models/perfil/usuario.model");
const {
Usuario
} = require('../../../models/perfil/usuario.model');
const Rol = require("../../../models/perfil/rol.model");
const PoseeRol = require("../../../models/perfil/poseeRol.model"); // Modelo para la relación entre usuario y rol

Expand Down

0 comments on commit 3d93403

Please sign in to comment.