full
This commit is contained in:
50
models/WalletWithdrawalRequestModel.js
Normal file
50
models/WalletWithdrawalRequestModel.js
Normal file
@@ -0,0 +1,50 @@
|
||||
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
|
||||
Reference in New Issue
Block a user