Skip to content
Gallery
API Documentation Admin Webapp
Share
Explore
MEDPULSE DATABASE [DRAFT]

EXPENSE MODEL

id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
allowNull: false,
},
category: {
type: DataTypes.ENUM,
values: ["visit", "contact"],
allowNull: false,
defaultValue: "visit",
validate: {
notNull: true,
isIn: [["visit", "contact"]],
},
},
datetime: {
type: DataTypes.DATE,
allowNull: false,
},
reportNo: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
},
billNo: {
type: DataTypes.STRING,
},
expenseType: {
type: DataTypes.STRING,
allowNull: false,
},
expenseAmount: {
type: DataTypes.INTEGER,
allowNull: false,
},
approvedAmount: {
type: DataTypes.INTEGER,
// allowNull: false,
},
expenseImage: {
type: DataTypes.TEXT("long"),
},
status: {
type: DataTypes.ENUM,
values: ["pending", "approved", "rejected"],
allowNull: false,
defaultValue: "pending",
validate: {
notNull: true,
isIn: [["pending", "approved", "rejected"]],
},
},
reason: {
type: DataTypes.STRING,
allowNull: true,
},
}

// Foreign Keys
ExpenseModel.belongsTo(ContactModal, {
foreignKey: { name: "contactId", allowNull: true },
as: "contact",
targetKey: "id",
});
ExpenseModel.belongsTo(VisitModal, {
foreignKey: { name: "visitId", allowNull: true },
as: "visit",
targetKey: "id",
});
ExpenseModel.belongsTo(AsignneModel, {
foreignKey: { name: "createdBy", allowNull: false },
as: "employee",
targetKey: "id",
});



Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.