Commit Graph

63 Commits

Author SHA1 Message Date
Felipe Cardoso
290d91d395 Add MediaType and MediaPurpose to model exports
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.
2025-02-28 16:17:44 +01:00
Felipe Cardoso
1fd1144bc1 Add and extend test coverage for models and their methods
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
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.
2025-02-28 15:57:32 +01:00
Felipe Cardoso
c15c55d691 Add tests for EmailTemplate and NotificationLog models
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.
2025-02-28 15:16:23 +01:00
Felipe Cardoso
b8c7d63d91 Add ActivityLog fixtures and tests for logging activities
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.
2025-02-28 15:06:50 +01:00
Felipe Cardoso
d442182ed0 Add tests for Guest model and corresponding fixtures
Introduce unit tests for the Guest model covering properties, methods, and behaviors such as creation, status updates, and permissions. Add `guest_fixture` in `conftest.py` to streamline reusable test setup for Guest instances.
2025-02-28 15:01:13 +01:00
Felipe Cardoso
0bbd74ff50 Add tests and fixture for EventTheme model
Introduce a new pytest fixture for creating EventTheme instances and add comprehensive unit tests covering its properties, relationships, and behaviors. These changes improve test coverage and ensure the EventTheme model functions as expected.
2025-02-28 14:59:35 +01:00
Felipe Cardoso
97155f4b6b Add validation for display_order and EventMedia tests
Introduce a `validate_display_order` method to ensure a default value of 0 for `display_order`. Extend testing infrastructure with fixtures and unit tests for `EventMedia` to validate properties, metadata, and default behaviors.
2025-02-28 14:55:59 +01:00
Felipe Cardoso
841bb7f56d Add unit tests for RSVP model
This commit introduces comprehensive unit tests for the RSVP model, including creation, status updates, attendance checks, unique constraints, and dietary requirements handling. These tests ensure the RSVP model
2025-02-28 14:41:53 +01:00
Felipe Cardoso
38d5ac7c63 Add unit tests for GiftItem, GiftCategory, and GiftPurchase models
Introduced comprehensive test coverage for GiftItem, GiftCategory, and GiftPurchase models to validate core functionality such as creation, updates, deletions, and derived properties. Also updated the `total_gifts` method in `GiftCategory` to calculate the total requested quantity rather than the count of gifts.
2025-02-28 14:41:43 +01:00
Felipe Cardoso
712f1ddcb2 Add tests 2025-02-28 14:25:49 +01:00
Felipe Cardoso
180c4c2c09 Add tests for Event model and new mock_user fixture
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
Introduce comprehensive tests for the Event model, covering creation, updates, deletions, relationships, defaults, and constraints. Added the `mock_user` fixture to streamline user-related test setups and ensure proper linkage between users and events. Improves test coverage and ensures model behavior consistency.
2025-02-28 14:25:00 +01:00
Felipe Cardoso
82e0f192b1 Add pytest fixture for database session in tests
Introduce a `db_session` pytest fixture to provide a fresh SQLite in-memory database for each test function. This ensures isolated and consistent database state across tests by setting up and tearing down the database automatically.
2025-02-28 14:19:58 +01:00
Felipe Cardoso
1d51e2ad20 Add pytest fixture for database session in tests
Introduce a `db_session` pytest fixture to provide a fresh SQLite in-memory database for each test function. This ensures isolated and consistent database state across tests by setting up and tearing down the database automatically.
2025-02-28 14:19:39 +01:00
Felipe Cardoso
4155d9f8a6 Add comprehensive test cases for User 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
This commit introduces multiple test cases for the User model, covering creation, updating, deletion, unique constraints, required fields, default values, string representation, and handling of complex JSON preferences. These tests help ensure the model behaves as
2025-02-28 12:31:47 +01:00
Felipe Cardoso
5f9a63dd07 Refactor database module and add testing utilities
Simplify database module by re-organizing engine creation, session handling, and removing redundant methods. Introduce SQLite compatibility for testing and add a utility module for test database setup and teardown. Integrate initial unit tests for user models and update dependencies for security and testing.
2025-02-28 12:31:10 +01:00
Felipe Cardoso
5cd38c82e0 Refactor relationships in Event and User models
Clarify and fix relationship definitions by specifying foreign keys explicitly in User model. Add new relationships for gift categories and email templates to the Event model, and comment out unused EventUpdate relationship. These changes ensure better structure and future maintainability.
2025-02-28 12:30:25 +01:00
Felipe Cardoso
28656d6233 Refactor database handling and enhance connection management.
Introduced robust database connection configuration with PostgreSQL-specific tuning, connection pooling, and performance metrics logging. Added utility functions to manage database health checks, initialization, and cleanup at application lifecycle stages. Improved error handling with logging support for transactions and slow queries.
2025-02-28 11:22:42 +01:00
Felipe Cardoso
b3689fd6c4 Rename metadata fields for clarity and specificity
Updated `metadata` field names to `media_metadata` and `notification_metadata` in the eventspace ER schema. This improves clarity by providing more context-specific naming for better understanding and maintainability.
2025-02-28 09:58:50 +01:00
Felipe Cardoso
636e278db7 Rename metadata fields for clarity and specificity
Updated `metadata` field names to `media_metadata` and `notification_metadata` in the eventspace ER schema. This improves clarity by providing more context-specific naming for better understanding and maintainability.
2025-02-28 09:35:02 +01:00
Felipe Cardoso
fd676f850b Add initial models and database tables
All checks were successful
Build and Push Docker Images / changes (push) Successful in 5s
Build and Push Docker Images / build-backend (push) Successful in 47s
Build and Push Docker Images / build-frontend (push) Has been skipped
This migration introduces all initial database models and their respective tables, relationships, and constraints. It includes entities such as users, events, guests, themes, media, and various related entities to support application functionality. This serves as a foundational schema for the project.
2025-02-28 09:22:20 +01:00
Felipe Cardoso
a60eb045b4 Refactor Alembic setup and add migration helper script.
Updated Alembic configuration and folder structure to reference the `app` module. Introduced a new `migrate.py` script to manage migrations efficiently with commands for generating, applying, and inspecting migrations. Adjusted `env.py` to ensure proper model imports and use environment-driven database URLs.
2025-02-28 09:22:05 +01:00
Felipe Cardoso
dfeb10c351 Refactor config and database handling.
Move configuration logic to a more modular structure and enhance database URL generation using individual components from environment variables. Adjust database initialization to utilize the updated settings for improved maintainability and clarity.
2025-02-28 09:21:48 +01:00
Felipe Cardoso
632330b4ac Refactor models to improve consistency and relationships
Updated `Base` import to use centralized `app.core.database.Base` for consistency. Enhanced `TimestampMixin` and `UUIDMixin` with docstrings for clarity. Fixed metadata reference in `guest_gifts` table and added relationships in `email_template`.
2025-02-28 09:21:02 +01:00
Felipe Cardoso
a924e0d5b2 Add .env file support to docker-compose configurations
Added the `env_file` directive to both `docker-compose.yml` and `docker-compose.dev.yml` to load environment variables from a `.env` file. This ensures consistent environment variable management across different configurations.
2025-02-28 09:20:42 +01:00
Felipe Cardoso
c1caea44e8 ```
Rename metadata fields for clarity and fix imports.

Updated metadata-related field names across models to improve clarity and consistency (e.g., `metadata` to `media_metadata` and `notification_metadata`). Fixed an error in `guest_gifts` metadata reference and added a proper imports initialization in `__init__.py` for all models.
```
2025-02-28 08:34:49 +01:00
Felipe Cardoso
9d71fc7fcd Add models for EmailTemplate, ActivityLog, and NotificationLog
Introduced new database models to handle email templates, activity logs, and notification logs, including relevant enums and utilities. Updated ER diagram to reflect new relationships and attributes, enhancing event tracking and notification management capabilities.
2025-02-27 19:54:26 +01:00
Felipe Cardoso
7247190f5f Refactor event schema to enhance clarity and functionality
Updated attributes, relationships, and data types to improve schema accuracy and flexibility. Added new enums, foreign keys, and reordered fields for better organization. Renamed and adjusted components to reflect evolving business logic.
2025-02-27 19:12:47 +01:00
Felipe Cardoso
46fabc38a4 Add EventMedia and GiftCategory models
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 48s
Build and Push Docker Images / build-frontend (push) Has been skipped
Introduce EventMedia for managing media files linked to events, including file metadata, purpose, and relationships. Add GiftCategory to categorize gifts, featuring unique constraints, display options, and utility methods for handling related gifts.
2025-02-27 19:08:48 +01:00
Felipe Cardoso
e60a016ab1 Add RSVP model with status tracking and guest constraints
All checks were successful
Build and Push Docker Images / changes (push) Successful in 6s
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 RSVP model to manage responses for events, including status, guest count, and additional details like dietary requirements. Enforce uniqueness for each guest per event and provide functionality to update RSVP status. This will support efficient event RSVP handling and data integrity.
2025-02-27 18:45:08 +01:00
Felipe Cardoso
1d1452f716 Add RSVP model with status tracking and guest constraints
Introduce a new RSVP model to manage responses for events, including status, guest count, and additional details like dietary requirements. Enforce uniqueness for each guest per event and provide functionality to update RSVP status. This will support efficient event RSVP handling and data integrity.
2025-02-27 18:45:06 +01:00
Felipe Cardoso
2326767c54 Add Guest model for event guest management
This commit introduces the `Guest` model to manage event guests, including their details, status, RSVP tracking, and relationships with events and users. It also supports features like invitation handling, guest statuses, and guest-to-gift associations. This forms the foundation for handling guest-related functionalities in the backend.
2025-02-27 18:23:51 +01:00
Felipe Cardoso
20f9d89cd8 Add EventManager model with roles and permissions
Introduce the `EventManager` model to manage event roles and permissions. Roles include `OWNER`, `ADMIN`, `MODERATOR`, and `VIEWER`, each with specific default permissions. The model supports explicit permissions, relationships, constraints, and a helper method for initializing event owners.
2025-02-27 18:23:45 +01:00
Felipe Cardoso
ca399e5c68 Add Event and EventTheme models
Introduces models for events and their themes, including fields for event details, location, timing, and settings. The `EventTheme` model supports theme customization with color palettes and fonts, while establishing relationships with the `Event` model. These additions prepare the database for event-related functionality.
2025-02-27 18:14:47 +01:00
Felipe Cardoso
dcdfe8732c Add base and user models with essential fields and mixins
Created reusable `Base`, `UUIDMixin`, and `TimestampMixin` in `base.py`. Added a `User` model with attributes, relationships, and database configurations in `user.py` to establish a foundation for user-related features.
2025-02-27 18:14:38 +01:00
Felipe Cardoso
0a6918c85b Refactor ER diagram to add EventManager and update relations
Introduce the EventManager entity to improve role management, linking it between Users and Events. Adjust relationships among User, Event, and Guest, and refine EventTheme and User attributes. These changes enhance schema clarity and better represent user roles and permissions.
2025-02-27 18:10:08 +01:00
Felipe Cardoso
3ecf5fee2e Add ER diagram for EventSpace schema using Mermaid
This commit introduces a comprehensive Entity Relationship (ER) diagram for the EventSpace schema in Mermaid format. It documents key entities, their attributes, and relationships, providing a clear visualization of the database structure. This will aid in understanding and maintaining the data model.
2025-02-27 18:03:08 +01:00
Felipe Cardoso
1b2db7d5f4 Fix CI
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) Successful in 56s
2025-02-27 17:50:02 +01:00
Felipe Cardoso
4436977089 Fix CI
All checks were successful
Build and Push Docker Images / changes (push) Successful in 6s
Build and Push Docker Images / build-backend (push) Has been skipped
Build and Push Docker Images / build-frontend (push) Successful in 56s
2025-02-27 17:48:09 +01:00
Felipe Cardoso
97efa03c88 Fix CI
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-02-27 17:46:53 +01:00
Felipe Cardoso
7fbe5e56fb Test CI
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-frontend (push) Has been skipped
Build and Push Docker Images / build-backend (push) Has been skipped
2025-02-27 17:44:49 +01:00
Felipe Cardoso
7e31be49f4 Test CI
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Has been skipped
Build and Push Docker Images / build-frontend (push) Has been skipped
2025-02-27 17:44:27 +01:00
Felipe Cardoso
2cb86f072f Test CI
All checks were successful
Build and Push Docker Images / changes (push) Successful in 5s
Build and Push Docker Images / build-backend (push) Has been skipped
Build and Push Docker Images / build-frontend (push) Has been skipped
2025-02-27 17:42:22 +01:00
Felipe Cardoso
1d6cdca84f Test CI 2025-02-27 17:41:50 +01:00
Felipe Cardoso
ea71b17ce3 Test CI
All checks were successful
Build and Push Docker Images / changes (push) Successful in 5s
Build and Push Docker Images / build-backend (push) Has been skipped
Build and Push Docker Images / build-frontend (push) Has been skipped
2025-02-27 17:40:16 +01:00
Felipe Cardoso
f85e4a5c1f Test CI 2025-02-27 17:39:39 +01:00
Felipe Cardoso
2f0782e079 Test CI
All checks were successful
Build and Push Docker Images / changes (push) Successful in 3s
Build and Push Docker Images / build-backend (push) Has been skipped
Build and Push Docker Images / build-frontend (push) Has been skipped
2025-02-27 17:31:51 +01:00
Felipe Cardoso
bd5b03ca08 Test CI
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Has been skipped
Build and Push Docker Images / build-frontend (push) Has been skipped
2025-02-27 17:31:26 +01:00
Felipe Cardoso
7a0d6ca781 Test CI
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Has been skipped
Build and Push Docker Images / build-frontend (push) Has been skipped
2025-02-27 17:29:42 +01:00
Felipe Cardoso
4f0dd76436 Add conditional Docker builds for backend and frontend
Refactor workflow to build Docker images based on file changes. Introduce checks to determine if backend or frontend directories were modified. Optimize build processes and include support for manual triggers and version tagging.
2025-02-27 17:28:22 +01:00
Felipe Cardoso
58c360285f Set up container image for Docker-based CI workflow
All checks were successful
Build and Push Docker Images / build-and-push (push) Successful in 1m53s
Added a container image definition to use ghcr.io/catthehacker/ubuntu:act-latest in the build-and-push job. This enhances compatibility when running the workflow locally with act and ensures consistency in the execution environment. Corrected spacing in the secrets configuration for better code formatting.
2025-02-27 17:23:24 +01:00