129 Commits

Author SHA1 Message Date
Felipe Cardoso
44e6b2a6dc Refactor guest schema and add RSVP field to GuestBase.
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.
2025-03-19 20:47:12 +01:00
Felipe Cardoso
c81e27c602 Add event-specific guest gift reservations endpoint
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.
2025-03-19 19:56:10 +01:00
Felipe Cardoso
fe3f2b0894 Add API endpoint to retrieve all guest gift reservations
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.
2025-03-19 10:16:55 +01:00
Felipe Cardoso
79f08a1208 Add quantity column to GuestGifts table and update references
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.
2025-03-19 09:56:30 +01:00
Felipe Cardoso
cd22418786 Add event_id and guest_id fields to RSVPSchemaBase
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 47s
Build and Push Docker Images / build-frontend (push) Has been skipped
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.
2025-03-19 08:38:22 +01:00
Felipe Cardoso
1441843a55 Add cascading delete to Gift and Guest relationships
All checks were successful
Build and Push Docker Images / changes (push) Successful in 5s
Build and Push Docker Images / build-backend (push) Successful in 49s
Build and Push Docker Images / build-frontend (push) Has been skipped
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.
2025-03-19 08:16:38 +01:00
Felipe Cardoso
7d8eacad7a Update gift cancellation to include received status
All checks were successful
Build and Push Docker Images / changes (push) Successful in 5s
Build and Push Docker Images / build-backend (push) Successful in 49s
Build and Push Docker Images / build-frontend (push) Has been skipped
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.
2025-03-19 07:32:09 +01:00
Felipe Cardoso
7d0319462e Fix cors
All checks were successful
Build and Push Docker Images / changes (push) Successful in 6s
Build and Push Docker Images / build-backend (push) Successful in 49s
Build and Push Docker Images / build-frontend (push) Has been skipped
2025-03-17 12:19:37 +01:00
Felipe Cardoso
514ca7742e fix guest rsvp additional guests 2025-03-16 21:16:24 +01:00
Felipe Cardoso
fce2f32ffb fix guest rsvp additional guests
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 52s
Build and Push Docker Images / build-frontend (push) Has been skipped
2025-03-16 21:13:48 +01:00
Felipe Cardoso
d56a0d3baa fix reserve gifts endpoint 2025-03-16 21:07:56 +01:00
Felipe Cardoso
1a18347e93 Fix several problems with gift registry api 2025-03-16 20:23:52 +01:00
Felipe Cardoso
54fbed2816 Fix crud query for guests reservations 2025-03-16 20:13:51 +01:00
Felipe Cardoso
878d2e8c45 Fix auth dependencies 2025-03-16 19:54:58 +01:00
Felipe Cardoso
16b6269d05 Add default categories to init_db.py 2025-03-16 17:36:16 +01:00
Felipe Cardoso
88c9e634de Add quantity in reserve_gift_item endpoint 2025-03-16 16:33:17 +01:00
Felipe Cardoso
29ba036094 Add operation ids for gift route 2025-03-16 15:45:09 +01:00
Felipe Cardoso
19f3534f22 Additional fixes for gift models 2025-03-16 15:33:17 +01:00
Felipe Cardoso
b5f1c7ddcb Fixe (partially) gift tests and api 2025-03-16 15:07:31 +01:00
Felipe Cardoso
4ef202cc5a Big refactor of gift categories model
All checks were successful
Build and Push Docker Images / changes (push) Successful in 5s
Build and Push Docker Images / build-backend (push) Successful in 52s
Build and Push Docker Images / build-frontend (push) Has been skipped
2025-03-16 14:51:04 +01:00
Felipe Cardoso
ed017a42ed Add for gifts: schema, crud, route, tests
All checks were successful
Build and Push Docker Images / changes (push) Successful in 5s
Build and Push Docker Images / build-backend (push) Successful in 51s
Build and Push Docker Images / build-frontend (push) Has been skipped
2025-03-16 14:23:28 +01:00
Felipe Cardoso
f3b5192e4d Update server with new guest rsvp endpoint 2025-03-16 12:06:52 +01:00
Felipe Cardoso
4e66b22bae Set default guest permissions to allow bringing up to 10 guests.
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.
2025-03-16 09:45:37 +01:00
Felipe Cardoso
3c196b1e91 Add invitation code validation and auto-generation for guests
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 50s
Build and Push Docker Images / build-frontend (push) Has been skipped
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.
2025-03-15 20:34:38 +01:00
Felipe Cardoso
85eed0eac0 Add RSVP routes and integrate with events API router
Some checks failed
Build and Push Docker Images / build-frontend (push) Blocked by required conditions
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Has been cancelled
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.
2025-03-15 02:25:32 +01:00
Felipe Cardoso
632a762d64 Add CRUD and schema for RSVP management
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.
2025-03-15 02:20:36 +01:00
Felipe Cardoso
270bfda1f8 Add guests API with CRUD operations and tests
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 50s
Build and Push Docker Images / build-frontend (push) Has been skipped
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.
2025-03-15 02:09:17 +01:00
Felipe Cardoso
12161e048d Refactor tests and fix patch imports in event themes tests
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.
2025-03-15 01:29:39 +01:00
Felipe Cardoso
fee7d8b5ec Refactor CRUD module imports and usage for clarity.
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.
2025-03-15 01:22:04 +01:00
Felipe Cardoso
b18f684afb Fix incorrect timezone assignment in event_date validator
Updated the validation logic to correctly replace the timezone for `event_date`. This ensures proper handling of datetime objects without tzinfo.
2025-03-14 03:09:31 +01:00
Felipe Cardoso
e50fca4e77 Fix timezone handling for RSVP deadline validation
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.
2025-03-14 03:02:51 +01:00
Felipe Cardoso
41eb631a5e Remove leading slash from 'uploads/' checks in theme URLs
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.
2025-03-14 02:23:44 +01:00
Felipe Cardoso
d2e71feb69 Refactor file relocation logic for theme-specific files.
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 49s
Build and Push Docker Images / build-frontend (push) Has been skipped
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.
2025-03-14 02:22:21 +01:00
Felipe Cardoso
ffdf095eee Refactor file URL handling to use relative paths.
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.
2025-03-14 01:16:50 +01:00
Felipe Cardoso
b47dbaeb0b Refactor file upload to use SDK instead of XMLHttpRequest
Some checks failed
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 50s
Build and Push Docker Images / build-frontend (push) Failing after 47s
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.
2025-03-14 00:05:26 +01:00
Felipe Cardoso
0cf5498762 Refactor storage URL retrieval to use get_uploaded_file_url.
Some checks failed
Build and Push Docker Images / build-frontend (push) Blocked by required conditions
Build and Push Docker Images / changes (push) Successful in 3s
Build and Push Docker Images / build-backend (push) Has been cancelled
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.
2025-03-14 00:05:07 +01:00
Felipe Cardoso
b46533b18f Add operation_id to upload endpoints for improved OpenAPI docs
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.
2025-03-13 07:51:13 +01:00
Felipe Cardoso
03f643895d Add comprehensive test cases for theme creation API
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 50s
Build and Push Docker Images / build-frontend (push) Has been skipped
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.
2025-03-13 07:32:22 +01:00
Felipe Cardoso
0eabd9e5dd Refactor theme creation and update for file management
All checks were successful
Build and Push Docker Images / changes (push) Successful in 5s
Build and Push Docker Images / build-backend (push) Successful in 52s
Build and Push Docker Images / build-frontend (push) Has been skipped
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.
2025-03-12 21:16:49 +01:00
Felipe Cardoso
9fdf8971e3 Add function to relocate theme files in storage
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.
2025-03-12 21:16:42 +01:00
Felipe Cardoso
2993d0942c Add presigned URL and file upload functionality
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 51s
Build and Push Docker Images / build-frontend (push) Has been skipped
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.
2025-03-12 18:59:39 +01:00
Felipe Cardoso
e50fdb66df Add schemas for presigned URL requests and responses
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.
2025-03-12 18:59:27 +01:00
Felipe Cardoso
00c5af9cc6 Add file utility functions for filename and path handling
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.
2025-03-12 18:59:22 +01:00
Felipe Cardoso
38acdb78a1 Add storage utilities and tests for file handling and tokens
All checks were successful
Build and Push Docker Images / changes (push) Successful in 5s
Build and Push Docker Images / build-backend (push) Successful in 51s
Build and Push Docker Images / build-frontend (push) Has been skipped
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.
2025-03-12 18:50:30 +01:00
Felipe Cardoso
9879353ac1 Refactor storage to rename base_dir to upload_folder.
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.
2025-03-12 18:37:16 +01:00
Felipe Cardoso
095aa1e7da Add local storage provider implementation
Introduce an abstract `StorageProvider` class and a
2025-03-12 18:35:51 +01:00
Felipe Cardoso
07f8435fcd Add utility functions for creating and verifying upload tokens
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.
2025-03-12 18:35:47 +01:00
Felipe Cardoso
e27e2b75ee Update config structure and enhance file handling
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`.
2025-03-12 18:35:42 +01:00
Felipe Cardoso
5ad886a53e Add support for serving static files from DATA_FILES_DIR
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 53s
Build and Push Docker Images / build-frontend (push) Has been skipped
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.
2025-03-12 18:23:42 +01:00
Felipe Cardoso
288e09202d Add background and foreground image URLs to event themes
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 50s
Build and Push Docker Images / build-frontend (push) Has been skipped
Extended the event theme schema to include `background_image_url`
2025-03-12 16:20:12 +01:00