|
|
const mongoose = require('mongoose'); |
|
|
|
|
|
const allTransactionSchema = new mongoose.Schema({ |
|
|
user_id: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true }, |
|
|
|
|
|
|
|
|
type: { |
|
|
type: String, |
|
|
enum: [ |
|
|
'DEPOSIT', |
|
|
'WITHDRAWAL', |
|
|
'ASSET_PURCHASE', |
|
|
'POINT_REDEMPTION', |
|
|
'LIQUIDATION', |
|
|
'REFERRAL_BONUS', |
|
|
'STRIKE_WIN', |
|
|
'REFUND', |
|
|
'ADMIN_ADJUSTMENT' |
|
|
], |
|
|
required: true |
|
|
}, |
|
|
|
|
|
amount: { type: Number, required: true }, |
|
|
currency: { type: String, enum: ['INR', 'POINTS'], required: true }, |
|
|
description: { type: String }, |
|
|
|
|
|
timestamp: { type: Date, default: Date.now } |
|
|
}); |
|
|
|
|
|
module.exports = mongoose.model('AllTransaction', allTransactionSchema); |
|
|
|