const mongoose = require('mongoose'); const allTransactionSchema = new mongoose.Schema({ user_id: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true }, // The specific type of action type: { type: String, enum: [ 'DEPOSIT', // Cash Added 'WITHDRAWAL', // Cash Removed 'ASSET_PURCHASE', // Bought with Cash 'POINT_REDEMPTION', // Bought with Points 'LIQUIDATION', // Sold for Points 'REFERRAL_BONUS', // Points earned 'STRIKE_WIN', // Won 8 PM game 'REFUND', // 8 PM game cancelled 'ADMIN_ADJUSTMENT' // Manual fix ], required: true }, amount: { type: Number, required: true }, // The value currency: { type: String, enum: ['INR', 'POINTS'], required: true }, // What was exchanged description: { type: String }, // e.g. "Silver Tier Purchase" or "UTR 12345" timestamp: { type: Date, default: Date.now } }); module.exports = mongoose.model('AllTransaction', allTransactionSchema);