placeBet: always run 1 instance
This commit is contained in:
parent
8867d841cb
commit
62ea1bab15
|
@ -5,11 +5,13 @@ import { Contract } from './types/contract'
|
||||||
import { User } from './types/user'
|
import { User } from './types/user'
|
||||||
import { Bet } from './types/bet'
|
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
|
amount: number
|
||||||
outcome: string
|
outcome: string
|
||||||
contractId: string
|
contractId: string
|
||||||
}, context) => {
|
}, context) => {
|
||||||
const userId = context?.auth?.uid
|
const userId = context?.auth?.uid
|
||||||
if (!userId)
|
if (!userId)
|
||||||
return { status: 'error', message: 'Not authorized' }
|
return { status: 'error', message: 'Not authorized' }
|
||||||
|
@ -44,7 +46,7 @@ export const placeBet = functions.https.onCall(async (data: {
|
||||||
|
|
||||||
return { status: 'success' }
|
return { status: 'success' }
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user