Do less work in onCreateAnswer
This commit is contained in:
parent
d7d621fc99
commit
d6c0af1f5f
|
@ -10,14 +10,14 @@ export const onCreateAnswer = functions.firestore
|
|||
contractId: string
|
||||
}
|
||||
const { eventId } = context
|
||||
const contract = await getContract(contractId)
|
||||
if (!contract)
|
||||
throw new Error('Could not find contract corresponding with answer')
|
||||
|
||||
const answer = change.data() as Answer
|
||||
// Ignore ante answer.
|
||||
if (answer.number === 0) return
|
||||
|
||||
const contract = await getContract(contractId)
|
||||
if (!contract)
|
||||
throw new Error('Could not find contract corresponding with answer')
|
||||
|
||||
const answerCreator = await getUser(answer.userId)
|
||||
if (!answerCreator) throw new Error('Could not find answer creator')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user