octabytes / FireO

Google Cloud Firestore modern and simplest convenient ORM package in Python. FireO is specifically designed for the Google's Firestore
https://fireo.octabyte.io
Apache License 2.0
250 stars 29 forks source link

Transaction isn't working with OOP style #92

Closed anisrfd closed 3 years ago

anisrfd commented 3 years ago

Error: "TypeError: insert_in_transaction() missing 1 required positional argument: 'user'."

The code snippet is given below:

''' from fireo.models import Model from fireo.fields import IDField, TextField, NumberField import fireo

  transaction = fireo.transaction()

  class UserTransac(Model):
      id = IDField()
      name = TextField()
      age = NumberField()

  class TransecTest:
      def __init__(self):
          self.model = UserTransac()

      @fireo.transactional
      def insert_in_transaction(self, transaction, user):
          self.model.from_dict(user).save(transaction=transaction)

  def main():
      user = {'name': "user.name", 'age': 88}
      TransecTest().insert_in_transaction(transaction, user)

  main()

"'

anisrfd commented 3 years ago

Thank you so much and now it's working.