From e49cb9741d0ea435a31b7cdc8a61adcca77bc061 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 30 Aug 2019 17:11:11 +0200 Subject: [PATCH] a --- modules/auth/auth.controller.js | 4 ++-- modules/auth/auth.service.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) 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 });