placeBet: always run 1 instance

This commit is contained in:
mantikoros 2021-12-10 21:45:05 -06:00
parent 8867d841cb
commit 62ea1bab15

View File

@ -5,11 +5,13 @@ import { Contract } from './types/contract'
import { User } from './types/user'
import { Bet } from './types/bet'
export const placeBet = functions.https.onCall(async (data: {
export const placeBet = functions
.runWith({ minInstances: 1 })
.https.onCall(async (data: {
amount: number
outcome: string
contractId: string
}, context) => {
}, context) => {
const userId = context?.auth?.uid
if (!userId)
return { status: 'error', message: 'Not authorized' }
@ -44,7 +46,7 @@ export const placeBet = functions.https.onCall(async (data: {
return { status: 'success' }
})
})
})
const firestore = admin.firestore()