refactor: migrate database layer from sqlite3 to SQLAlchemy ORM#29
Conversation
…te database connection handling - Added python-decouple to manage environment variables more effectively. - Updated database initialization in webhook_server.py to use DATABASE_URL from environment variables. - Refactored webhook signature verification for improved readability. - Enhanced error handling in webhook processing. - Updated test cases to reflect changes in database connection string. - Updated dependencies in pyproject.toml to include sqlalchemy and python-decouple.
|
This is what I love to see! 🥹🥹🥹🥹🥹 |
|
Let me know if you need me to change anything |
Those commas after the last parameter/arguments in the methods. I don't think they're meant to be that way. |
|
Fixed |
There are still more commas that I referenced in that file. |
the comma don't really matter it more of lint prefence |
|
Hey @alidauda Please check for merge conflicts. |
Removed unnecessary blank lines in database.py.
| raise HTTPException( | ||
| status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, | ||
| detail="internal server error" | ||
| detail="internal server error", |
There was a problem hiding this comment.
This comma again... 🥲
That's the end of the argument/parameter definition so there shouldn't be a comma, right?
| raise HTTPException( | ||
| status_code=status.HTTP_401_UNAUTHORIZED, | ||
| detail="invalid webhook signature" | ||
| detail="invalid webhook signature", |
| @@ -1,7 +1,9 @@ | |||
| """ | |||
There was a problem hiding this comment.
This looks great, except for the commas at the end of the argument definitions for some of the methods you used.
| for txn in transactions: | ||
| db.delete(txn) | ||
|
|
||
| db.commit() |
There was a problem hiding this comment.
I'm actually digging this refactor. ORM ftw
| .limit(limit) | ||
| .all() | ||
| ) | ||
|
|
There was a problem hiding this comment.
Thank you for this formatting. It seems you ran the lint check🙏🏽
|
Let's go! 🔥 |
Summary
with this changes user can use any database of their choice without extra configuration which means they are allowed to use etheir postgres mysql or sqllite