Introduced new fixtures and tests for storage functionality, including saving files, generating URLs, and token creation/verification. Refactored `get_storage_provider` into a separate dependency module. Enhanced test coverage for improved reliability.
Renamed `base_dir` to `upload_folder` for better clarity and alignment with its purpose. Adjusted references and settings variable to reflect the updated naming convention. This enhances code readability and consistency.
Introduced `create_upload_token` and `verify_upload_token` functions to handle secure file uploads. These utilities generate signed tokens with expiration and content validation, ensuring upload security. Verification includes signature integrity and expiration checks.
Renamed API_V1_STR to API_VERSION_STR for consistency. Introduced 'UPLOAD_FOLDER' and ensured its creation, added logging for the data directory path, and implemented allowed image content type validation. Adjusted related references in `main.py`.
Introduce a new environment variable, `DATA_FILES_DIR`, for configuring static file storage. Updated `docker-compose` files to mount the host directory and propagate the variable. Implemented FastAPI `StaticFiles` to serve files from this directory under the `/files` route.
Added `background_image_url`, `foreground_image_url`, and `asset_image_urls` fields to enhance theme customization. Updated `asset_image_urls` to use `MutableDict` with a default empty dictionary and ensured consistency in the model and migration script.
Introduce a new endpoint to delete event themes, supporting both soft and hard deletes. Hard deletes are restricted to superusers, while soft deletes deactivate the theme. Also, improve error handling and user permission checks for this operation.
The `is_active` field was introduced to the `EventTheme` model to indicate whether a theme is active. The corresponding test fixture in `conftest.py` was updated to include this new field, ensuring consistency in tests. This change enhances flexibility for managing event themes.
Removed redundant code for event retrieval and standardized logic by introducing a unified method for generating event endpoints. Updated tests to align with these changes, adding support for slug-based access and handling finer permission cases. Minor issues with test formatting and comments were also addressed.
Centralized event access validation into a reusable `validate_event_access` function, eliminating duplicated code across endpoints. Updated the logic in `get_event` and `get_event_by_slug` to use this function. Adjusted tests to align with the refactored logic and fixed permission-based response statuses.
Updated event API to enforce stricter access controls based on user roles, including creators, managers, superusers, and guests. Added robust test cases for creating, fetching, and handling event access scenarios to ensure consistent behavior across endpoints.
Ensure that all event-related endpoints verify the presence of a valid authenticated user before proceeding. Raise a 401 Unauthorized error if authentication credentials are missing or invalid, enhancing the security of API routes.
Refactored the event API routes to improve error handling, add logging, and provide enhanced response structures with pagination. Updated tests to use new fixtures and include additional authentication utilities to facilitate testing with FastAPI's dependency injection. Also resolved issues with timezone awareness in event schemas.
Introduce methods to count user, public, and upcoming events to enhance CRUD functionality for events. Additionally, add a `PaginatedResponse` schema to simplify and standardize paginated API responses. These updates support improved data querying and response handling.
Introduced routes for event management, including CRUD operations and querying by user or public visibility. Updated event themes routes with operation IDs for better documentation. Refactored `api/main.py` to `api/router.py` and integrated events routing into the API.
This commit introduces a new CRUDEvent class to manage event-related database operations, including retrieval, creation, updating, and deletion of events. It includes corresponding unit tests to ensure the correctness of these functionalities, updates event schemas for enhanced validation, and refines timezone handling for event dates and deadlines.
Switch to timezone.utc for event date validation
Replaced ZoneInfo('UTC') with timezone.utc in event date validation to ensure consistency and compatibility with standard libraries. Simplifies datetime handling and avoids potential issues with external dependencies.
```
Introduce Pydantic models for event creation, updates, and responses, including validation for fields such as timezone, event date, and RSVP deadline. Add comprehensive pytest test cases to ensure correct behavior and data validation. This provides a robust foundation for event-related functionalities.
Renamed `event_theme` and `test_user_schema` file paths and imports to follow consistent plural naming conventions. This improves code clarity and aligns file and import naming across the project.
Introduces comprehensive tests for creating, listing, updating, and retrieving event themes. Includes scenarios with valid data, invalid data, and pagination to ensure robust API behavior. Adds necessary fixtures to support the new test cases.
Implemented API endpoints for creating, reading, updating, and listing event themes. Integrated the new routes into the FastAPI application router under the '/event_themes' prefix.
Updated the filename from `test_user_schemas.py` to `test_user_schema.py` to align with naming conventions. This ensures consistency across the test suite and improves maintainability.
Introduced extensive test cases to validate `EventTheme` schemas, ensuring proper handling of valid and invalid inputs, optional fields, and partial updates. Enhanced schema validation by adding constraints for `name`, `color_palette`, and `fonts` fields, as well as updating `id` to use `UUID` type for consistency. These changes improve data integrity and increase confidence in schema-related functionality.
Replaced raw database queries with CRUD operations for consistency and modularity. Enhanced error handling by adding detailed exception messages and logging for failed actions, such as authentication and registration. Updated tests to reflect new exception-based error handling approach.
Introduced CRUD implementation, schema definitions, and tests for EventTheme. This allows creation, retrieval, updating, deletion, and querying of active event themes. Comprehensive tests ensure functionality works as intended, including edge cases for nonexistent themes.
This commit adds the `operation_id` parameter to all relevant API endpoints in the `auth` routes. These identifiers enhance API documentation and make routes easier to distinguish in tools like Swagger or OpenAPI. No functionality is altered, but these additions improve clarity and maintainability.
Removed tests for missing `first_name` and `last_name` in `test_user` as database integrity constraints already ensure these validations. This reduces duplication and simplifies the test suite.
Introduced a script to create the initial superuser during app startup if none exists. Updated the entrypoint to call this script and added stricter logging for passlib. Adjusted .env.template for a stronger default superuser password.
Updated the schemas and models to make `last_name` optional and set a default value of "user" for `first_name`. This change enhances flexibility for user data handling and ensures proper defaults when values are not provided.
Implemented user CRUD operations including creation, retrieval, updating, and deletion through a generic CRUD base class. Enhanced user schemas with additional attributes and created tests to verify functionality, covering edge cases such as duplicates and pagination. Updated the test suite with new fixtures and methods to support the tests.
Implemented comprehensive authentication endpoints including user registration, login, token refresh, password change, and user info retrieval. Added extensive test cases for these endpoints to ensure functionality and error handling.
Eliminated redundant token-related schemas to simplify the codebase. These models were not actively utilized and their removal helps improve maintainability and reduce clutter in the project.
Improved phone number validation logic with stricter rules and better error messages in `UserBase`. Updated access token expiration to 1 day in config. Added extensive tests for phone number validation, including valid and invalid cases across different formats.
Moved `auth` module from `dependencies.py` to `dependencies/auth.py` for better organization. Added extensive unit tests for authentication services and API dependencies to ensure robust verification of users, tokens, and permissions.
Eliminated the `RevokedToken` model and associated logic for managing token revocation. Removed unused files, related tests, and outdated dependencies in authentication modules. Simplified token decoding, user validation, and dependency injection by streamlining the flow and enhancing maintainability.
Improved the `decode_token` function to clarify and extend error handling for token validation and decoding. Enhanced error messages for invalid tokens, added checks for missing claims, and ensured clear differentiation of failure scenarios. Updated imports and added a `scope` field to token response for completeness.
Improved the `decode_token` function to clarify and extend error handling for token validation and decoding. Enhanced error messages for invalid tokens, added checks for missing claims, and ensured clear differentiation of failure scenarios. Updated imports and added a `scope` field to token response for completeness.
This commit introduces a system to revoke tokens by storing their `jti` in a new `RevokedToken` model. It includes APIs for logging out (revoking a current token) and logging out from all devices (revoking all tokens). Additionally, token validation now checks revocation status during the decode process.
Cleaned up unused imports including `timezone` and `ExpiredSignatureError`. Streamlined the import structure to improve readability and maintainability. These changes do not affect functionality but enhance code clarity.
Adjusted `datetime.utcnow` to `datetime.now` for consistency and refactored token creation functions for cleaner structure. Removed duplicated `create_access_token` and `create_refresh_token` definitions by consolidating them into a single location.
Expanded exception handling to cover more specific JWT and JOSE-related errors, including signature verification failures and malformed tokens. This ensures better error messaging and robustness in token validation.
Updated `decode_token` for stricter validation of token claims and explicit error handling. Added utilities for token revocation and verification, improving
Introduced unit tests for `get_current_user`, `get_current_active_user`, and security functions like token creation and decoding. Also refactored imports for consistency and cleaned up unused or misplaced code to improve maintainability.
Introduces schemas for user management, token handling, and password hashing. Implements routes for user registration, login, token refresh, and user info retrieval. Sets up authentication dependencies and integrates the API router with the application.
MediaType and MediaPurpose have been added to the `__all__` exports in the `models` module. This ensures they are properly exposed for import and use throughout the application.
Enhanced test coverage includes `repr` methods, model functionality, and validation logic for key models like `GiftItem`, `GiftCategory`, `EventMedia`, `RSVP`, and `GiftPurchase`. Refactored and added fixtures to support comprehensive testing scenarios. Addresses validation for gift reordering and updates `EventMedia` representation format for consistency.
Introduced comprehensive unit tests for EmailTemplate and NotificationLog, including creation, field validation, and custom methods. Added relevant test fixtures to support these models and expanded `conftest.py` for reusability. Validates functionality and maintains model integrity.
Introduce a new pytest fixture for creating ActivityLog entries. Add comprehensive tests to verify ActivityLog creation and logging functionality, including user, event, and guest activities. Ensure proper test coverage for key methods and representations.