|
|
const mongoose = require('mongoose'); |
|
|
|
|
|
const transactionSchema = new mongoose.Schema({ |
|
|
user_id: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }, |
|
|
utr: { type: String, unique: true }, |
|
|
amount: { type: Number, required: true }, |
|
|
tier: { type: String }, |
|
|
|
|
|
asset_id: { type: mongoose.Schema.Types.ObjectId, ref: 'Asset' }, |
|
|
|
|
|
|
|
|
status: { |
|
|
type: String, |
|
|
enum: ['Pending', 'Verified', 'Failed', 'Pending_Withdrawal', 'Withdrawn', 'Rejected_Withdrawal'], |
|
|
default: 'Pending' |
|
|
}, |
|
|
|
|
|
|
|
|
rejection_reason: { type: String, default: null }, |
|
|
|
|
|
timestamp: { type: Date, default: Date.now } |
|
|
}); |
|
|
|
|
|
module.exports = mongoose.model('Transaction', transactionSchema); |