Skip to content

Commit

Permalink
history add users
Browse files Browse the repository at this point in the history
  • Loading branch information
talafarael committed May 18, 2024
1 parent 1192294 commit d961bbf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
17 changes: 15 additions & 2 deletions src/Router/authAuction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class authAuction {
})
const historyBid=new HistoryBid({
ListUser: [],
idAUction:auction.id
idAuction:auction.id
})
historyBid.save()
user.ownAuction.push(auction._id)
Expand Down Expand Up @@ -324,8 +324,21 @@ class authAuction {
`,
})
}

auction.save()
console.log(idAuction)
const historyBid =await HistoryBid.findOne({
idAuction:idAuction,
})
const historyUser={
id:id,
user:user.name,
sum:sum,
time:new Date()
}
console.log(historyBid)
historyBid.ListUser.push(historyUser)
historyBid.save()
if (sum != 0) {
console.log("aaaa")
let indexBidUser = user.bidAuction.findIndex(
Expand Down
1 change: 1 addition & 0 deletions src/authRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const Multer = require("multer");
const verifyToken = require("./middleware/verify")
const Auction = require("./model/Auction")
const verifyTimerToken=require('./middleware/timeUser')

// const projectId = "commanding-ring-409619" // Get this from Google Cloud
// const keyFilename = "mykey.json"
// const multer = require('multer')
Expand Down
4 changes: 2 additions & 2 deletions src/model/HistoryBid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const {model, Schema} = require("mongoose")
const HistoryBid = new Schema({
ListUser: [{
id: { type: String, required: true },
number:{type: Number, required: true },
sum:{type: Number, required: true },
time:{type: String,},
user:{type:String}
}],
idAUction:{type:String}
idAuction:{type:String}
})

module.exports = model("HistoryBid", HistoryBid)

0 comments on commit d961bbf

Please sign in to comment.