Commit graph

1004 commits

Author SHA1 Message Date
0cb4ae42a4 Add support for search results for posts
Extended the search functionality to include results for posts. Updated `SearchResultsType` and related types to handle `posts`, adding a new `SearchPostsResultsType` with `uuid`, `name`, and `slug`. Adjusted mutations to populate posts in the search response.
2025-05-07 15:57:10 +03:00
80e1b0335b "Enhance product filtering and permissions handling
Ensure inactive products without stock are excluded from queries by updating the filter. Add 'buy_unregistered' action to permissions for better access control."
2025-05-07 15:07:48 +03:00
50fe95e713 Remove unused filters from admin panel configuration
This change eliminates redundant filters like "category", "attributes__attribute", and "brand" from the admin panel. This helps simplify the interface and improve usability.
2025-05-07 10:52:22 +03:00
e1f54304b6 Refactor error handling in auto_resolve methods.
Replaced context manager suppress(KeyError) with try-except blocks to handle both KeyError and IndexError in auto_resolve_category and auto_resolve_brand methods. This improves clarity and ensures proper handling of potential IndexError cases.
2025-05-07 10:40:40 +03:00
7f9f2d66f3 Ignore database backup files in .gitignore
Added `db_backups` to the `.gitignore` file to prevent accidental inclusion of backup files in version control. This helps maintain a cleaner repository and avoids potential security risks.
2025-05-07 09:49:21 +03:00
d1cd8515b5 Set console production log level to WARNING.
Updated the log level from INFO to WARNING in the console production handler. This change aims to reduce log noise and surface only warnings and errors in production environments.
2025-05-07 04:57:18 +03:00
4d63bde7a3 Refactor attribute retrieval logic in detail serializer.
Simplify the conditional logic for fetching attributes based on user permissions. This improves code readability and maintains the same functionality.
2025-05-07 04:40:44 +03:00
6c04faf97b Simplify Celery command formatting in docker-compose.yml
Consolidate the Celery worker command into a single line for improved readability and maintainability. This change reduces unnecessary line breaks without altering functionality.
2025-05-07 04:12:35 +03:00
1db400be6f Refactor celery command formatting in docker-compose.yml
Updated the Celery worker command in docker-compose.yml for better readability and consistency using line continuation characters. Ensured no functional changes were introduced during the formatting update.
2025-05-07 04:08:36 +03:00
5537830592 Update Dockerfile to configure PostgreSQL repository and client
Replaced Debian's PostgreSQL client with version 17 and added the PostgreSQL apt repository for more control over versions. Switched from `apt` to `apt-get` for consistency, and included necessary dependencies like `wget` and `gnupg` for repository setup.
2025-05-07 03:57:15 +03:00
5295948b8c Add postgresql-client to Dockerfile dependencies
The addition of `postgresql-client` ensures tools relying on PostgreSQL are available within the container. This change improves compatibility with PostgreSQL-based workflows and resolves potential missing dependencies.
2025-05-07 03:20:30 +03:00
87e124f614 Handle errors in vendor stock updates and inactive vendors
Add error handling during the stock update process to log and skip problematic vendors without halting execution. Additionally, ensure `get_vendor_instance` only returns active vendors, raising an error if the vendor is inactive. This improves system resilience and data integrity.
2025-05-07 03:15:23 +03:00
6e19d9f65f Add new dependencies and standardize file formatting
Added `paramiko`, `django-dbbackup`, `django-storages`, and `bcrypt` to the dependency list in `pyproject.toml`. Reformatted file entries in `poetry.lock` to ensure consistent alignment with style guidelines, improving readability and maintainability.
2025-05-07 03:10:50 +03:00
5aca04cf55 Reorder imports in core/vendors/__init__.py
Adjusted the import order in compliance with PEP 8 guidelines. This helps improve code readability and maintain consistency across the codebase.
2025-05-07 02:41:41 +03:00
5d007c07a2 Add auto_resolve_brand method to handle brand resolution
Introduced a new static method, auto_resolve_brand, to simplify and automate the resolution or creation of Brand objects based on a given brand name. Updated imports in core/vendors/__init__.py to include the Brand model. This enhances the system's ability to process brands effectively.
2025-05-07 02:40:23 +03:00
70cf2c23a1 Add auto_resolve_category method to vendor logic
Introduced the auto_resolve_category method to streamline category resolution using Elasticsearch. This enhances category lookup efficiency and ensures seamless creation or retrieval of categories when necessary.
2025-05-07 02:38:28 +03:00
0e86c96ad3 Set default value for is_composite_pk in admin config
Added an `is_composite_pk` attribute with a default value of `False` to the admin configuration. This ensures clarity in object definition and supports better configurability for composite primary key scenarios.
2025-05-06 19:26:47 +03:00
12ccd04943 Update API version to 2.6.0 and reformat migration files
Updated the API version from 2.5.0 to 2.6.0 in the DRF settings for consistency across configurations. Reformatted migration files for better readability, ensuring consistency in code style and improving maintainability. These changes do not alter functionality but enhance clarity and documentation.
2025-05-06 19:19:49 +03:00
7d6eb8a27a Refine API key validation in task configuration.
Previously, an "example key" could mistakenly pass the check, leading to potential misuse. This update ensures features are disabled if the API key is invalid or set to default.
2025-05-06 17:57:35 +03:00
ce66513488 Refactor email sending to use reusable connections
Updated email sending logic across multiple modules to utilize `django.core.mail.get_connection` for better email connection management and efficiency. Adjusted filters in `conditions.py` to correctly handle dictionary inputs when checking attribute lengths.
2025-05-06 17:44:55 +03:00
6fd0a48c0c Handle IntegrityError when creating orders.
Added logic to handle IntegrityError by generating unique human-readable IDs for orders during creation. This ensures no duplicate order entries are created in case of integrity constraints.
2025-05-06 17:35:35 +03:00
3e53224092 Add support for human_readable_id in filters and models
Added a `human_readable_id` filter to the `OrderFilter` class and enabled ordering by this field. Updated the `create_customer_payload` method to include the `is_business` attribute, ensuring compatibility with new functionality.
2025-05-06 17:29:02 +03:00
65812190a2 Fix is_business property to handle missing attributes
Previously, the method could raise an error if `attributes` was None. This update ensures the method returns `False` when `attributes` is not defined, preventing potential runtime issues.
2025-05-06 17:22:48 +03:00
4f322456e9 Fix order sorting by changing ordering field to UUID
Previously, orders with duplicate `human_readable_id` were sorted by `id`, which could lead to inconsistencies. Updated the code to sort by `uuid` to ensure a more reliable and unique ordering. This prevents potential issues when resolving duplicate entries.
2025-05-06 17:18:57 +03:00
ef2830d36a Fix duplicate detection by using UUID in migration script
The migration script now counts duplicates based on the "uuid" field instead of "id". This ensures more accurate identification of duplicate "human_readable_id" entries.
2025-05-06 17:16:52 +03:00
146bbc3539 Fix duplicate human_readable_id values in Order model
This migration resolves duplicate human_readable_id values by assigning unique IDs where necessary. A data migration script is introduced to identify and fix duplicates before altering the field.
2025-05-06 17:13:33 +03:00
ca60bf09a6 Increase max_length of human_readable_id to 8.
Updated the `human_readable_id` field in the `Order` model to support a maximum length of 8 instead of 6. Removed the redundant migration file `0019_alter_order_human_readable_id.py` for cleanup.
2025-05-06 17:06:39 +03:00
dc9effdd5b Update human_readable_id field in Order model
Alter the `human_readable_id` field to use a custom generator function and ensure uniqueness. This improves the readability and integrity of order identifiers.
2025-05-06 17:04:29 +03:00
4deece673f Increase max_length of human_readable_id to 8.
Updated the field definition of `human_readable_id` to allow up to 8 characters instead of 6. This change accommodates longer identifiers as required for recent updates.
2025-05-06 17:01:55 +03:00
0c1caa422c Add human-readable ID field to Order model
Introduced a `human_readable_id` field to the Order model to provide a concise and recognizable identifier, initialized with a default generator. Updated the field to enforce uniqueness to ensure consistent identification across orders.
2025-05-06 16:58:44 +03:00
131258517f Adjust Celery task time limits in configuration.
Increased `task_soft_time_limit` to 7200 seconds and `task_time_limit` to 10800 seconds in both `celery.py` and `docker-compose.yml`. This change allows longer-running tasks to complete without premature termination.
2025-05-06 16:39:21 +03:00
ef553a94a4 Refactor Elasticsearch documents for efficiency and clarity
Simplified field definitions and improved code consistency by consolidating and aligning styles. Added `prepare_*` methods to gracefully handle None values for fields. Enhanced multilingual support and streamlined query construction for better maintainability.
2025-05-06 15:32:55 +03:00
64a2fe7726 Increase Celery task time limits.
Updated `task_soft_time_limit` to 3600 seconds and `task_time_limit` to 7200 seconds in both `celery.py` and `docker-compose.yml`. This allows tasks to run longer before being terminated, ensuring support for extended processing requirements.
2025-05-06 14:58:39 +03:00
d87e93e705 Update docker-compose to include Elasticsearch dependencies
Added Elasticsearch as a dependency for 'app' and 'database' services to ensure proper startup order. Removed unnecessary Redis dependency from the Flower service to streamline configuration. These changes improve service interactions and startup stability.
2025-05-06 14:47:47 +03:00
3f94933017 Add core.b2b_urls to B2B URL routing
Included the core.b2b_urls module in the main B2B URL patterns to organize and modularize URL configurations. This change enhances code maintainability and improves routing logic clarity.
2025-05-06 04:14:04 +03:00
5012727e84 Refactor DRF settings and fix schema configurations
Updated DRF settings with new TOS URL and version for consistency. Corrected API URLs in B2B schema and reorganized imports in core views for better readability. These changes ensure accurate references and maintain cleaner code structure.
2025-05-06 03:48:59 +03:00
76d490f2e2 Refactor translation command and improve order model.
Enhanced the `deepl_translate` management command with improved placeholder handling, error messages, and support for missing translations. Added `human_readable_id` and `is_business` attributes to the `Order` model, updating associated admin configurations to reflect these changes.
2025-05-06 03:28:06 +03:00
85a49c4e8b Add "DISABLED_COMMERCE" feature to disable buying functionality
Introduce a global config flag `DISABLED_COMMERCE` to toggle buy functionality availability. Raise specific `DisabledCommerceError` when buying is disabled, ensuring end-users are informed. Additionally, reformat code for readability and consistency, improving overall maintainability.
2025-05-05 17:32:57 +03:00
96c3fe23b0 Update promotion handling and logging levels
Change promotions to inactive instead of deleting them to maintain data integrity. Adjust Celery logging levels to be DEBUG/INFO based on the DEBUG setting, improving log granularity during development and clarity in production.
2025-05-05 17:16:57 +03:00
4e04caf91d Update Product slug generation to include UUID
The migration alters the `slug` field to include `uuid` in its `populate_from` attributes. This ensures more robust and unique slug generation, improving data integrity and avoiding potential collisions.
2025-05-05 15:56:21 +03:00
4bd037b828 Update middleware to validate hosts and conditionally log errors
Replaced hardcoded host checks with a dynamic check using `ALLOWED_HOSTS` from environment variables. Adjusted exception logging to include tracebacks only when the `DEBUG` environment variable is enabled.
2025-05-05 15:49:20 +03:00
04a89be549 Update Celery settings and worker configuration
Refactored Celery configurations to enhance task reliability, including changes to prefetch multiplier and timeout settings. Updated the worker command in `docker-compose.yml` to specify concurrency, memory limits, and task timeouts. Added a memory limit for the worker service to improve resource management.
2025-05-05 15:28:20 +03:00
8f55bece81 Add slug generation and extend search results handling
Introduced slug creation using `slugify` for improved usability in search results. Extended the search results structure to include a new "posts" category alongside "products", "categories", and "brands". This enhances the flexibility and scope of the search functionality.
2025-04-30 19:24:26 +03:00
b4ef65314d Update query logic to fix invalid method chaining
Removed invalid `select_related` and `prefetch_related` chaining on the product query. This resolves potential errors in fetching related data and ensures proper functionality.
2025-04-30 17:08:43 +03:00
b924797869 Update Product slug field to use simpler populate_from sources
Revised the `populate_from` argument of the Product model's `slug` field to use only `category__name` and `name` for generation. This simplifies the slug creation logic and aligns with the updated migration `0015_alter_product_slug`.
2025-04-30 17:03:53 +03:00
3caab8f523 Add management command to populate Product slugs
Introduce a Django management command to populate the `slug` field for Product instances where it is null. The command processes products in batches, handles errors gracefully, and logs issues for troubleshooting.
2025-04-30 16:58:57 +03:00
e41ac426f4 Alter Product slug field to allow null values
Changed the `slug` field in the `Product` model to allow null values by setting `null=True`. This ensures better flexibility when handling cases where a slug might not be immediately available.
2025-04-30 16:49:54 +03:00
2c8c8ba291 Update Product slug field configuration in migrations
Made the `slug` field nullable in migration 0013 before reverting this change in migration 0014. Additionally, altered the population logic to always include `uuid`.
2025-04-30 16:46:58 +03:00
f2e319f477 Update product slug field to include UUID in generation logic
This change modifies the `slug` field in the `Product` model to also populate from the `UUID` field, ensuring enhanced uniqueness and consistency. The migration file is included to apply this change to the database schema.
2025-04-30 16:42:42 +03:00
d4928db393 Set slug field to allow null values
The slug field in the model now permits null values by adding `null=True`. This change enhances flexibility in scenarios where slugs may not always be mandatory.
2025-04-30 16:39:28 +03:00