Enhancements to user-related database queries for efficiency and clarity - #17
Closed
arian24b wants to merge 8 commits into
Closed
Enhancements to user-related database queries for efficiency and clarity#17arian24b wants to merge 8 commits into
arian24b wants to merge 8 commits into
Conversation
refactor(main): Replace os.path with pathlib for file checks and enhance IP validation logic
…nd installation steps
Contributor
|
your change is not very nesserly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and code cleanups, focusing primarily on the user database access layer and some project configuration files. The most significant changes are enhancements to user-related database queries for efficiency and clarity, modernization of type hints, and some minor updates to logging and workflow automation.
User Database Query and Model Improvements:
get_user,get_user_by_id,get_users, and related queries) to eagerly load related fields (groups,admin,next_plan,usage_logs, etc.) usingselectinloadandjoinedload, improving query efficiency and reducing the need for additional attribute loading. Also removed unnecessary calls toload_user_attrs. [1] [2] [3] [4]Optional[User]andList) with modern Python type hints (e.g.,User | None,list[User]). [1] [2] [3]UTCtimezone fromdatetimeand removed the unusedtimezoneimport, ensuring consistent timezone handling throughout the codebase. [1] [2] [3] [4]Project Configuration and Workflow:
.github/workflows/ruff-check.ymlworkflow to use the officialastral-sh/ruff-actionfor linting, simplifying the setup and ensuring better integration with Ruff's latest features..ruff_cacheto.dockerignoreto prevent unnecessary files from being included in Docker builds.Other Code Quality Improvements:
app/__init__.py, which is safer and more efficient.app/__init__.py. [1] [2]These changes collectively improve code maintainability, performance, and clarity, especially around user data access and project automation.