From 488a1b4bdd6a3faa4594b3055676ae85f494ce86 Mon Sep 17 00:00:00 2001 From: ameye Date: Sat, 26 Apr 2025 15:39:37 -0400 Subject: [PATCH] First step to linked loans --- .env.local.example | 35 +++++++++++++++++++ app/config.py | 3 +- app/models/loan.py | 2 ++ ...9_migration_on_sat_apr_26_19_02_17_utc_.py | 32 +++++++++++++++++ 4 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .env.local.example create mode 100644 migrations/versions/eb99c7fb9e09_migration_on_sat_apr_26_19_02_17_utc_.py diff --git a/.env.local.example b/.env.local.example new file mode 100644 index 0000000..3521430 --- /dev/null +++ b/.env.local.example @@ -0,0 +1,35 @@ +# Environment Variables +BASIC_AUTH_USERNAME=user +BASIC_AUTH_PASSWORD=password + +#swagger Configuration +SWAGGER_URL="/documentation" +API_URL="/swagger.json" + +# Database Configuration +DATABASE_USER=firstadvance +DATABASE_PASSWORD=FirstAdvance! +DATABASE_HOST=dev-data.simbrellang.net +DATABASE_PORT=10532 +DATABASE_NAME=firstadvancedev + +# DATABASE_HOST=10.20.30.60 +# DATABASE_USER=firstadvance +# DATABASE_PASSWORD=firstadvance +# DATABASE_NAME=firstadvancedev +# DATABASE_PORT=5432 + +# Flask Configuration +FLASK_APP=wsgi.py +FLASK_ENV=development +APP_PORT=4500 + + +# Bank Call Service Connection +SIMBRELLA_BASE_URL="https://bank-emulator.dev.simbrellang.net" +VALID_APP_ID=app1 +VALID_API_KEY=test-api-key-12345 + + +# Event Bus Broker Configuration +KAFKA_BROKER="10.0.0.246:9092" diff --git a/app/config.py b/app/config.py index 4a3e597..2db5ba5 100644 --- a/app/config.py +++ b/app/config.py @@ -31,7 +31,8 @@ class Config: "JWT_REFRESH_TOKEN_EXPIRES", timedelta(days=30) ) - KAFKA_BROKER = 'dev-events.simbrellang.net:9085' + # KAFKA_BROKER = 'dev-events.simbrellang.net:9085' + KAFKA_BROKER = os.getenv("KAFKA_BROKER", "dev-events.simbrellang.net:9085") settings = Config() diff --git a/app/models/loan.py b/app/models/loan.py index e625bee..d852dd4 100644 --- a/app/models/loan.py +++ b/app/models/loan.py @@ -17,6 +17,7 @@ class Loan(db.Model): ) customer_id = db.Column(db.String(50), nullable=False) transaction_id = db.Column(db.String(50), nullable=True) + original_transaction = db.Column(db.String(50), nullable=True) account_id = db.Column(db.String(50), nullable=False) offer_id = db.Column(db.String(20), nullable=False) product_id = db.Column(db.String(20), nullable=True) @@ -85,6 +86,7 @@ class Loan(db.Model): product_id = product_id, collection_type = collection_type, transaction_id = transaction_id, + original_transaction = transaction_id, initial_loan_amount = initial_loan_amount, current_loan_amount = initial_loan_amount, upfront_fee = upfront_fee, diff --git a/migrations/versions/eb99c7fb9e09_migration_on_sat_apr_26_19_02_17_utc_.py b/migrations/versions/eb99c7fb9e09_migration_on_sat_apr_26_19_02_17_utc_.py new file mode 100644 index 0000000..c77223e --- /dev/null +++ b/migrations/versions/eb99c7fb9e09_migration_on_sat_apr_26_19_02_17_utc_.py @@ -0,0 +1,32 @@ +"""Migration on Sat Apr 26 19:02:17 UTC 2025 + +Revision ID: eb99c7fb9e09 +Revises: 89759cebb9c6 +Create Date: 2025-04-26 19:02:20.443678 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'eb99c7fb9e09' +down_revision = '89759cebb9c6' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('loans', schema=None) as batch_op: + batch_op.add_column(sa.Column('original_transaction', sa.String(length=50), nullable=True)) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('loans', schema=None) as batch_op: + batch_op.drop_column('original_transaction') + + # ### end Alembic commands ###