monopyly 1.5.0__py3-none-any.whl → 1.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- monopyly/CHANGELOG.md +23 -0
- monopyly/README.md +2 -2
- monopyly/__init__.py +22 -27
- monopyly/_version.py +14 -2
- monopyly/auth/actions.py +12 -0
- monopyly/auth/routes.py +31 -22
- monopyly/auth/tools.py +1 -2
- monopyly/banking/accounts.py +3 -3
- monopyly/banking/banks.py +1 -1
- monopyly/banking/routes.py +1 -1
- monopyly/banking/transactions.py +14 -5
- monopyly/common/forms/utils.py +1 -2
- monopyly/common/transactions.py +17 -7
- monopyly/core/actions.py +0 -7
- monopyly/core/routes.py +0 -6
- monopyly/credit/accounts.py +1 -1
- monopyly/credit/cards.py +7 -3
- monopyly/credit/forms.py +1 -1
- monopyly/credit/routes.py +46 -25
- monopyly/credit/statements.py +1 -1
- monopyly/credit/transactions/_transactions.py +18 -5
- monopyly/credit/transactions/activity/parser.py +14 -6
- monopyly/credit/transactions/activity/reconciliation.py +20 -1
- monopyly/database/__init__.py +1 -56
- monopyly/database/models.py +181 -273
- monopyly/static/css/style.css +191 -11
- monopyly/static/js/create-balance-chart.js +1 -1
- monopyly/templates/auth/change_password.html +21 -0
- monopyly/templates/auth/login.html +3 -1
- monopyly/templates/auth/register.html +17 -7
- monopyly/templates/core/profile.html +2 -2
- monopyly/templates/credit/statement_reconciliation/statement_reconciliation_inquiry.html +1 -1
- monopyly/templates/credit/transaction_submission_page.html +64 -71
- monopyly/templates/credit/transactions_table/condensed_row_content.html +0 -1
- monopyly/templates/layout.html +2 -2
- {monopyly-1.5.0.dist-info → monopyly-1.5.2.dist-info}/METADATA +12 -13
- {monopyly-1.5.0.dist-info → monopyly-1.5.2.dist-info}/RECORD +41 -45
- {monopyly-1.5.0.dist-info → monopyly-1.5.2.dist-info}/WHEEL +1 -1
- monopyly-1.5.2.dist-info/entry_points.txt +2 -0
- monopyly/cli/apps.py +0 -108
- monopyly/cli/launch.py +0 -135
- monopyly/config/__init__.py +0 -1
- monopyly/config/default_settings.py +0 -56
- monopyly/config/settings.py +0 -59
- monopyly-1.5.0.dist-info/entry_points.txt +0 -2
- {monopyly-1.5.0.dist-info → monopyly-1.5.2.dist-info}/licenses/COPYING +0 -0
- {monopyly-1.5.0.dist-info → monopyly-1.5.2.dist-info}/licenses/LICENSE +0 -0
monopyly/database/models.py
CHANGED
|
@@ -1,40 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
import datetime
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
from dry_foundation.database.models import AuthorizedAccessMixin, Model
|
|
2
5
|
from sqlalchemy import Column, Date, Float, ForeignKey, Integer, String, Table
|
|
3
6
|
from sqlalchemy.ext.hybrid import hybrid_property
|
|
4
|
-
from sqlalchemy.orm import mapped_column, relationship
|
|
7
|
+
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
5
8
|
|
|
6
9
|
|
|
7
10
|
class User(Model):
|
|
8
11
|
__tablename__ = "users"
|
|
9
12
|
# Columns
|
|
10
|
-
id = mapped_column(
|
|
11
|
-
username
|
|
12
|
-
password
|
|
13
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
14
|
+
username: Mapped[str]
|
|
15
|
+
password: Mapped[str]
|
|
13
16
|
# Relationships
|
|
14
|
-
banks = relationship(
|
|
15
|
-
|
|
16
|
-
back_populates="user",
|
|
17
|
-
cascade="all, delete",
|
|
18
|
-
)
|
|
19
|
-
bank_account_types = relationship(
|
|
20
|
-
"BankAccountTypeView",
|
|
21
|
-
viewonly=True,
|
|
22
|
-
back_populates="user",
|
|
17
|
+
banks: Mapped["Bank"] = relationship(back_populates="user", cascade="all, delete")
|
|
18
|
+
bank_account_types: Mapped["BankAccountTypeView"] = relationship(
|
|
19
|
+
back_populates="user", viewonly=True
|
|
23
20
|
)
|
|
24
21
|
|
|
25
22
|
|
|
26
23
|
class InternalTransaction(Model):
|
|
27
24
|
__tablename__ = "internal_transactions"
|
|
28
25
|
# Columns
|
|
29
|
-
id = mapped_column(
|
|
26
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
30
27
|
# Relationships
|
|
31
|
-
bank_transactions = relationship(
|
|
32
|
-
"
|
|
33
|
-
back_populates="internal_transaction",
|
|
28
|
+
bank_transactions: Mapped[List["BankTransactionView"]] = relationship(
|
|
29
|
+
back_populates="internal_transaction"
|
|
34
30
|
)
|
|
35
|
-
credit_transactions = relationship(
|
|
36
|
-
"
|
|
37
|
-
back_populates="internal_transaction",
|
|
31
|
+
credit_transactions: Mapped[List["CreditTransactionView"]] = relationship(
|
|
32
|
+
back_populates="internal_transaction"
|
|
38
33
|
)
|
|
39
34
|
|
|
40
35
|
|
|
@@ -68,22 +63,20 @@ credit_tag_link_table = Table(
|
|
|
68
63
|
class TransactionTag(AuthorizedAccessMixin, Model):
|
|
69
64
|
__tablename__ = "transaction_tags"
|
|
70
65
|
# Columns
|
|
71
|
-
id = mapped_column(
|
|
72
|
-
user_id = mapped_column(
|
|
73
|
-
parent_id = mapped_column(
|
|
74
|
-
tag_name
|
|
66
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
67
|
+
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
|
68
|
+
parent_id: Mapped[Optional[int]] = mapped_column(ForeignKey("transaction_tags.id"))
|
|
69
|
+
tag_name: Mapped[str]
|
|
75
70
|
# Relationships
|
|
76
|
-
parent
|
|
77
|
-
|
|
78
|
-
bank_subtransactions = relationship(
|
|
79
|
-
"BankSubtransaction",
|
|
80
|
-
secondary=bank_tag_link_table,
|
|
81
|
-
back_populates="tags",
|
|
71
|
+
parent: Mapped["TransactionTag"] = relationship(
|
|
72
|
+
back_populates="children", remote_side=[id]
|
|
82
73
|
)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
secondary=
|
|
86
|
-
|
|
74
|
+
children: Mapped[List["TransactionTag"]] = relationship(back_populates="parent")
|
|
75
|
+
bank_subtransactions: Mapped[List["BankSubtransaction"]] = relationship(
|
|
76
|
+
back_populates="tags", secondary=bank_tag_link_table
|
|
77
|
+
)
|
|
78
|
+
credit_subtransactions: Mapped[List["CreditSubtransaction"]] = relationship(
|
|
79
|
+
back_populates="tags", secondary=credit_tag_link_table
|
|
87
80
|
)
|
|
88
81
|
|
|
89
82
|
@property
|
|
@@ -97,21 +90,16 @@ class TransactionTag(AuthorizedAccessMixin, Model):
|
|
|
97
90
|
class Bank(AuthorizedAccessMixin, Model):
|
|
98
91
|
__tablename__ = "banks"
|
|
99
92
|
# Columns
|
|
100
|
-
id = mapped_column(
|
|
101
|
-
user_id = mapped_column(
|
|
102
|
-
bank_name
|
|
93
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
94
|
+
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
|
95
|
+
bank_name: Mapped[str]
|
|
103
96
|
# Relationships
|
|
104
|
-
user = relationship(
|
|
105
|
-
bank_accounts = relationship(
|
|
106
|
-
"
|
|
107
|
-
viewonly=True,
|
|
108
|
-
back_populates="bank",
|
|
109
|
-
cascade="all, delete",
|
|
97
|
+
user: Mapped["User"] = relationship(back_populates="banks")
|
|
98
|
+
bank_accounts: Mapped[List["BankAccountView"]] = relationship(
|
|
99
|
+
back_populates="bank", cascade="all, delete", viewonly=True
|
|
110
100
|
)
|
|
111
|
-
credit_accounts = relationship(
|
|
112
|
-
"
|
|
113
|
-
back_populates="bank",
|
|
114
|
-
cascade="all, delete",
|
|
101
|
+
credit_accounts: Mapped[List["CreditAccount"]] = relationship(
|
|
102
|
+
back_populates="bank", cascade="all, delete"
|
|
115
103
|
)
|
|
116
104
|
|
|
117
105
|
|
|
@@ -119,16 +107,13 @@ class BankAccountType(AuthorizedAccessMixin, Model):
|
|
|
119
107
|
__tablename__ = "bank_account_types"
|
|
120
108
|
_alt_authorized_ids = (0,)
|
|
121
109
|
# Columns
|
|
122
|
-
id = mapped_column(
|
|
123
|
-
user_id = mapped_column(
|
|
124
|
-
type_name
|
|
125
|
-
type_abbreviation
|
|
110
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
111
|
+
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
|
112
|
+
type_name: Mapped[str]
|
|
113
|
+
type_abbreviation: Mapped[Optional[str]]
|
|
126
114
|
# Relationships
|
|
127
|
-
view = relationship(
|
|
128
|
-
"
|
|
129
|
-
viewonly=True,
|
|
130
|
-
back_populates="account_type",
|
|
131
|
-
uselist=False,
|
|
115
|
+
view: Mapped["BankAccountTypeView"] = relationship(
|
|
116
|
+
back_populates="account_type", uselist=False, viewonly=True
|
|
132
117
|
)
|
|
133
118
|
|
|
134
119
|
|
|
@@ -137,20 +122,15 @@ class BankAccountTypeView(AuthorizedAccessMixin, Model):
|
|
|
137
122
|
_alt_authorized_ids = (0,)
|
|
138
123
|
# Columns
|
|
139
124
|
id = mapped_column(Integer, ForeignKey("bank_account_types.id"), primary_key=True)
|
|
140
|
-
user_id = mapped_column(
|
|
141
|
-
type_name
|
|
142
|
-
type_abbreviation
|
|
143
|
-
type_common_name
|
|
125
|
+
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
|
126
|
+
type_name: Mapped[str]
|
|
127
|
+
type_abbreviation: Mapped[Optional[str]]
|
|
128
|
+
type_common_name: Mapped[str]
|
|
144
129
|
# Relationships
|
|
145
|
-
account_type = relationship(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
user = relationship("User", back_populates="bank_account_types")
|
|
150
|
-
accounts = relationship(
|
|
151
|
-
"BankAccountView",
|
|
152
|
-
viewonly=True,
|
|
153
|
-
back_populates="account_type",
|
|
130
|
+
account_type: Mapped["BankAccountType"] = relationship(back_populates="view")
|
|
131
|
+
user: Mapped["User"] = relationship(back_populates="bank_account_types")
|
|
132
|
+
accounts: Mapped[List["BankAccountView"]] = relationship(
|
|
133
|
+
back_populates="account_type", viewonly=True
|
|
154
134
|
)
|
|
155
135
|
|
|
156
136
|
|
|
@@ -158,21 +138,16 @@ class BankAccount(AuthorizedAccessMixin, Model):
|
|
|
158
138
|
__tablename__ = "bank_accounts"
|
|
159
139
|
_user_id_join_chain = (Bank,)
|
|
160
140
|
# Columns
|
|
161
|
-
id = mapped_column(
|
|
162
|
-
bank_id = mapped_column(
|
|
163
|
-
account_type_id = mapped_column(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
last_four_digits = mapped_column(String, nullable=False)
|
|
169
|
-
active = mapped_column(Integer, nullable=False)
|
|
141
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
142
|
+
bank_id: Mapped[int] = mapped_column(ForeignKey("banks.id"))
|
|
143
|
+
account_type_id: Mapped[int] = mapped_column(
|
|
144
|
+
ForeignKey("bank_account_types_view.id")
|
|
145
|
+
)
|
|
146
|
+
last_four_digits: Mapped[str]
|
|
147
|
+
active: Mapped[int]
|
|
170
148
|
# Relationships
|
|
171
|
-
view = relationship(
|
|
172
|
-
"
|
|
173
|
-
viewonly=True,
|
|
174
|
-
back_populates="account",
|
|
175
|
-
uselist=False,
|
|
149
|
+
view: Mapped["BankAccountView"] = relationship(
|
|
150
|
+
back_populates="account", uselist=False, viewonly=True
|
|
176
151
|
)
|
|
177
152
|
|
|
178
153
|
|
|
@@ -180,27 +155,23 @@ class BankAccountView(AuthorizedAccessMixin, Model):
|
|
|
180
155
|
__tablename__ = "bank_accounts_view"
|
|
181
156
|
_user_id_join_chain = (Bank,)
|
|
182
157
|
# Columns
|
|
183
|
-
id = mapped_column(
|
|
184
|
-
bank_id = mapped_column(
|
|
185
|
-
account_type_id = mapped_column(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
balance = mapped_column(Float, nullable=False)
|
|
193
|
-
projected_balance = mapped_column(Float, nullable=False)
|
|
158
|
+
id: Mapped[int] = mapped_column(ForeignKey("bank_accounts.id"), primary_key=True)
|
|
159
|
+
bank_id: Mapped[int] = mapped_column(ForeignKey("banks.id"))
|
|
160
|
+
account_type_id: Mapped[int] = mapped_column(
|
|
161
|
+
ForeignKey("bank_account_types_view.id")
|
|
162
|
+
)
|
|
163
|
+
last_four_digits: Mapped[str]
|
|
164
|
+
active: Mapped[int]
|
|
165
|
+
balance: Mapped[float]
|
|
166
|
+
projected_balance: Mapped[float]
|
|
194
167
|
# Relationships
|
|
195
|
-
account = relationship(
|
|
196
|
-
bank = relationship(
|
|
197
|
-
account_type = relationship(
|
|
198
|
-
"
|
|
199
|
-
viewonly=True,
|
|
200
|
-
back_populates="accounts",
|
|
168
|
+
account: Mapped["BankAccount"] = relationship(back_populates="view")
|
|
169
|
+
bank: Mapped["Bank"] = relationship(back_populates="bank_accounts")
|
|
170
|
+
account_type: Mapped["BankAccountTypeView"] = relationship(
|
|
171
|
+
back_populates="accounts", viewonly=True
|
|
201
172
|
)
|
|
202
|
-
transactions = relationship(
|
|
203
|
-
"
|
|
173
|
+
transactions: Mapped[List["BankTransactionView"]] = relationship(
|
|
174
|
+
back_populates="account", viewonly=True
|
|
204
175
|
)
|
|
205
176
|
|
|
206
177
|
|
|
@@ -210,25 +181,16 @@ class BankTransaction(AuthorizedAccessMixin, Model):
|
|
|
210
181
|
# Denote the transaction subtype
|
|
211
182
|
subtype = "bank"
|
|
212
183
|
# Columns
|
|
213
|
-
id = mapped_column(
|
|
214
|
-
internal_transaction_id = mapped_column(
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
)
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
ForeignKey("bank_accounts_view.id"),
|
|
221
|
-
nullable=False,
|
|
222
|
-
)
|
|
223
|
-
transaction_date = mapped_column(Date, nullable=False)
|
|
224
|
-
merchant = mapped_column(String)
|
|
225
|
-
# ((Should have optional merchant field?))
|
|
184
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
185
|
+
internal_transaction_id: Mapped[Optional[int]] = mapped_column(
|
|
186
|
+
ForeignKey("internal_transactions.id")
|
|
187
|
+
)
|
|
188
|
+
account_id: Mapped[int] = mapped_column(ForeignKey("bank_accounts_view.id"))
|
|
189
|
+
transaction_date: Mapped[datetime.date]
|
|
190
|
+
merchant: Mapped[Optional[str]]
|
|
226
191
|
# Relationships
|
|
227
|
-
view = relationship(
|
|
228
|
-
"
|
|
229
|
-
viewonly=True,
|
|
230
|
-
back_populates="transaction",
|
|
231
|
-
uselist=False,
|
|
192
|
+
view: Mapped["BankTransactionView"] = relationship(
|
|
193
|
+
back_populates="transaction", uselist=False, viewonly=True
|
|
232
194
|
)
|
|
233
195
|
|
|
234
196
|
|
|
@@ -238,35 +200,26 @@ class BankTransactionView(AuthorizedAccessMixin, Model):
|
|
|
238
200
|
# Denote the transaction subtype
|
|
239
201
|
subtype = "bank"
|
|
240
202
|
# Columns
|
|
241
|
-
id = mapped_column(
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
total = mapped_column(Float)
|
|
254
|
-
notes = mapped_column(String)
|
|
255
|
-
balance = mapped_column(Float)
|
|
256
|
-
# ((Should have optional merchant field?))
|
|
203
|
+
id: Mapped[int] = mapped_column(
|
|
204
|
+
ForeignKey("bank_transactions.id"), primary_key=True
|
|
205
|
+
)
|
|
206
|
+
internal_transaction_id: Mapped[Optional[int]] = mapped_column(
|
|
207
|
+
ForeignKey("internal_transactions.id")
|
|
208
|
+
)
|
|
209
|
+
account_id: Mapped[int] = mapped_column(ForeignKey("bank_accounts_view.id"))
|
|
210
|
+
transaction_date: Mapped[datetime.date]
|
|
211
|
+
merchant: Mapped[Optional[str]]
|
|
212
|
+
total: Mapped[float]
|
|
213
|
+
notes: Mapped[Optional[str]]
|
|
214
|
+
balance: Mapped[float]
|
|
257
215
|
# Relationships
|
|
258
|
-
transaction = relationship(
|
|
259
|
-
|
|
260
|
-
back_populates="
|
|
261
|
-
)
|
|
262
|
-
internal_transaction = relationship(
|
|
263
|
-
"InternalTransaction", back_populates="bank_transactions"
|
|
216
|
+
transaction: Mapped["BankTransaction"] = relationship(back_populates="view")
|
|
217
|
+
internal_transaction: Mapped["InternalTransaction"] = relationship(
|
|
218
|
+
back_populates="bank_transactions"
|
|
264
219
|
)
|
|
265
|
-
account = relationship(
|
|
266
|
-
subtransactions = relationship(
|
|
267
|
-
"
|
|
268
|
-
back_populates="transaction",
|
|
269
|
-
lazy="selectin",
|
|
220
|
+
account: Mapped["BankAccountView"] = relationship(back_populates="transactions")
|
|
221
|
+
subtransactions: Mapped[List["BankSubtransaction"]] = relationship(
|
|
222
|
+
back_populates="transaction", lazy="selectin"
|
|
270
223
|
)
|
|
271
224
|
|
|
272
225
|
|
|
@@ -274,24 +227,17 @@ class BankSubtransaction(AuthorizedAccessMixin, Model):
|
|
|
274
227
|
__tablename__ = "bank_subtransactions"
|
|
275
228
|
_user_id_join_chain = (BankTransactionView, BankAccountView, Bank)
|
|
276
229
|
# Columns
|
|
277
|
-
id = mapped_column(
|
|
278
|
-
transaction_id = mapped_column(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
nullable=False,
|
|
282
|
-
)
|
|
283
|
-
subtotal = mapped_column(Float, nullable=False)
|
|
284
|
-
note = mapped_column(String, nullable=False)
|
|
230
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
231
|
+
transaction_id: Mapped[int] = mapped_column(ForeignKey("bank_transactions_view.id"))
|
|
232
|
+
subtotal: Mapped[float]
|
|
233
|
+
note: Mapped[str]
|
|
285
234
|
# Relationships
|
|
286
|
-
transaction = relationship(
|
|
287
|
-
"
|
|
288
|
-
viewonly=True,
|
|
289
|
-
back_populates="subtransactions",
|
|
235
|
+
transaction: Mapped["BankTransactionView"] = relationship(
|
|
236
|
+
back_populates="subtransactions", viewonly=True
|
|
290
237
|
)
|
|
291
|
-
tags = relationship(
|
|
292
|
-
"TransactionTag",
|
|
293
|
-
secondary=bank_tag_link_table,
|
|
238
|
+
tags: Mapped[List["TransactionTag"]] = relationship(
|
|
294
239
|
back_populates="bank_subtransactions",
|
|
240
|
+
secondary=bank_tag_link_table,
|
|
295
241
|
lazy="selectin",
|
|
296
242
|
)
|
|
297
243
|
|
|
@@ -300,17 +246,15 @@ class CreditAccount(AuthorizedAccessMixin, Model):
|
|
|
300
246
|
__tablename__ = "credit_accounts"
|
|
301
247
|
_user_id_join_chain = (Bank,)
|
|
302
248
|
# Columns
|
|
303
|
-
id = mapped_column(
|
|
304
|
-
bank_id = mapped_column(
|
|
305
|
-
statement_issue_day
|
|
306
|
-
statement_due_day
|
|
249
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
250
|
+
bank_id: Mapped[int] = mapped_column(ForeignKey("banks.id"))
|
|
251
|
+
statement_issue_day: Mapped[int]
|
|
252
|
+
statement_due_day: Mapped[int]
|
|
307
253
|
# ((Should probably have an 'active' field))
|
|
308
254
|
# Relationships
|
|
309
|
-
bank = relationship(
|
|
310
|
-
cards = relationship(
|
|
311
|
-
"
|
|
312
|
-
back_populates="account",
|
|
313
|
-
cascade="all, delete",
|
|
255
|
+
bank: Mapped["Bank"] = relationship(back_populates="credit_accounts")
|
|
256
|
+
cards: Mapped[List["CreditCard"]] = relationship(
|
|
257
|
+
back_populates="account", cascade="all, delete"
|
|
314
258
|
)
|
|
315
259
|
|
|
316
260
|
|
|
@@ -318,20 +262,14 @@ class CreditCard(AuthorizedAccessMixin, Model):
|
|
|
318
262
|
__tablename__ = "credit_cards"
|
|
319
263
|
_user_id_join_chain = (CreditAccount, Bank)
|
|
320
264
|
# Columns
|
|
321
|
-
id = mapped_column(
|
|
322
|
-
account_id = mapped_column(
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
nullable=False,
|
|
326
|
-
)
|
|
327
|
-
last_four_digits = mapped_column(String, nullable=False)
|
|
328
|
-
active = mapped_column(Integer, nullable=False)
|
|
265
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
266
|
+
account_id: Mapped[int] = mapped_column(ForeignKey("credit_accounts.id"))
|
|
267
|
+
last_four_digits: Mapped[str]
|
|
268
|
+
active: Mapped[int]
|
|
329
269
|
# Relationships
|
|
330
|
-
account = relationship(
|
|
331
|
-
statements = relationship(
|
|
332
|
-
"
|
|
333
|
-
viewonly=True,
|
|
334
|
-
back_populates="card",
|
|
270
|
+
account: Mapped["CreditAccount"] = relationship(back_populates="cards")
|
|
271
|
+
statements: Mapped[List["CreditStatementView"]] = relationship(
|
|
272
|
+
back_populates="card", viewonly=True
|
|
335
273
|
)
|
|
336
274
|
|
|
337
275
|
|
|
@@ -339,16 +277,13 @@ class CreditStatement(AuthorizedAccessMixin, Model):
|
|
|
339
277
|
__tablename__ = "credit_statements"
|
|
340
278
|
_user_id_join_chain = (CreditCard, CreditAccount, Bank)
|
|
341
279
|
# Columns
|
|
342
|
-
id = mapped_column(
|
|
343
|
-
card_id = mapped_column(
|
|
344
|
-
issue_date
|
|
345
|
-
due_date
|
|
346
|
-
#
|
|
347
|
-
view = relationship(
|
|
348
|
-
"
|
|
349
|
-
viewonly=True,
|
|
350
|
-
back_populates="statement",
|
|
351
|
-
uselist=False,
|
|
280
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
281
|
+
card_id: Mapped[int] = mapped_column(ForeignKey("credit_cards.id"))
|
|
282
|
+
issue_date: Mapped[datetime.date]
|
|
283
|
+
due_date: Mapped[datetime.date]
|
|
284
|
+
# Relationships
|
|
285
|
+
view: Mapped["CreditStatementView"] = relationship(
|
|
286
|
+
back_populates="statement", uselist=False, viewonly=True
|
|
352
287
|
)
|
|
353
288
|
|
|
354
289
|
|
|
@@ -356,20 +291,19 @@ class CreditStatementView(AuthorizedAccessMixin, Model):
|
|
|
356
291
|
__tablename__ = "credit_statements_view"
|
|
357
292
|
_user_id_join_chain = (CreditCard, CreditAccount, Bank)
|
|
358
293
|
# Columns
|
|
359
|
-
id = mapped_column(
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
294
|
+
id: Mapped[int] = mapped_column(
|
|
295
|
+
ForeignKey("credit_statements.id"), primary_key=True
|
|
296
|
+
)
|
|
297
|
+
card_id: Mapped[int] = mapped_column(ForeignKey("credit_cards.id"))
|
|
298
|
+
issue_date: Mapped[datetime.date]
|
|
299
|
+
due_date: Mapped[datetime.date]
|
|
300
|
+
balance: Mapped[float]
|
|
301
|
+
payment_date: Mapped[datetime.date]
|
|
365
302
|
# Relationships
|
|
366
|
-
statement = relationship(
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
card = relationship("CreditCard", back_populates="statements")
|
|
371
|
-
transactions = relationship(
|
|
372
|
-
"CreditTransactionView", viewonly=True, back_populates="statement"
|
|
303
|
+
statement: Mapped["CreditStatement"] = relationship(back_populates="view")
|
|
304
|
+
card: Mapped["CreditCard"] = relationship(back_populates="statements")
|
|
305
|
+
transactions: Mapped[List["CreditTransactionView"]] = relationship(
|
|
306
|
+
back_populates="statement", viewonly=True
|
|
373
307
|
)
|
|
374
308
|
|
|
375
309
|
|
|
@@ -379,24 +313,16 @@ class CreditTransaction(AuthorizedAccessMixin, Model):
|
|
|
379
313
|
# Denote the transaction subtype
|
|
380
314
|
subtype = "credit"
|
|
381
315
|
# Columns
|
|
382
|
-
id = mapped_column(
|
|
383
|
-
internal_transaction_id = mapped_column(
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
)
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
ForeignKey("credit_statements_view.id"),
|
|
390
|
-
nullable=False,
|
|
391
|
-
)
|
|
392
|
-
transaction_date = mapped_column(Date, nullable=False)
|
|
393
|
-
merchant = mapped_column(String, nullable=False)
|
|
316
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
317
|
+
internal_transaction_id: Mapped[Optional[int]] = mapped_column(
|
|
318
|
+
ForeignKey("internal_transactions.id")
|
|
319
|
+
)
|
|
320
|
+
statement_id: Mapped[int] = mapped_column(ForeignKey("credit_statements_view.id"))
|
|
321
|
+
transaction_date: Mapped[datetime.date]
|
|
322
|
+
merchant: Mapped[str]
|
|
394
323
|
# Relationships
|
|
395
|
-
view = relationship(
|
|
396
|
-
"
|
|
397
|
-
viewonly=True,
|
|
398
|
-
back_populates="transaction",
|
|
399
|
-
uselist=False,
|
|
324
|
+
view: Mapped["CreditTransactionView"] = relationship(
|
|
325
|
+
back_populates="transaction", uselist=False, viewonly=True
|
|
400
326
|
)
|
|
401
327
|
|
|
402
328
|
|
|
@@ -406,42 +332,29 @@ class CreditTransactionView(AuthorizedAccessMixin, Model):
|
|
|
406
332
|
# Denote the transaction subtype
|
|
407
333
|
subtype = "credit"
|
|
408
334
|
# Columns
|
|
409
|
-
id = mapped_column(
|
|
410
|
-
|
|
411
|
-
ForeignKey("credit_transactions.id"),
|
|
412
|
-
primary_key=True,
|
|
413
|
-
)
|
|
414
|
-
internal_transaction_id = mapped_column(
|
|
415
|
-
Integer,
|
|
416
|
-
ForeignKey("internal_transactions.id"),
|
|
335
|
+
id: Mapped[int] = mapped_column(
|
|
336
|
+
ForeignKey("credit_transactions.id"), primary_key=True
|
|
417
337
|
)
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
ForeignKey("credit_statements_view.id"),
|
|
421
|
-
nullable=False,
|
|
338
|
+
internal_transaction_id: Mapped[Optional[int]] = mapped_column(
|
|
339
|
+
ForeignKey("internal_transactions.id")
|
|
422
340
|
)
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
341
|
+
statement_id: Mapped[int] = mapped_column(ForeignKey("credit_statements_view.id"))
|
|
342
|
+
transaction_date: Mapped[datetime.date]
|
|
343
|
+
merchant: Mapped[str]
|
|
344
|
+
total: Mapped[float]
|
|
345
|
+
notes: Mapped[str]
|
|
427
346
|
# Relationships
|
|
428
|
-
transaction = relationship(
|
|
429
|
-
"
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
back_populates="transactions",
|
|
440
|
-
)
|
|
441
|
-
subtransactions = relationship(
|
|
442
|
-
"CreditSubtransaction",
|
|
443
|
-
back_populates="transaction",
|
|
444
|
-
lazy="selectin",
|
|
347
|
+
transaction: Mapped["CreditTransaction"] = relationship(
|
|
348
|
+
back_populates="view", uselist=False
|
|
349
|
+
)
|
|
350
|
+
internal_transaction: Mapped["InternalTransaction"] = relationship(
|
|
351
|
+
back_populates="credit_transactions"
|
|
352
|
+
)
|
|
353
|
+
statement: Mapped["CreditStatementView"] = relationship(
|
|
354
|
+
back_populates="transactions", viewonly=True
|
|
355
|
+
)
|
|
356
|
+
subtransactions: Mapped[List["CreditSubtransaction"]] = relationship(
|
|
357
|
+
back_populates="transaction", lazy="selectin"
|
|
445
358
|
)
|
|
446
359
|
|
|
447
360
|
|
|
@@ -455,24 +368,19 @@ class CreditSubtransaction(AuthorizedAccessMixin, Model):
|
|
|
455
368
|
Bank,
|
|
456
369
|
)
|
|
457
370
|
# Columns
|
|
458
|
-
id = mapped_column(
|
|
459
|
-
transaction_id = mapped_column(
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
subtotal = mapped_column(Float, nullable=False)
|
|
465
|
-
note = mapped_column(String, nullable=False)
|
|
371
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
372
|
+
transaction_id: Mapped[int] = mapped_column(
|
|
373
|
+
ForeignKey("credit_transactions_view.id")
|
|
374
|
+
)
|
|
375
|
+
subtotal: Mapped[float]
|
|
376
|
+
note: Mapped[str]
|
|
466
377
|
# Relationships
|
|
467
|
-
transaction = relationship(
|
|
468
|
-
"
|
|
469
|
-
viewonly=True,
|
|
470
|
-
back_populates="subtransactions",
|
|
378
|
+
transaction: Mapped["CreditTransactionView"] = relationship(
|
|
379
|
+
back_populates="subtransactions", viewonly=True
|
|
471
380
|
)
|
|
472
|
-
tags = relationship(
|
|
473
|
-
"TransactionTag",
|
|
474
|
-
secondary=credit_tag_link_table,
|
|
381
|
+
tags: Mapped[List["TransactionTag"]] = relationship(
|
|
475
382
|
back_populates="credit_subtransactions",
|
|
383
|
+
secondary=credit_tag_link_table,
|
|
476
384
|
lazy="selectin",
|
|
477
385
|
)
|
|
478
386
|
|