Fix typing issues

This commit is contained in:
Austin Chen 2022-04-29 18:52:08 -04:00
parent dce39a79d9
commit 5bde99bc42
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
rules_version = '2'; rules_version = '2';
// To pick the right project: `firebase projects:list`, then `firebase use <project-name>`
// To deploy: `firebase deploy --only firestore:rules` // To deploy: `firebase deploy --only firestore:rules`
service cloud.firestore { service cloud.firestore {
match /databases/{database}/documents { match /databases/{database}/documents {

View File

@ -13,7 +13,7 @@ export const transact = functions
const { amount, fromType, fromId, toId, toType, description } = data const { amount, fromType, fromId, toId, toType, description } = data
if (fromType !== 'user') if (fromType !== 'USER')
return { return {
status: 'error', status: 'error',
message: "From type is only implemented for type 'user'.", message: "From type is only implemented for type 'user'.",
@ -44,7 +44,7 @@ export const transact = functions
} }
} }
if (toType === 'user') { if (toType === 'USER') {
const toDoc = firestore.doc(`users/${toId}`) const toDoc = firestore.doc(`users/${toId}`)
const toSnap = await transaction.get(toDoc) const toSnap = await transaction.get(toDoc)
if (!toSnap.exists) { if (!toSnap.exists) {
@ -66,6 +66,9 @@ export const transact = functions
toType, toType,
amount, amount,
// TODO: Unhardcode once we have non-donation txns
token: 'M$',
category: 'CHARITY',
description, description,
}) })