Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports.createUser = (application, req, res) => {
- let dadosForm = req.body;
- const {User} = require('../models/Schemas/userSchema');
- const userModel = new application.app.models.userModel(User);
- req.assert('email', 'Digite um e-mail válido.').isEmail();
- let errors = req.validationErrors();
- if(errors) return res.status(402).send(errors);
- userModel.createUser(res, dadosForm);
- }
- module.exports.createUserInfos = (application, req, res) => {
- let dadosForm = req.body;
- let userId = req.params.userId;
- const {User} = require('../models/Schemas/userSchema');
- const userModel = new application.app.models.userModel(User);
- userModel.createUserInfos(res, userId, dadosForm);
- }
- module.exports.getUserInfos = (application, req, res) => {
- let userId = req.params.userId;
- const {User} = require('../models/Schemas/userSchema');
- const userModel = new application.app.models.userModel(User);
- userModel.getUserInfos(res, userId);
- }
- module.exports.authUser = (application, req, res) => {
- let dadosForm = req.body;
- const {User} = require('../models/Schemas/userSchema');
- const userModel = new application.app.models.userModel(User);
- console.log(res)
- console.log(req)
- req.assert('email', 'Digite um e-mail válido.').isEmail();
- let errors = req.validationErrors();
- if(errors) {
- res.status(402).send(errors);
- return;
- }
- userModel.authUser(res, dadosForm);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement