From 0ebcd4abd7484066c9e10b90471370743cab629b Mon Sep 17 00:00:00 2001 From: David Date: Tue, 8 Feb 2022 18:35:10 +0100 Subject: [PATCH] =?UTF-8?q?Se=20a=C3=B1ade=20'profile'=20al=20usuario=20pa?= =?UTF-8?q?ra=20guardar=20si=20es=20estudiante,=20tutor,=20invitado=20o=20?= =?UTF-8?q?libre.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/auth/auth.controller.js | 1 + modules/auth/auth.validations.js | 1 + modules/auth/user.model.js | 3 +++ modules/auth/user.service.js | 2 ++ 4 files changed, 7 insertions(+) diff --git a/modules/auth/auth.controller.js b/modules/auth/auth.controller.js index 153aeb0..8c8fd71 100644 --- a/modules/auth/auth.controller.js +++ b/modules/auth/auth.controller.js @@ -134,6 +134,7 @@ console.log('COMPROBAMOS IS EXISTE EN NUESTRO SISTEMA', newUser); surname: req.body.surname, entityId: req.body.entityid, accessibility: req.body.accesssibility, + profile: req.body.profile, app_version: appVersion, lastlogin: moment().utc(), }; diff --git a/modules/auth/auth.validations.js b/modules/auth/auth.validations.js index e760e5e..a51d1c6 100644 --- a/modules/auth/auth.validations.js +++ b/modules/auth/auth.validations.js @@ -23,6 +23,7 @@ const RegisterInputType = Joi.object().keys({ surname: Joi.string(), entityid: Joi.string().allow(null), profile_picture: Joi.string().allow(null), + profile: Joi.string().allow(null), }); const LoginOutputType = Joi.object().keys({ diff --git a/modules/auth/user.model.js b/modules/auth/user.model.js index 0af072e..1970123 100644 --- a/modules/auth/user.model.js +++ b/modules/auth/user.model.js @@ -41,6 +41,9 @@ module.exports = function (sequelize, DataTypes) { type: DataTypes.BOOLEAN, defaultValue: true, }, + profile: { + type: DataTypes.STRING, + }, refresh_token: { type: DataTypes.STRING(512), }, diff --git a/modules/auth/user.service.js b/modules/auth/user.service.js index c47ac2c..07ef945 100644 --- a/modules/auth/user.service.js +++ b/modules/auth/user.service.js @@ -68,6 +68,7 @@ const extraMethods = { name: dataUser.name, surname: dataUser.surname, entityId: dataUser.entityId, + profile: dataUser.profile, // password: crypto.createHash('sha512').update(user.phone).digest('hex'), } }).then(([user, created]) => { @@ -98,6 +99,7 @@ const extraMethods = { name: dataUser.name, surname: dataUser.surname, entityId: dataUser.entityId, + profile: 'guest', // password: crypto.createHash('sha512').update(user.phone).digest('hex'), } }).then(([user, created]) => {