smc_cet_financials_backend/app/models/Sectionsmaster.js

39 lines
1.1 KiB
JavaScript

'use strict'
const { Model } = require('sequelize')
module.exports = (sequelize, DataTypes) => {
class Sectionsmaster 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.
*/
// define association here
static associate({ Statementsmaster }) {
this.belongsTo(Statementsmaster, { foreignKey: 'id', as: 'statementsmasterData' })
}
static associate({ Subsectionsmaster }) {
this.hasMany(Subsectionsmaster, { foreignKey: 'section', as: 'subsectionsmasterData' })
}
}
Sectionsmaster.init(
{
statement: { type: DataTypes.INTEGER },
section: { type: DataTypes.STRING },
is_active: { type: DataTypes.INTEGER },
createdby: { type: DataTypes.INTEGER },
updatedby: { type: DataTypes.INTEGER },
},
{
sequelize,
tableName: 'sectionsmaster',
modelName: 'Sectionsmaster',
createdAt: 'createdon',
updatedAt: 'updatedon',
}
)
return Sectionsmaster
}