Merge branch 'repayments_data_model' of DigiFi/digifi-BankToProductCore into master
This commit is contained in:
@@ -9,6 +9,7 @@ from .charge import Charge
|
|||||||
from .rac_checks import RACCheck
|
from .rac_checks import RACCheck
|
||||||
from .loan_repayment_schedule import LoanRepaymentSchedule
|
from .loan_repayment_schedule import LoanRepaymentSchedule
|
||||||
from .transaction_offers import TransactionOffer
|
from .transaction_offers import TransactionOffer
|
||||||
|
from .repayments_data import RepaymentsData
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['Customer', 'Account', 'Loan', 'Transaction', 'Repayment', 'LoanCharge', 'Offer', 'Charge', 'RACCheck', 'LoanRepaymentSchedule', 'TransactionOffer']
|
__all__ = ['Customer', 'Account', 'Loan', 'Transaction', 'Repayment', 'LoanCharge', 'Offer', 'Charge', 'RACCheck', 'LoanRepaymentSchedule', 'TransactionOffer', 'RepaymentsData']
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
from datetime import datetime, timezone
|
||||||
|
from app.extensions import db
|
||||||
|
|
||||||
|
class RepaymentsData(db.Model):
|
||||||
|
__tablename__ = 'repayments_data'
|
||||||
|
|
||||||
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
|
transaction_id = db.Column(db.String(50), nullable=False)
|
||||||
|
added_date = db.Column(db.DateTime(timezone=True), default=datetime.now(timezone.utc), nullable=False)
|
||||||
|
response_code = db.Column(db.String(10), nullable=True)
|
||||||
|
response_descr = db.Column(db.String(255), nullable=True)
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
return {
|
||||||
|
"id": self.id,
|
||||||
|
"transaction_id": self.transaction_id,
|
||||||
|
"added_date": self.added_date.isoformat() if self.added_date else None,
|
||||||
|
"response_code": self.response_code,
|
||||||
|
"response_descr": self.response_descr,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f"<RepaymentsData id={self.id}, transaction_id={self.transaction_id}>"
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
"""Migration on Tue Jun 10 08:41:00 WAT 2025
|
||||||
|
|
||||||
|
Revision ID: 0acd553309a1
|
||||||
|
Revises: 45790fd659fb
|
||||||
|
Create Date: 2025-06-10 08:41:45.222513
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '0acd553309a1'
|
||||||
|
down_revision = '45790fd659fb'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_table('repayments_data',
|
||||||
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
||||||
|
sa.Column('transaction_id', sa.String(length=50), nullable=False),
|
||||||
|
sa.Column('added_date', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('response_code', sa.String(length=10), nullable=True),
|
||||||
|
sa.Column('response_descr', sa.String(length=255), nullable=True),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_table('repayments_data')
|
||||||
|
# ### end Alembic commands ###
|
||||||
Reference in New Issue
Block a user