This commit is contained in:
Mr Swift
2024-08-05 19:17:25 +03:30
parent 9d8ad87452
commit f846e37a74
2 changed files with 27 additions and 15 deletions
+4 -2
View File
@@ -66,7 +66,7 @@ module.exports.changeStatus = [
status: 1 status: 1
}, },
{ new: true }) { new: true })
const userPreData = await User.findById(data.userId) const userPreData = await User.findById(data.userId).select('walletBalance dollarBalance score')
const userData = await User.findByIdAndUpdate( const userData = await User.findByIdAndUpdate(
data.userId, data.userId,
{ {
@@ -74,7 +74,9 @@ module.exports.changeStatus = [
shopNumber: data.shopNumber, shopNumber: data.shopNumber,
shopAddress: data.shopAddress, shopAddress: data.shopAddress,
birthDate: data.birthDate, birthDate: data.birthDate,
walletBalance:userPreData?.walletBalance | 0 walletBalance: userPreData?.walletBalance | 0,
dollarBalance: userPreData?.dollarBalance | 0,
score: userPreData?.score | 0
}, },
{ new: true } { new: true }
) )
+10
View File
@@ -68,6 +68,16 @@ const UserSchema = mongoose.Schema({
min:0, min:0,
default:0 default:0
}, },
dollarBalance:{
type:Number,
min:0,
default:0
},
score:{
type:Number,
min:0,
default:0
},
cardBank:[BankSchema], cardBank:[BankSchema],