Reorganized imports for better readability and compliance with standards. Added an optional `rsvp` field to the `GuestBase` model to include RSVP details. This enhances the schema's flexibility and supports additional guest-related data.
Introduced a function `get_event_guest_gift_reservations` in the CRUD layer to fetch gift reservations filtered by event ID. Updated the API endpoint to optionally accept an `event_id` query parameter for retrieving reservations specific to an event.
Introduced a new route to fetch all guest gift reservations, ensuring API compatibility with GiftPurchase objects. Refactored CRUD functions to optimize data fetching and avoid N+1 queries. Added validation to restrict access to non-public event-related reservations.
Introduced a `quantity` field to track the number of reserved gifts in the many-to-many GuestGifts table. Updated all related CRUD operations, models, and imports to reflect the added column. Replaced `guest_gifts` with `GuestGifts` for consistency in naming conventions.
This update introduces event_id and guest_id fields to the RSVPSchemaBase model, ensuring better tracking of RSVP details. These additions enhance data association and model usability.
Updated the `ondelete="CASCADE"` behavior for foreign key constraints in Alembic migrations and added cascading rules to related models in SQLAlchemy. These changes ensure proper cleanup of dependent records when a parent record is deleted.
Allow cancellation of gifts with a status of either RESERVED or RECEIVED. This ensures consistency in handling gift statuses during reservation management across the application.
Updated guest schema and database models to increase the default value for `max_additional_guests` from 0 to 10 and enable `can_bring_guests` by default. This ensures new guests can bring additional attendees without manual configuration.
Validate uniqueness of invitation codes during guest creation to prevent duplicates. Automatically generate an 8-character code if none is provided, ensuring consistent data handling. Updated tests and schemas to support these changes.
This commit introduces a new RSVP module with endpoints for creating, reading, updating, and deleting RSVPs, along with a custom status update endpoint. The router is integrated into the events API, providing full RSVP management capabilities. Validation and error handling have been implemented to ensure data consistency.
Introduce CRUD operations and Pydantic schemas to manage RSVP entries, including creation, updates, retrieval, and deletion. This enables comprehensive handling of RSVP data with validation and support for guest and event IDs.
Introduce a new API for managing event guests, including endpoints for creating, reading, updating, deleting, and changing guest status. Added corresponding Pydantic schemas, database CRUD logic, and extensive test coverage to validate functionality. Integrated the guests API under the events router.
Updated `@patch` targets to match their correct import paths and adjusted imports for clarity and consistency. Fixed indentation issues and resolved minor import ordering problems to improve code readability.
Replaces ambiguous shorthand references like `event` and `user` with more descriptive names such as `event_crud` and `user_crud`. Updates imports, function calls, tests, and other references across the codebase to maintain consistency. This improves code readability and reduces potential confusion.
Updated the RSVP deadline validation to automatically assign UTC as the timezone if none is provided, ensuring consistency. This prevents errors and enforces proper timezone-aware datetime usage.
Updated conditions to check 'uploads/' without a leading slash across preview, background, foreground, and asset image URLs. This ensures consistent handling of URLs during the relocation process and avoids potential mismatches in the path string comparison.
Updated the file relocation function to use `settings.DATA_FILES_DIR` for theme folders and improved filename handling by prefixing with the file type. Adjusted logic to handle URLs consistently and ensure paths are properly resolved. This enhances maintainability and organizes theme files more effectively.
Updated file URL generation to return relative paths instead of absolute paths, ensuring better portability and consistency. Adjusted relevant methods to compute paths relative to the base directory.
Replaced manual XMLHttpRequest implementation with the SDK's `uploadFile` method for handling file uploads to presigned URLs. This simplifies the code, leverages built-in features like progress tracking, and improves error handling. Added token extraction and upload progress updates to maintain functionality.
Replaced calls to get_file_url with get_uploaded_file_url where appropriate. Added the get_uploaded_file_url method to the StorageProvider class and its implementations for more specific URL generation. Updated corresponding tests and API routes to reflect this change.
The `operation_id` field was added to the `generate_presigned_url` and `upload_file` endpoints. This enhances the OpenAPI documentation by providing unique identifiers for better API clarity and client generation.
Implemented various tests to validate the theme creation process, including tests for successful creation, validation failures, image relocation, large data handling, and error scenarios such as database issues. Introduced mock dependencies to simulate behaviors like file relocation and database operations. Ensured all edge cases are covered to improve robustness and reliability.
Enhanced theme creation and update logic to include proper file organization by relocating and managing URLs for images and assets. Introduced roles validation to restrict access to superusers for these operations. Updated tests to align with the refactored logic and dependencies.
Introduce `_relocate_theme_file` to handle moving files to theme-specific directories in the storage system. This ensures better organization of uploaded files by associating them with a theme ID and file type, improving maintainability and structure.
Implemented endpoints for generating presigned URLs and handling file uploads. Added corresponding test cases to ensure proper functionality and error handling. Updated the main router to include the new uploads API.
Introduced two Pydantic models: `PresignedUrlRequest` and `PresignedUrlResponse`. These define the request and response structures for presigned URL generation, including fields for filenames, content types, and expiration details. This provides a clear contract for handling presigned URL functionality.
Introduce helper functions to generate unique filenames, create date-based storage paths, and validate image content types. These utilities centralize and streamline file-related operations for consistency and reusability.
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.