File size: 1,046 Bytes
e14bacb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
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);
|