Closed m-sidorenko closed 7 months ago
The recent updates involve refining the project's structure and functionality, focusing on database interactions and streamlining the codebase. Specifically, the changes include the introduction of a new database connection utility, the removal of unnecessary imports, and enhancements to asynchronous data handling and validation in the context of saving poll data. These modifications aim to improve the code's efficiency, readability, and maintainability.
Files | Summary |
---|---|
src/__main__.py |
Added the import of get_db from src.db module. |
src/callbacks/receive_poll_answer.py |
Removed the import of ParseMode from telegram.constants . |
src/db.py |
Removed unused import statements for LiteralString and aiosqlite . |
src/data_models/Record.py |
- Added creator_id , playroom_id fields to Record class. |
- Changed `role` field type to `config.GAME_POLL_OUTCOMES`.
- Updated `shorten_role` method to return specific literals based on input strings. |
| src/handlers/save.py
| - Added imports for asyncio
and db
.
_pass_checks
function and updated save
function for asynchronous database interactions and poll data handling. |
| src/config.py
| Added a new type Literal
import and defined GAME_POLL_OUTCOMES
with specific outcome literals for a game scenario. |
| src/services/db_service.py
| Introduces save_record(record: Record) -> None
function to save a record object to a database table called records
. |๐โจ
In the burrow of code, under the moon's soft glow,
Changes were made, with efficiency in tow.
Imports pruned, and logic refined,
A rabbit's work, elegantly designed. ๐๐
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
๐คก๐คน๐๐ฟ
Summary by CodeRabbit
creator_id
andplayroom_id
fields to theRecord
class.shorten_role
method to return specific literals based on input strings.save_record(record: Record) -> None
indb_service.py
to save record objects to a database table.save
function to handle poll data, print results, and insert records into a database asynchronously.