Added Transaction offer

This commit was merged in pull request #17.
This commit is contained in:
Azeez Muibi
2025-05-19 13:43:49 +01:00
parent 3ae29b69b5
commit 26868c0043
2 changed files with 17 additions and 14 deletions
+15 -12
View File
@@ -22,14 +22,20 @@ class TransactionOffer(db.Model):
eligible_amount = db.Column(db.Float, nullable=True)
tenor = db.Column(db.Integer, nullable=True) # tenor in months, typically
created_at = db.Column(db.DateTime(timezone=True), server_default=func.now())
updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
customer = relationship(
"Customer",
primaryjoin="Customer.id == TransactionOffer.customer_id",
foreign_keys=[customer_id],
back_populates="transaction_offers",
)
created_at = db.Column(db.DateTime, default=datetime.now(timezone.utc))
updated_at = db.Column(db.DateTime, default=datetime.now(timezone.utc), onupdate=datetime.now(timezone.utc))
# created_at = db.Column(db.DateTime(timezone=True), server_default=func.now())
# updated_at = db.Column(db.DateTime(timezone=True), onupdate=func.now())
def __repr__(self):
return f'<TransactionOffer {self.id}>'
# customer = relationship(
# "Customer",
# primaryjoin="Customer.id == TransactionOffer.customer_id",
# foreign_keys=[customer_id],
# back_populates="transaction_offers",
# )
@classmethod
def is_valid_transaction_offer(cls, transaction_offer, customer_id, product_id):
@@ -114,7 +120,4 @@ class TransactionOffer(db.Model):
# 'tenor': self.tenor,
# 'createdAt': self.created_at.isoformat() if self.created_at else None,
# 'updatedAt': self.updated_at.isoformat() if self.updated_at else None,
# }
def __repr__(self):
return f'<TransactionOffer {self.id}>'
# }