* feat: add subscription relation to customer schema and new subscription-related interfaces
- Introduced a one-to-one relation for 'subscription' in the customer schema to link customers with their subscriptions.
- Added new TypeScript interfaces for subscription-related entities, including Subscription, SubscriptionHistory, SubscriptionPrice, and SubscriptionSetting, ensuring type safety and consistency across the application.
* refactor: remove unused fields from subscription schema and TypeScript definitions
- Deleted the 'referralCode', 'subscription', 'referralCount', and 'referredBy' fields from the subscription schema to streamline the data model.
- Updated TypeScript definitions to reflect these changes, ensuring type safety and consistency across the application.
* feat: add 'days' field to subscription price schema and update TypeScript definitions
- Introduced a new 'days' integer field in the subscription price schema, marked as required to enhance subscription duration tracking.
- Removed unused 'description', 'trialPeriodDays', and 'trialEnabled' fields from the subscription setting schema to streamline the data model.
- Updated TypeScript definitions to reflect these changes, ensuring type safety and consistency across the application.
* refactor: rename relation fields in customer schema and update TypeScript definitions
- Changed 'clients' to 'invited' and 'masters' to 'invitedBy' in the customer schema to better reflect their purpose in the data model.
- Updated TypeScript definitions to include the new relation fields, ensuring type safety and consistency across the application.
* feat: add subscription_rewards relation to customer and subscription history schemas, and update TypeScript definitions
- Introduced a new 'subscription_rewards' relation in both the customer and subscription history schemas to link them with subscription rewards.
- Updated the 'expiresAt' field in the subscription schema to be required, ensuring better data integrity.
- Adjusted the default value for 'maxOrdersPerMonth' in the subscription setting schema from 30 to 20, and removed unused fields to streamline the model.
- Updated TypeScript definitions to reflect these changes, ensuring type safety and consistency across the application.
* SubscriptionPrice: rename price -> amount
* refactor: remove block-related schemas, controllers, routes, and services
- Deleted the block schema, controller, routes, and services to streamline the API structure.
- Updated customer and order schemas to remove references to the block relation, ensuring data integrity and clarity.
- Adjusted TypeScript definitions to reflect the removal of block-related entities, maintaining type safety across the application.
* SubscriptionHistory: change type to string
* add new entity customer_setting
* subscription settings: add field proEnabled
- Introduced a new 'bannedUntil' datetime field in the customer schema to track when a customer is banned until.
- Updated TypeScript definitions to include the new 'bannedUntil' attribute, ensuring type safety and consistency across the application.
- Updated the Telegram notification message to display the total cost of services associated with an order, improving transparency for clients and masters.
- Added logic to calculate the total price based on individual service prices and formatted the price for better readability.
- Introduced new fields 'price' and 'description' in the service schema to enhance service details.
- Updated TypeScript definitions to include these new attributes, ensuring type safety and consistency across the application.
- Modified the notification message format to include a list of all services associated with an order instead of just the first service. This change enhances clarity for both clients and masters by providing comprehensive service details in notifications.
- Changed the Docker image reference in docker-compose.yml to use dynamic environment variables for better flexibility.
- Updated the GitHub Actions workflow to set the image tag based on the commit SHA, ensuring unique tagging for each build.
- Added environment variable definitions for Docker Hub credentials and image tag in the deployment process.
* refactor: consolidate order lifecycle validation logic and remove slot lifecycle
- Streamlined the order lifecycle by consolidating validation logic and removing redundant error handling.
- Deleted the slot lifecycle file to simplify the codebase, as its functionality is no longer needed.
- This change enhances maintainability and reduces complexity in the order management system.
* feat: enhance Telegram notification heading for order updates
- Updated the heading emoji logic to display a checkered flag for completed orders and a pencil for updates, improving clarity in notifications.
- Added specific handling for completed records in the notification heading to differentiate between updated and completed statuses.
- Implemented a check in both order and slot lifecycles to skip validation if the record is being updated, identified by the presence of the 'publishedAt' field. This change prevents unnecessary validation for existing records.
- Temporarily disabled the beforeDelete method to prevent slot deletion checks related to existing orders. This change is intended for further review and potential reimplementation.
- Introduced a new error message for attempts to create orders with a start time in the past.
- Implemented a check in the order lifecycle to validate that the order start time is not before the current time.
- Added maxLength constraints to 'name' and 'phone' attributes in customer and service schemas.
- Marked 'name' as required in both schemas.
- Updated TypeScript definitions to reflect these changes.
- Added Telegraf dependency to handle Telegram bot interactions.
- Updated order lifecycle methods to send notifications upon order creation and updates.
- Refactored datetime handling to use a consistent timezone.
- Removed unused utility functions to streamline codebase.
* feat: refactor order and slot lifecycles to use datetime fields for time validation
* refactor: remove time fields from order and slot schemas to streamline data structure
* fix: correct time validation logic in order and slot lifecycles to ensure proper datetime comparisons
* fix: update order lifecycle validation to exclude only 'cancelled' state
* fix: add validation to ensure order times fall within the specified slot boundaries
* feat: integrate dayjs for improved datetime handling in order lifecycles
Нельзя завершить запись до её наступления
* fix: enhance datetime validation in order and slot lifecycles to ensure accurate comparisons
* fix: standardize error messages in order and slot lifecycles for better clarity