homepage.js/models/user.js

62 lines
1.1 KiB
JavaScript
Raw Normal View History

const { Model, DataTypes } = require('sequelize');
2023-02-22 14:54:35 +01:00
class User extends Model {
}
const structure = {
id: {
type: DataTypes.BIGINT,
primaryKey: true,
autoIncrement: true,
allowNull: false
},
login: {
type: DataTypes.TEXT,
allowNull: false
},
pass: {
type: DataTypes.TEXT,
allowNull: false
},
totp: {
type: DataTypes.TEXT,
allowNull: true
},
totpRec: {
type: DataTypes.TEXT,
allowNull: true
},
email: {
type: DataTypes.TEXT,
allowNull: false
},
gpgkey: {
type: DataTypes.TEXT,
allowNull: false
2023-02-23 07:51:19 +01:00
},
accessLevel: {
type: DataTypes.SMALLINT,
allowNull: false,
defaultValue: 0
}
}
User.structure = structure
2023-02-22 14:54:35 +01:00
/**
* @param {import('sequelize').Sequelize} sequelize
* @param {import('sequelize').DataTypes} DataTypes
* @returns User
2023-02-22 14:54:35 +01:00
*/
const init = (sequelize, DataTypes) => {
let user = User.init(structure, {
2023-02-22 14:54:35 +01:00
sequelize,
tableName: 'users',
tableName: 'users'
});
return user;
}
init.class = User;
module.exports = init;