Commit Graph

125 Commits

Author SHA1 Message Date
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
Felipe Cardoso
efb1dfd2a4 Add new fields to event theme model for asset handling
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
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.
2025-03-12 16:14:07 +01:00
Felipe Cardoso
4b01d6f58f Add delete functionality for 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
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.
2025-03-12 15:21:47 +01:00
Felipe Cardoso
525d1b8012 Add is_active field to EventTheme model and test fixture.
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.
2025-03-12 15:21:28 +01:00
Felipe Cardoso
f245145087 Refactor event retrieval and improve test coverage
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
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.
2025-03-11 06:47:58 +01:00