saksh-wallet
Version:
A Node.js library for managing user wallets, including functionalities for crediting, debiting, and converting currencies, as well as retrieving balances and transaction reports.
16 lines (12 loc) • 735 B
JavaScript
const mongoose = require('mongoose');
const walletUserSchema = new mongoose.Schema({
userId: { type: String, required: true, unique: true },
balances: { type: Map, of: Number, default: {} },
dailyLimit: { type: Number, default: 1000 }, // Example daily limit
dailyTotal: { type: Number, default: 0 },
lastTransactionDate: { type: Date, default: Date.now },
applyDailyLimit: { type: Boolean, default: false }, // New field to indicate if daily limit should be applied
budgetEnabled: { type: Boolean, default: false } // New field to indicate if budget is enabled
}, { versionKey: 'version' });
const WalletUser = mongoose.model('WalletUser', walletUserSchema);
module.exports = WalletUser;