This commit updates the list of allowed sorters in the file management routes to include 'extension', enhancing sorting capabilities. Additionally, it refactors the route handlers for better readability by formatting the function calls across multiple lines. These changes improve the maintainability of the code while ensuring consistent functionality in file management operations.
This commit adds the `normalizeTemplateResourceName` and `validateTemplateResources` functions to both the document and email template schemas. These functions ensure that resource names are properly formatted and validated, enhancing the integrity of template resource management. The changes improve the overall schema structure and prepare for future enhancements in template handling.
This commit introduces a new schema for managing template resources, including validation and normalization functions. It adds routes for retrieving template resources and integrates resource handling into document and email template services. The changes enhance the application's template management capabilities by allowing for unique resource names and improved resource URL generation. Additionally, tests are added to ensure the correct functionality of the new features, including resource validation and rendering.
This commit introduces new route handlers for deleting GCode files and printers, enhancing the application's data management capabilities. The `deleteGCodeFileRouteHandler` and `deletePrinterRouteHandler` are added, allowing for individual deletion of these entities. Additionally, the necessary authentication and permission checks are implemented for these routes, ensuring secure access control.
This commit introduces a new `deleteObjects` function in the database module, allowing for bulk deletion of objects based on specified filters and states. Additionally, new route handlers for deleting invoices, payment policies, payments, tax records, filament stocks, order items, part stocks, product stocks, purchase orders, shipments, stock audits, stock locations, stock transfers, app passwords, couriers, courier services, document printers, document sizes, document templates, email accounts, email templates, filaments, filament SKUs, files, hosts, materials, note types, parts, part SKUs, permission settings, product categories, products, and vendor entities are added. Each route supports deletion based on filters, enhancing the application's data management capabilities.
This commit updates the email template rendering logic to conditionally apply a preview wrapper and associated CSS when the preview flag is set. It modifies the `renderEmailTemplate` and `renderTemplate` methods to ensure that the email content is correctly wrapped in a preview structure, while also ensuring that scaling is consistently applied. Additionally, tests are added to verify the correct behavior of the rendering process in both preview and non-preview scenarios, enhancing the overall functionality of the TemplateManager.
This commit introduces new route handlers for intellisense in both document and email templates, allowing for cursor-relative suggestions based on template content. The `intellisenseDocumentTemplateRouteHandler` and `intellisenseEmailTemplateRouteHandler` functions are implemented to collect and return relevant intellisense data. Additionally, tests are added to ensure the correct behavior of the intellisense feature, enhancing the overall template management capabilities.
This commit refines the `resolveEmailAttachments` function by enhancing error handling for unknown object types and removing unnecessary console logs. It also updates the test suite to mock additional database functions and ensure proper object retrieval during email message processing, improving the robustness of email management features.
This commit introduces new schemas and routes for managing email accounts, email messages, and email templates. It adds functionality for CRUD operations on these entities, including listing, searching, and retrieving properties. The email message handling is enhanced with a worker for asynchronous email delivery, and the audit log schema is updated to accommodate system actions. Additionally, utility functions are improved for better data handling and validation. These changes significantly enhance the application's email management capabilities.
This commit introduces a new function, `syncModelsWithScheduler`, to synchronize database schemas with the farm control scheduler. It also adds scheduled properties and event handling for invoices, allowing for automatic state updates based on due dates. Additionally, minor refactoring is performed in the sales listings routes and services to improve code readability and maintainability. The changes enhance the application's data synchronization and invoice management capabilities.
This commit introduces a new utility function, `isEmptyOperand`, to treat empty strings as null or missing values in filter parsing. It updates the `parseFilter` function and related utility functions to handle cases where empty values are provided, ensuring consistent behavior across different field types. Additionally, corresponding tests are added to verify the correct handling of empty values in various scenarios, enhancing the robustness of the filtering capabilities.
This commit updates the allowed filters and sorters in the filament, part, and product SKU management routes to include 'overrideCost' and 'overridePrice'. Additionally, it refactors the route handlers for improved readability and consistency. These changes aim to enhance data retrieval capabilities and maintain a consistent structure across the management routes.
This commit enhances the audit log service route tests by replacing direct calls to the `auditLogModel` with mocked database functions `listObjects` and `getObject`. This change improves the accuracy of the tests by ensuring they reflect the updated database interaction methods. The tests now verify that the correct parameters are passed to these functions, enhancing the overall reliability of the audit log service tests.
This commit introduces new functions for handling various date operations, including start and end of day, week, month, hour, and minute. It also adds relative date parsing capabilities, allowing for expressions like 'TODAY', '-7D..', and '-1M..-CM'. Additionally, the `parseFilter` function is updated to support these new date functionalities, with corresponding tests added to ensure accurate date filtering and validation. The changes improve the overall date management and querying capabilities within the application.
This commit modifies the `distributeUpdate` function in `utils.js` to include the `_id` in the published object, improving data integrity during distribution. Additionally, it updates the allowed filters in the `products` and `clients` routes to include 'tags', enhancing the filtering capabilities for better data categorization and retrieval.
This commit introduces a new `objectView` schema and corresponding routes for managing object views, enhancing the application's data handling capabilities. It includes CRUD operations for object views, allowing users to create, retrieve, update, and delete views based on specific object types. The implementation also updates existing services and routes to integrate the new functionality, ensuring proper authentication and data validation. Additionally, the commit modifies relevant utility functions and filters to accommodate the new object view model, improving overall application structure and maintainability.
This commit updates the allowed filters and sorters in multiple routes, including invoices, payment policies, inventory, management, and sales. It removes unnecessary filters, adds new ones for improved categorization, and ensures consistency in the data structure. These changes aim to streamline data retrieval and enhance the overall functionality of the application.
This commit introduces new functions to handle model prefix stripping and leading operator detection in the `utils.js` file. The `stripModelPrefixFromExpression` and `splitLeadingOperator` functions are added to enhance expression parsing. Additionally, existing functions are updated to utilize these new utilities, improving the handling of expressions in filters. Corresponding tests are added to ensure the correctness of the new functionality, particularly for equality and not-equal expressions.
This commit introduces a new `tax.js` module containing functions for tax rate resolution and amount calculation with tax. The `amountWithTax` and `resolveTaxRate` functions are integrated into various schemas, including `invoice`, `orderitem`, `shipment`, `courierservice`, `filament`, `part`, and `product`, enhancing their ability to compute amounts with applicable taxes. Additionally, corresponding tests are added to ensure the correctness of the new tax-related functionalities.
This commit updates the filament stock schema to set a default state of 'draft' and introduces a new route handler for posting filament stocks. The posting process includes validation to ensure stocks are in the draft state before transitioning to 'unconsumed', along with the creation of an initial stock event. Additionally, the service layer is updated to handle these changes, and tests are added to verify the new functionality.
This commit modifies the `stockTransfer` schema by removing the `toStockLocation` field and introducing `fromLocation` and `toLocation` fields, ensuring better clarity in stock transfer operations. The routes and services are updated to reflect these changes, including adjustments in the `executePostedLine` function to validate stock locations. Additionally, the allowed filters and sorters in the stock transfer routes are refined, enhancing the overall functionality and maintainability of the inventory management system.
This commit modifies the `stockAuditLevel` schema by making the `tags` field required, ensuring that all stock audit levels have associated tags for better categorization. Additionally, it enhances the readability of the `normalizeAuditLevelLine` function by adjusting the formatting of the item and itemSku assignments, improving overall code clarity.
This commit introduces a new `stockAuditLevel` schema and corresponding routes for managing stock audit levels, enhancing the inventory management capabilities. It includes CRUD operations for stock audit levels, allowing for the creation, retrieval, updating, and deletion of audit levels. The integration with existing stock audit functionalities is established, enabling the association of audit levels with stock audits. Additionally, utility functions for handling stock audit levels are implemented, improving the overall structure and maintainability of the inventory system.
This commit modifies the `deviceInfo` schema by removing unused fields such as `uptime`, `memory`, and `network`, streamlining the schema for better clarity and performance. The `deviceInfo` property in the `hostSchema` is updated to directly reference the `deviceInfoSchema`, enhancing code readability and maintainability.
This commit enhances the `invoice`, `taxrecord`, `orderitem`, `purchaseorder`, `shipment`, and `salesorder` schemas by introducing new rollup configurations for various states and values. It adds methods for aggregating statistics and historical data using `aggregateRollups` and `aggregateRollupsHistory`, improving data analysis capabilities across financial and inventory records. The new rollups include counts and sums for different transaction types and states, facilitating better reporting and insights into the application's financial and inventory management.
This commit introduces new utility functions to support number field validation and regex condition building in the `utils.js` file. It updates the `buildEquality`, `buildComparison`, and `parseLeafCondition` functions to accommodate number fields, ensuring proper handling of numeric values in filters. Additionally, a new test suite is added to validate the behavior of the `parseFilter` function with number fields, covering various scenarios including exact matches, wildcard handling, and non-numeric input. This enhancement improves the robustness of the filtering mechanism in the application.
This commit updates multiple routes across the management and inventory modules to enhance the handling of property value requests. The `/values` endpoints are modified to incorporate a filtering mechanism that allows for both a standard filter and an optional master filter, improving the flexibility and accuracy of data retrieval. Additionally, debug logging statements are added to assist in tracking the filter parameters during requests. This refactor aims to streamline the data fetching process and improve the overall user experience when interacting with the API.
This commit refactors the eBay order integration by introducing a new module for trading requests, encapsulating common functionalities such as XML parsing and request handling. The `orders.js` file is significantly expanded to include new parsing functions for shipping addresses, tracking details, and trading transactions, enhancing the overall order processing capabilities. Additionally, the `shippingServices.js` file is streamlined by removing deprecated constants and functions, replacing them with calls to the new trading request utilities. Comprehensive tests are added to ensure the correctness of the new functionalities and their integration with existing systems, improving the reliability of eBay marketplace operations.
This commit introduces the `syncWebhooks` function to streamline the process of synchronizing webhook configurations for marketplaces. It enhances the existing `ensureWebhookSubscriptions` function to utilize `syncWebhooks`, ensuring that webhook URLs and verification tokens are correctly set and updated. Additionally, a new module for managing webhook configurations is added, which includes utility functions for building webhook URLs and generating verification tokens. Tests are also included to validate the new functionality and its integration with existing systems, improving the overall reliability of webhook management.
This commit introduces new fields `syncHash` and `syncImageHash` to the `listing` and `listingVariant` schemas, enhancing the tracking of synchronization states. Additionally, a new module for sync fingerprinting is added, which includes functions to generate hashes for listings and their variants. The marketplace integration logic is updated to utilize these hashes for determining if updates are necessary, improving efficiency in syncing operations. Tests are also added to ensure the correctness of the new functionality and its integration with existing systems.
This commit introduces mock functions for the `permissions` module in the user API test file, enhancing test isolation and allowing for comprehensive testing of permission-related functionalities. The new mocks include methods for checking permissions, managing user permissions cache, and resolving permission settings, improving the overall test coverage and reliability of the user API tests.
This commit modifies the log level in the configuration file from "trace" to "debug" for improved logging clarity. It also introduces new routes for fulfillment, return, and payment policies in the index file, enhancing the marketplace integration capabilities. Additionally, the initialization process is updated to start the marketplace worker, ensuring that the application can handle marketplace operations effectively. Various schemas are updated to include new fields and relationships for policies, improving the overall functionality and flexibility of the marketplace management system.
This commit enhances the `aggregateRollupsHistory` function by restructuring the logic for filtering and processing audit logs, improving the accuracy of rollup snapshots over time. New utility functions are introduced to streamline the matching of objects against filters and to handle the existence of objects at specific timestamps. The overall flow is optimized to ensure that rollup calculations reflect the correct state of objects based on historical data, enhancing the reliability of data analysis and reporting.
This commit enhances the `client`, `listing`, and `marketplace` schemas by introducing rollup statistics and history tracking capabilities. New rollup configurations are added to count various states, such as 'active', 'inactive', and others specific to each schema. The `stats` and `history` static methods are implemented to aggregate data using the newly introduced `aggregateRollups` and `aggregateRollupsHistory` functions, improving data analysis and reporting for sales entities.
This commit adds new rollup configurations to the `filamentstock`, `partstock`, and `productstock` schemas to track the counts of different stock states: 'unconsumed', 'used', and 'consumed'. Additionally, the `stockevent` schema is updated to include rollup statistics for various stock types, improving the overall inventory management capabilities. Tests are also updated to mock new aggregate functions, ensuring comprehensive coverage of the new functionalities.
This commit introduces several utility functions in `utils.js` to improve ObjectId handling, including `isByte`, `isTwelveByteBuffer`, and `objectIdToString`. The `expandObjectIds` function is updated to better handle various ObjectId formats, including BSON ObjectIds and serialized 12-byte buffers. Additionally, comprehensive tests are added in `utils.expandObjectIds.test.js` to verify the correct behavior of these enhancements, ensuring robust handling of ObjectId conversions and expansions.
This commit updates the `syncModelsWithWS` function to include detailed statistics on schema synchronization, tracking the number of added, updated, and unchanged files. The `syncDirectory` function is modified to read file contents and determine if changes exist before copying, utilizing a new utility function, `fileHasChanges`, for comparison. Additionally, a helper function, `readFileIfExists`, is introduced to handle file reading more gracefully. These enhancements improve the efficiency and clarity of the schema synchronization process.
This commit introduces a new utility function, `toId`, to handle ID conversions in the `listingvarient.schema.js` file. The `recalculate` method is updated to compute and update the stock quantity for listing variants based on product SKU and stock location. Additionally, a new test case is added in `stockQuantity.recalculate.test.js` to verify the correct behavior of stock quantity calculations before rolling up, ensuring comprehensive test coverage for this functionality.
This commit expands the test setup in `stockQuantity.recalculate.test.js` and `shipments.test.js` by introducing new mock functions for various database operations, including `searchObjects`, `getPropertyValues`, and `listObjects`. These enhancements improve the isolation of tests and ensure that the tests can run independently of the actual database implementation. The updates also include mocks for sales order and marketplace schemas, further enriching the test environment and facilitating comprehensive testing of inventory-related functionalities.
This commit introduces a new module, `auditOwner.js`, which includes functions for resolving audit owner details and generating display names for actors. The `resolveAuditOwner` function determines the owner type based on the actor's object type, defaulting to 'user' if not specified. The `actorDisplayName` function formats the display name based on the actor's properties, enhancing the clarity of audit logs. Additionally, the `AUDIT_OWNER_TYPES` constant is exported for use in other modules. Updates to existing files incorporate these new functions for improved audit logging and notification handling.
This commit introduces a new `quantity` field to the document job schema, ensuring it is required with a default value of 1. The routes and services for managing document jobs are updated to include this new field, allowing for its inclusion in both creation and editing processes. Additionally, the allowed filters and sorters are modified to accommodate the new `quantity` field, enhancing the overall functionality and flexibility of document job management.
This commit introduces several utility functions to improve schema type handling, including `getEmbeddedSchemaType` and `getObjectIdSchemaTypeFromPath`. The `getFilterFieldKind` function is updated to utilize these new utilities for better clarity and functionality. Additionally, the `getArrayParentPaths` function is renamed to `getArrayUnwindPaths` for improved readability, and the logic for fetching unique IDs is enhanced with a new `flattenRefIds` function. These changes streamline the code and enhance the overall management of schema references and array paths.
This commit introduces a new field, `referencedTemplates`, to the document template schema, allowing for the association of other document templates. It also adds utility functions for extracting references from template content and converting filter values to ObjectIds. The document template service is updated to recalculate and populate referenced templates when editing a document template. Additionally, route handlers are modified to support the new referenced templates in their population logic, improving the management of document templates.
This commit modifies the progress messages in the PDF generation tests to include ellipses and exclamation marks, enhancing the clarity and consistency of the output. The changes ensure that the messages reflect a more engaging user experience during the PDF generation process. Corresponding tests have been updated to verify these modifications.
This commit introduces the `EventManager` class, which facilitates tracking and broadcasting object events using NATS and websockets. The `documenttemplate.schema.js` file is updated to change the `testObject` field type to `ObjectId` with a reference path, improving data integrity. Additionally, the document template service is enhanced with new functionalities for asynchronous rendering and progress reporting, utilizing Redis for storing render requests. Corresponding tests are added to ensure the correct functionality of the new event handling and document management features.