Genesis commit
This commit is contained in:
28
persistence/models/user.js
Normal file
28
persistence/models/user.js
Normal file
@@ -0,0 +1,28 @@
|
||||
module.exports = function (sequelize, DataTypes, options) {
|
||||
const model = sequelize.define("user", {
|
||||
id: {
|
||||
type: DataTypes.STRING,
|
||||
defaultValue: function() {
|
||||
return options.generateUniqueId()
|
||||
},
|
||||
primaryKey: true,
|
||||
unique: true
|
||||
},
|
||||
|
||||
displayName: {
|
||||
type: DataTypes.STRING,
|
||||
// allowNull: false
|
||||
}
|
||||
}, {
|
||||
comment: "The individual users of the system..."
|
||||
});
|
||||
|
||||
model.associate = (db) => {
|
||||
model.Sessions = model.hasMany(db.Session);
|
||||
model.ExtendedPublicKeys = model.hasMany(db.ExtendedPublicKey);
|
||||
model.Passwords = model.hasMany(db.Password);
|
||||
model.AuthenticationMethods = model.hasMany(db.AuthenticationMethod);
|
||||
}
|
||||
|
||||
return model;
|
||||
};
|
||||
Reference in New Issue
Block a user