@@ -13,10 +13,17 @@ class TransactionBase(SQLModel):
1313 account_id : int = Field (foreign_key = "account.id" )
1414 payment_id : int | None = Field (foreign_key = "payment.id" , default = None )
1515 amount : Decimal
16- created_at : datetime = Field (default_factory = lambda : datetime .now (UTC ))
17- posted_at : datetime | None = None
16+ created_at : datetime = Field (
17+ default_factory = lambda : datetime .now (UTC ),
18+ sa_column = Column (DateTime (timezone = True ), nullable = False ),
19+ )
20+ posted_at : datetime | None = Field (
21+ default = None , sa_column = Column (DateTime (timezone = True ), nullable = True )
22+ )
1823 description : str | None = None
19- reconciled_at : datetime | None = None
24+ reconciled_at : datetime | None = Field (
25+ default = None , sa_column = Column (DateTime (timezone = True ), nullable = True )
26+ )
2027 index : int | None = None
2128
2229
@@ -28,15 +35,6 @@ class Transaction(TransactionBase, table=True):
2835 ),
2936 )
3037 id : int | None = Field (primary_key = True , default = None )
31- created_at : datetime = Field (
32- sa_column = Column (DateTime (timezone = True ), nullable = False )
33- )
34- posted_at : datetime | None = Field (
35- sa_column = Column (DateTime (timezone = True ), nullable = True )
36- )
37- reconciled_at : datetime | None = Field (
38- sa_column = Column (DateTime (timezone = True ), nullable = True )
39- )
4038 account : "Account" = Relationship (back_populates = "transactions" )
4139 payment : Optional ["Payment" ] = Relationship (back_populates = "transactions" )
4240
@@ -47,3 +45,4 @@ class TransactionCreate(TransactionBase):
4745
4846class TransactionRead (TransactionBase ):
4947 id : int
48+ created_at : datetime
0 commit comments