API/api.medcify.app/models/subscription.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-09-26 06:11:44 +00:00
'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,
webhookResponse: DataTypes.TEXT,
razorpayOrderId: DataTypes.TEXT,
razorpayPaymentId: DataTypes.TEXT,
razorpaySignature: DataTypes.TEXT,
paymentStatus: DataTypes.TEXT,
activeStatus: DataTypes.STRING,
status: DataTypes.INTEGER,
createdBy: DataTypes.INTEGER,
updatedBy: DataTypes.INTEGER
}, {
sequelize,
modelName: 'subscription',
});
return subscription;
};