Skip to content

Commit

Permalink
backend upload
Browse files Browse the repository at this point in the history
  • Loading branch information
yaskisoba committed Dec 11, 2023
1 parent 69cebc7 commit d2a51f1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions backend/controllers/UserControllers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { Users } = require('../models/schemas');
const randomatic = require('randomatic');
const bcrypt = require('bcrypt');
const { createToken, validateToken } = require('./middlewares/Auth');

Expand Down Expand Up @@ -28,7 +29,9 @@ exports.userRegister = async (req, res) => {
};

exports.studentRegister = async(student) => {
const password = randomatic('Aa0', 15);
const hash = await bcrypt.hash(password, 15);

await Users.create({
superuser: false,
name: student['nome completo'],
Expand Down
2 changes: 1 addition & 1 deletion backend/models/schemas/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = (sequelize, DataTypes) => {
const Users = sequelize.define("Users", {
id: {
type: DataTypes.INTEGER,
field: "co_users",
field: "co_user",
primaryKey: true,
autoIncrement: true
},
Expand Down
1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"multer": "^1.4.5-lts.1",
"mysql2": "^3.6.3",
"nodemon": "^3.0.1",
"randomatic": "^3.1.1",
"sequelize": "^6.35.0",
"sequelize-cli": "^6.6.2"
}
Expand Down

0 comments on commit d2a51f1

Please sign in to comment.