synt_backend
Version:
Synt light-weight node backend service
30 lines (29 loc) • 803 B
JavaScript
const { Model } = require("sequelize");
module.exports = (sequelize, DataTypes) => {
class PurchaseEntry 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
PurchaseEntry.belongsTo(models.Purchase);
PurchaseEntry.belongsTo(models.GeneralLedgerAccount);
PurchaseEntry.hasMany(models.PurchaseAllocation);
}
}
PurchaseEntry.init(
{
amount: DataTypes.DECIMAL,
vat_percentage: DataTypes.INTEGER,
description: DataTypes.TEXT,
},
{
sequelize,
modelName: "PurchaseEntry",
}
);
return PurchaseEntry;
};
;