- Added a mock for `updateDraftStockAuditCurrents` in the stock quantity recalculation test suite to ensure proper integration with stock audit processes.
- Reset the mock state for `updateDraftStockAuditCurrents` in the `beforeEach` hook to maintain test isolation and reliability.
- Updated the test setup to resolve the mock function, improving the accuracy of test outcomes related to stock quantity recalculations.
- Removed the `toStockLocation` field from the `stockTransferLineSchema` to streamline the schema.
- Introduced `fromLocation` and `toLocation` fields in the `stockTransferSchema` for better clarity in stock transfer processes.
- Updated the text index to focus on `state.type` for improved search capabilities.
- Added `stockAuditLevelModel` and its schema to manage stock audit levels, including normalization functions for audit lines.
- Updated `filamentStock`, `partStock`, and `productStock` schemas to integrate stock audit calculations, ensuring accurate stock quantity tracking.
- Introduced a `recalculate` method in the stock audit schema to handle stock quantity updates based on audit levels.
- Removed the obsolete `stockEvent` schema to streamline inventory management.
- Enhanced existing schemas with new fields and methods for improved inventory auditing and reporting capabilities.
- Implemented `subscribeToAllObjectUpdates` and `unsubscribeAllObjectUpdates` methods in the `UpdateManager` to handle bulk updates for object types.
- Updated `SocketHost` and `SocketUser` classes to listen for new socket events related to all object updates.
- Enhanced test coverage for the new subscription methods to ensure correct functionality and integration with the socket client.
- Removed unused fields from the deviceInfo schema, including uptime, memory, and network properties, to streamline the schema.
- Updated the deviceInfo reference in the host schema for improved clarity and consistency.
- Removed unnecessary console logging in the `SocketUser` class for cleaner output.
- Updated the `distributeNew` function to accept the entire object instead of just the ID, improving flexibility in handling new entries.
- Enhanced the `newAuditLog` and `editAuditLog` functions to filter out excluded models and changes, ensuring sensitive data is not logged.
- Introduced new utility functions for omitting specific paths and excluded changes from audit logs, enhancing data privacy and integrity.
- Added new rollup configurations to the `invoice`, `taxrecord`, `orderitem`, `purchaseorder`, `shipment`, and `salesorder` schemas to improve financial reporting and inventory management.
- Introduced aggregate functions for calculating totals and counts based on various states, enhancing data analysis capabilities across the application.
- Added `syncHash`, `syncImageHash`, and `marketplaceImageUrls` fields to the `listing`, `listingVariant`, and `marketplaceMapping` schemas to support improved synchronization and image management across marketplaces.
- Removed unnecessary logging in the `getFilter` function to streamline query processing.
- Updated the `models` export to include new policy models for payment, fulfillment, and return, enhancing schema flexibility.
- Enhanced the `partStock` schema with a default state for `type` and added a `postedAt` field for better tracking.
- Introduced a new `marketplaceMappingSchema` in the `productCategory` schema to manage marketplace references.
- Updated the `taxRate` schema to include `jurisdiction` and `shippingAndHandlingTaxed` fields for improved tax management.
- Enhanced the `listing` and `listingVariant` schemas with new states and policy references to support additional business logic.
- Introduced a new test suite for stock quantity recalculation in `stockQuantity.recalculate.test.js`, ensuring comprehensive coverage of listing variant recalculation logic.
- Enhanced the `filamentstock`, `partstock`, and `productstock` schemas by adding new rollup configurations for tracking unconsumed, used, and consumed states.
- Implemented a pre-validation hook in the `partstock` and `productstock` schemas to automatically set the `part` field based on the associated `partSku`.
- Updated the `stockevent` schema to include new rollup configurations and statistics methods for better inventory management.
- Improved the `listing` and `listingvarient` schemas with additional recalculation logic and statistics methods to enhance data integrity and reporting capabilities.
- Introduced a new `pageLayout` field in the user settings schema to allow for top-level layout configurations.
- Refactored the user settings manager to handle `pageLayout` separately from default settings, ensuring proper data structure during updates.
- Updated normalization functions to accommodate the new `pageLayout` field, enhancing the overall user settings management.
- Added tests to verify the correct handling of `pageLayout` updates, ensuring that it is written at the top level and not under defaults.
- Updated the `notificationUserFromOwner` function to support 'marketplace' as a valid owner type.
- Added a new `marketplaceEvent` schema to manage marketplace events, including fields for `externalReference`, `topic`, and `status`.
- Enhanced existing schemas (e.g., `orderitem`, `shipment`, `client`, `listing`, `listingVarient`, `salesOrder`, `courierService`) to include `externalReference` fields for better integration with external systems.
- Introduced unique indexes for `externalReference` in relevant schemas to ensure data integrity and prevent duplicates.
- Improved the `marketplace` schema to include additional fields for eBay shipping services, enhancing its configurability.
- Reformatted the `NOTIFICATION_EXCLUDED_MODELS` array for improved readability in `utils.js`.
- Updated the `editNotification` and `createNotification` functions for better code clarity by breaking long lines.
- Added a new `quantity` field to the `documentJobSchema`, ensuring it is required with a default value of 1 and a minimum of 1.
- Introduced new filtering capabilities in `updatemanager.js` to handle complex filter conditions, enhancing the overall filtering logic.
- Updated tests to mock new filter functionalities, ensuring proper integration and functionality verification.
- Changed the type of `testObject` from Mixed to ObjectId and added a refPath to `objectType`, enhancing the schema's ability to manage relationships with other documents.
- This update improves data integrity and allows for more structured querying of related objects.
- Introduced new fields for printPadding, paddingLeft, paddingRight, paddingTop, and paddingBottom in the document size schema.
- Ensured all new fields are required with appropriate default values, enhancing the schema's capability to manage document layout settings.
- Introduced utility functions to save user permissions to Redis, enhancing performance by reducing database load.
- Updated user schema to call the new caching function during permission recalculation, ensuring permissions are stored efficiently.
- Improved overall permission management by integrating Redis caching into the existing permission handling workflow.
- Replaced the existing permission settings schema with a new permission setting schema, enhancing the management of user permissions.
- Updated user and user group schemas to include references to the new permission setting model, allowing for more flexible permission handling.
- Added utility functions for resolving referenced documents and recalculating permissions, improving the overall permission management process.
- Removed the old permission settings schema to streamline the codebase and reduce redundancy.
- Introduced a new permission settings schema and model to manage user permissions effectively.
- Updated user schema to include a reference to permission settings, allowing for dynamic permission management.
- Enhanced the editObject function to conditionally recalculate permissions based on the new recalculate parameter.
- Added utility functions for applying and retrieving permission settings, improving permission handling across the application.
- Changed the getModelEntryByType function to use dynamic import for models, caching the result to improve performance.
- Updated the editNotification function to await the model entry retrieval, ensuring proper asynchronous handling of model data.
- Introduced notification functionality in the editObject method to notify users of changes when editing objects, enhancing user awareness of updates.
- Added utility functions for creating and managing notifications, including omitSensitive for filtering sensitive data and notificationUserFromOwner for user retrieval based on owner type.
- Updated SocketHost to support the new notify parameter, ensuring notifications can be triggered during object edits.
- Deleted the TemplateManager class and its associated methods for rendering templates and PDFs, streamlining the socket handling code.
- Removed all references to PDF and image rendering in SocketHost, SocketUser, and their tests, ensuring a cleaner codebase.
- Updated package.json and pnpm-lock.yaml to remove dependencies related to PDF generation and image processing, enhancing project simplicity.
- Updated barcode attributes to provide default values when content or attributes are missing, ensuring more robust barcode generation.
- Added error logging in the preview method to capture and log errors more effectively, improving debugging capabilities.
- Introduced a new field `sortSidebarVisibility` in the user settings schema to manage sidebar visibility preferences.
- Updated the user settings manager to include `sortSidebarVisibility` in the settings categories and default settings structure, ensuring proper normalization and handling of this new setting.
- Changed log level in config.json from "debug" to "trace" for enhanced logging detail.
- Updated mongoose version to ^9.9.1 in package.json for better performance and features.
- Added new cors origin in config.json for improved access control.
- Updated pnpm-lock.yaml to reflect changes in package versions and added new dependencies for better compatibility.
- Added "pdf-to-img" version 6.2.0 and "sharp" version 0.34.5 to enhance image processing capabilities.
- Updated package resolutions for various architectures and operating systems for the "sharp" library, ensuring compatibility across platforms.
- Included new entries for "@napi-rs/canvas" packages to support additional image processing functionalities on multiple environments.
- Changed log level in config.json from "debug" to "trace" for more detailed logging.
- Added new dependencies "pdf-to-img" and "sharp" in package.json for image processing capabilities.
- Introduced 'renderTemplateJPG' event handling in SocketHost and SocketUser classes to support JPG rendering.
- Implemented the renderJPG method in TemplateManager for converting templates to JPG format, including error handling and logging.
- Updated the logic to retrieve and validate the parent template content, ensuring it is correctly fetched and checked for string type.
- Improved error logging to provide clearer messages when parent template content is missing or invalid.
- Increased the maximum HTTP buffer size for the Socket.IO server to improve data handling capabilities.
- Added error handling in `handlePreviewTemplateEvent` and `handleRenderTemplatePDFEvent` methods to log errors and return error messages through callbacks.
- Implemented a check for unknown object types in the `TemplateManager` to prevent processing errors and return appropriate error messages.
- Removed unnecessary line breaks in the subjob schema to enhance code clarity.
- Ensured all required fields maintain their definitions for better data integrity.
- Updated formatting for the `state` field to align with coding standards.
- Enhanced the stock event schema by ensuring consistent formatting and removing unnecessary line breaks for better maintainability.
- Updated the filament schema to improve code readability and maintain required fields while maintaining functionality.
- Introduced a new `recalculate` method in the printer schema to manage printer state changes effectively.
- Added logic to handle host disconnection in the socket host, ensuring proper state management and logging.
- Added logic in the pre-validation hook to populate the `part` field in `parts` array based on the `partSku` if it is not already set.
- Improved data integrity by ensuring that part information is correctly retrieved and assigned during validation.
- Introduced a new optional field `code` in the printer schema for additional identification.
- Updated the `_id` field to use a default value generated by `generateId()` for improved uniqueness.
- Ensured schema maintains required fields and defaults for better data integrity.
- Introduced a new optional field `vendor` in the filament schema to reference the vendor associated with the filament.
- Improved code formatting for better readability and maintainability, including consistent indentation and line breaks.
- Ensured that the `recalculate` method remains functional with updated schema structure.
- Cleaned up the stock event schema by removing unnecessary line breaks and ensuring consistent formatting across the code.
- Enhanced readability of function parameters and return statements for better maintainability.
- Made minor adjustments to comments and structure to align with coding standards.
- Introduced a `history` field in filamentStock, partStock, productStock, and stockEvent schemas to maintain historical records of current quantities and weights.
- Enhanced stock event processing to append history entries when values change, ensuring accurate tracking of stock changes over time.
- Implemented utility functions to manage history entries and enforce rate limits on updates for improved data integrity.
- Removed the `getStockEventTotal` function and associated `recalculate` methods from filamentStock, partStock, and productStock schemas to streamline code and reduce redundancy.
- Updated stockEvent schema to include a new `recalculate` method that centralizes stock recalculation logic for improved maintainability.
- Enhanced the stockEvent schema with additional utility functions for building update data and recalculating parent stock based on events.
- Introduced a new optional field `hasThumbnails` in the file schema to indicate the presence of thumbnail images.
- Set the default value of `hasThumbnails` to false for improved data management.
- Introduced the ActivityManager class to handle object activity tracking, including viewing and editing events.
- Implemented methods for setting, clearing, and retrieving activities, as well as subscribing to activity updates via websockets.
- Replaced the LockManager with ActivityManager in SocketUser and SocketManager classes to streamline activity management.
- Added comprehensive tests for ActivityManager to ensure correct functionality and error handling.
- Removed LockManager and its associated tests to eliminate redundancy in functionality.
- Introduced a new utility function `formatTraceData` to standardize the formatting of trace data for logging purposes.
- Updated various modules including auth, database, and stats manager to utilize `formatTraceData` for improved log clarity and consistency.
- Added new schemas for printer profiles and filament profiles to enhance the data model.
- Implemented tests for session authentication to ensure robust functionality and error handling.
- Introduced a new UserSettingsManager class to handle user-specific settings, including retrieval and updates.
- Implemented user settings schema to define defaults and manage user-specific configurations.
- Enhanced SocketUser class to integrate user settings event handlers for getting and updating settings.
- Added comprehensive tests for UserSettingsManager to ensure correct functionality and error handling.
- Added verification for `removeAllListeners` method in both SocketUser and UpdateManager to ensure proper cleanup of event listeners during disconnection handling.
- Added `removeAllListeners` method in UpdateManager to clear all subscriptions efficiently.
- Updated SocketUser's `handleDisconnect` method to log user disconnection more accurately based on user presence.
- Introduced subscription tracking in UpdateManager to manage active subscriptions.