DB: Generalize table and model names

This commit is contained in:
2023-02-24 20:46:47 +01:00
parent 9661c65b27
commit 3b67c140af
3 changed files with 20 additions and 7 deletions

27
models/group.js Normal file
View File

@@ -0,0 +1,27 @@
'use strict';
const {
Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
class Group extends Model {
/**
* Helper method for defining associations.
* This method is not a part of Sequelize lifecycle.
* The `models/index` file will call this method automatically.
*/
static associate(models) {
// define association here
Group.hasMany(models.Character);
}
}
Group.init({
name: DataTypes.STRING,
description: DataTypes.TEXT,
imageURL: DataTypes.STRING,
enabled: DataTypes.BOOLEAN
}, {
sequelize,
modelName: 'Group',
});
return Group;
};