Make placeBet/sellShares immediately post denormalized info

This commit is contained in:
Marshall Polaris 2022-09-14 01:03:42 -07:00
parent 298bc04517
commit 35454df6b2
2 changed files with 11 additions and 1 deletions

View File

@ -139,7 +139,14 @@ export const placebet = newEndpoint({}, async (req, auth) => {
} }
const betDoc = contractDoc.collection('bets').doc() const betDoc = contractDoc.collection('bets').doc()
trans.create(betDoc, { id: betDoc.id, userId: user.id, ...newBet }) trans.create(betDoc, {
id: betDoc.id,
userId: user.id,
userAvatarUrl: user.avatarUrl,
userUsername: user.username,
userName: user.name,
...newBet,
})
log('Created new bet document.') log('Created new bet document.')
if (makers) { if (makers) {

View File

@ -112,6 +112,9 @@ export const sellshares = newEndpoint({}, async (req, auth) => {
transaction.create(newBetDoc, { transaction.create(newBetDoc, {
id: newBetDoc.id, id: newBetDoc.id,
userId: user.id, userId: user.id,
userAvatarUrl: user.avatarUrl,
userUsername: user.username,
userName: user.name,
...newBet, ...newBet,
}) })
transaction.update( transaction.update(