You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #63 from RandomProgramm3r/develop
refactor: consolidate Redis config, validators, tests, and serializer logic
This commit groups several improvements and refactorings across the project:
- **Redis Configuration**
- Replace the single `REDIS_URL` variable with distinct `REDIS_HOST` and `REDIS_PORT` environment variables for clearer, more flexible setup across environments.
- Remove the incorrect custom `save` method on the `User` model that improperly set `last_login`; rely on Django’s authentication backend to manage this field.
- **Validators**
- Move `validators.py` (user-related validation logic) from the core project directory into the `user` application for better modularization and discoverability.
- **Tests**
- Add a comprehensive test suite for all password validators in `user/validators.py` covering:
- `UppercaseValidator`
- `LowercaseValidator`
- `NumericValidator`
- `SpecialCharacterValidator`
- `AsciiValidator`
- Each validator is tested for successful validation, appropriate failure messages, and correct help text.
- **Serializers & Manager Logic**
- Simplify `PromoManager` filtering by restructuring age and country query conditions.
- Streamline `Promo` model properties (`is_available`, `get_available_unique_codes`) for readability and consistency.
- Refactor serializers (`business`, `core`, `user`) to remove redundant validations already handled by DRF, simplify complex conditionals (e.g., `MultiCountryField`), and assume authenticated context in `BaseUserPromoSerializer`.
- Update settings paths for password validators to reflect their new location in the `user` app.
0 commit comments