Store_UI/admin/distz/api/models/subscription.js
2022-09-26 11:48:12 +05:30

39 lines
1.0 KiB
JavaScript

'use strict';
const {
Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
class subscription 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
models.subscription.belongsTo(models.store);
models.subscription.hasOne(models.users);
models.subscription.belongsTo(models.plan);
}
}
subscription.init({
userId: DataTypes.INTEGER,
storeId: DataTypes.INTEGER,
billNumber: DataTypes.STRING,
planId: DataTypes.INTEGER,
amount: DataTypes.STRING,
validity: DataTypes.STRING,
paymentType: DataTypes.INTEGER,
startDate: DataTypes.DATE,
endDate: DataTypes.DATE,
status: DataTypes.INTEGER,
createdBy: DataTypes.INTEGER,
updatedBy: DataTypes.INTEGER
}, {
sequelize,
modelName: 'subscription',
});
return subscription;
};