51 lines
1.2 KiB
JavaScript
51 lines
1.2 KiB
JavaScript
const mongoose = require('mongoose')
|
|
const mongoosePaginate = require('mongoose-paginate-v2')
|
|
const timestamp = require('mongoose-timestamp')
|
|
|
|
const walletWithdrawalRequestSchema = new mongoose.Schema({
|
|
user: {
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
ref: 'User',
|
|
required: true,
|
|
index: true
|
|
},
|
|
bucket: {
|
|
type: String,
|
|
enum: ['shop', 'gift', 'academy', 'project', 'booking'],
|
|
required: true
|
|
},
|
|
shop: {
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
ref: 'Shop',
|
|
default: null
|
|
},
|
|
amount: {
|
|
type: Number,
|
|
required: true
|
|
},
|
|
shabaSnapshot: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
status: {
|
|
type: String,
|
|
enum: ['در حال انجام', 'منتظر تایید', 'انجام شده'],
|
|
default: 'منتظر تایید',
|
|
index: true
|
|
},
|
|
requestedAt: {
|
|
type: Date,
|
|
default: Date.now
|
|
},
|
|
paidAt: {
|
|
type: Date,
|
|
default: null
|
|
}
|
|
})
|
|
|
|
walletWithdrawalRequestSchema.plugin(timestamp)
|
|
walletWithdrawalRequestSchema.plugin(mongoosePaginate)
|
|
|
|
const WalletWithdrawalRequestModel = mongoose.model('WalletWithdrawalRequest', walletWithdrawalRequestSchema)
|
|
module.exports = WalletWithdrawalRequestModel
|