diff --git a/doc/build/html/_modules/accounting/storage/sql/models.html b/doc/build/html/_modules/accounting/storage/sql/models.html new file mode 100644 index 0000000000000000000000000000000000000000..b07dced090b8cd52c8e00894ca220fe6d6476abf --- /dev/null +++ b/doc/build/html/_modules/accounting/storage/sql/models.html @@ -0,0 +1,151 @@ + + + + + + + + accounting.storage.sql.models — Accounting API 0.1-beta documentation + + + + + + + + + + + + + + +
+
+
+
+ +

Source code for accounting.storage.sql.models

+import json
+
+from . import db
+
+
+
[docs]class Transaction(db.Model): + id = db.Column(db.Integer(), primary_key=True) + uuid = db.Column(db.String, unique=True, nullable=False) + date = db.Column(db.DateTime) + payee = db.Column(db.String()) + meta = db.Column(db.String()) + +
[docs] def as_dict(self): + return dict( + id=self.uuid, + date=self.date, + payee=self.payee, + postings=[p.as_dict() for p in self.postings], + metadata=json.loads(self.meta) + ) + +
+
[docs]class Posting(db.Model): + id = db.Column(db.Integer(), primary_key=True) + + transaction_uuid = db.Column(db.String, db.ForeignKey('transaction.uuid')) + transaction = db.relationship('Transaction', backref='postings') + + account = db.Column(db.String, nullable=False) + + amount_id = db.Column(db.Integer, db.ForeignKey('amount.id')) + amount = db.relationship('Amount') + + meta = db.Column(db.String) + +
[docs] def as_dict(self): + return dict( + account=self.account, + amount=self.amount.as_dict(), + metadata=json.loads(self.meta) + ) + +
+
[docs]class Amount(db.Model): + id = db.Column(db.Integer, primary_key=True) + symbol = db.Column(db.String) + amount = db.Column(db.Numeric) + +
[docs] def as_dict(self): + return dict( + symbol=self.symbol, + amount=self.amount + )
+
+ +
+
+
+
+
+ + +
+
+
+
+ + + + \ No newline at end of file