diff --git a/modules/auth/auth.controller.js b/modules/auth/auth.controller.js index 8e70f84..baa1735 100644 --- a/modules/auth/auth.controller.js +++ b/modules/auth/auth.controller.js @@ -98,11 +98,11 @@ async function register(req, res, next) { const values = { phone: req.body.phone, - fbuid: req.body.fbuid + fbuid: req.body.fbuid }; //Comprobamos si el usuario ya existe en nuestro sistema - let newUser = await authService.extraMethods.findUser(values); + let newUser = await authService.extraMethods.findUserByPhone(values.phone); console.log('COMPROBAMOS IS EXISTE EN NUESTRO SISTEMA', newUser); if (!newUser) { try { diff --git a/modules/auth/auth.service.js b/modules/auth/auth.service.js index bc147e0..963b04a 100644 --- a/modules/auth/auth.service.js +++ b/modules/auth/auth.service.js @@ -10,6 +10,12 @@ const extraMethods = { }); }, + findUserByPhone: async (Phone) => { + return await models.User.findOne({ + where: {phone: Phone}, + }); + }, + createUser: async (params, context) => { // return models.sequelize.transaction(async transaction => { //const result = await models.User.create(params, { transaction });