kossnocorp / typesaurus

🦕 Type-safe TypeScript-first ODM for Firestore
https://typesaurus.com
415 stars 35 forks source link

Adds query to transaction and refactor transaction to reuse the get etc functions #102

Open SrBrahma opened 3 years ago

SrBrahma commented 3 years ago

Queries can be used in transactions if running on server, as I read and tried (haven't tried on client yet but working on server). #6 #95

Also, as you mentioned in the code, you rewrote the get etc functions inside the transaction.

https://github.com/kossnocorp/typesaurus/blob/e4c2fa3b73c94a661449de60ddeecf596969ef6b/src/transaction/index.ts#L308-L311

I have made a quick workaround so both get() and transaction's get() uses the same common function. Done the same for query(). It can also be done for the other transaction functions but won't do it until you think it's a good idea.

This branch is working but leaving as a Draft until further discussion and maybe improvements.