Created the User model

This commit is contained in:
2022-12-27 15:03:16 +01:00
parent 9475328e2f
commit c79936a8b3

27
server/models/User.js Normal file
View File

@ -0,0 +1,27 @@
const Sequelize = require('sequelize');
const db = require("../config/database");
const uuid = require('uuid');
module.exports = db.define("users", {
id: {
type: Sequelize.STRING,
primaryKey: true,
defaultValue: () => uuid.v4().replace(/-/g, '').slice(0, 16)
},
username: {
type: Sequelize.STRING,
allowNull: false
},
email: {
type: Sequelize.STRING,
allowNull: false
},
password: {
type: Sequelize.STRING,
allowNull: false
},
rank: {
type: Sequelize.STRING,
defaultValue: "user"
}
});