146 Commits

Author SHA1 Message Date
9416a94a23 Refactor database utility functions and enhance audit logging
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-09-01 12:34:31 +01:00
ccbf2ff388 Enhance financial and inventory schemas with new rollup configurations
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-30 14:56:57 +01:00
ae2cefb183 Enhance sales schemas with synchronization fields
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- Added `syncHash`, `syncImageHash`, and `marketplaceImageUrls` fields to the `listing`, `listingVariant`, and `marketplaceMapping` schemas to support improved synchronization and image management across marketplaces.
2026-08-29 23:13:46 +01:00
cdc7b860ac Refactor database schemas and enhance inventory management
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-29 00:48:13 +01:00
4109523f59 Add stock quantity recalculation tests and enhance inventory schemas
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-25 01:59:22 +01:00
91c88b5cbb Enhance user settings management and schema
- 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.
2026-08-25 01:59:14 +01:00
2dc2a9d296 Enhance database schemas and introduce marketplace event handling
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-24 02:49:19 +01:00
e563538e89 Refactor database utility functions and enhance document job schema
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-22 20:02:36 +01:00
f5e74ac471 Update document template schema to reference object types
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-22 12:56:03 +01:00
4fca989b04 Add print padding and padding properties to document size schema
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-21 22:39:22 +01:00
ecbdfb97c1 Add caching for user permissions in Redis
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-20 19:35:28 +01:00
998bb725a2 Refactor permission settings and introduce user group management
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-20 15:04:55 +01:00
3742839737 Add permission settings model and related functionality
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-20 12:27:54 +01:00
7e8879164a Refactor model entry retrieval in database utilities
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-19 19:03:34 +01:00
c36765cc47 Add notification handling in editObject and utility functions
Some checks failed
farmcontrol/farmcontrol-ws/pipeline/head There was a failure building this commit
- 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.
2026-08-19 18:58:37 +01:00
6e74e0dfec Remove TemplateManager and related PDF rendering functionality
- 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.
2026-08-19 18:18:49 +01:00
a3eef435f4 Improve barcode attribute handling and enhance error logging in TemplateManager
- 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.
2026-08-19 17:38:59 +01:00
7b4bedeee4 Add sortSidebarVisibility to user settings schema and manager
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-09 20:55:04 +01:00
943e5ff4c6 Update configuration and dependencies for improved logging and compatibility
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-08-02 01:01:43 +01:00
a7d7d0a456 Add sharp to allowed builds in pnpm-workspace.yaml
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- Updated pnpm-workspace.yaml to include 'sharp' in the allowed builds, enhancing the build configuration for image processing capabilities.
2026-07-28 23:22:55 +01:00
e34326b768 Add new dependencies and update package versions in pnpm-lock.yaml
Some checks failed
farmcontrol/farmcontrol-ws/pipeline/head There was a failure building this commit
- 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.
2026-07-28 23:21:24 +01:00
c2372f661e Update configuration, add dependencies, and enhance socket event handling
Some checks failed
farmcontrol/farmcontrol-ws/pipeline/head There was a failure building this commit
- 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.
2026-07-28 23:16:05 +01:00
53b5924767 Refactor parent template handling in TemplateManager
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-07-28 02:51:02 +01:00
8c445a7392 Enhance socket management and error handling in template events
- 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.
2026-07-28 01:50:24 +01:00
00198b8199 Refactor subjob schema for improved consistency and readability
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-07-28 00:22:27 +01:00
8493f44748 Delete builds older than 25.
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
2026-07-26 23:56:13 +01:00
ef5cfd34e4 Refactor inventory and filament schemas for improved consistency and readability
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-07-26 22:41:09 +01:00
f3a3d3914a Enhance gcode file schema to populate part information from partSku
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-07-26 21:21:35 +01:00
652d62c758 Enhance printer schema by adding optional code field and default ID generation
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-07-26 21:11:49 +01:00
0a1f75d050 Enhance filament schema by adding vendor reference and improving formatting
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-07-26 19:07:46 +01:00
766f4722ea Refactor stock event schema for improved readability and consistency
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-07-26 19:00:30 +01:00
2b660ec61d Add history tracking to inventory schemas and stock event
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-07-26 18:38:04 +01:00
67f929e369 Refactor inventory schemas to remove redundant stock event calculations
- 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.
2026-07-26 16:10:38 +01:00
0b39eef045 Add hasThumbnails field to file schema
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-07-26 03:07:45 +01:00
49226290b6 Add ActivityManager and integrate activity tracking functionality
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-07-26 00:43:24 +01:00
e80022513f Remove unnecessary console logs from utility and schema files for cleaner code. Update index definitions for consistency in filament and printer profile schemas.
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
2026-07-23 21:44:40 +01:00
aad49bfcfd Add formatTraceData utility and integrate into logging
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-07-20 02:11:56 +01:00
15132fefa0 Add user settings management functionality
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- 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.
2026-07-18 14:48:46 +01:00
1cb6efdb2d Update payment schema. 2026-07-18 14:34:26 +01:00
63c4471652 Updated models.
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
2026-07-18 13:36:04 +01:00
107ec278ef Fixed template crash.
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
2026-07-13 23:20:40 +01:00
4b2f4c4bf8 Add text indexes to various schemas for improved search capabilities
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- Introduced text indexes in invoice, payment, tax record, and multiple inventory and management schemas to enhance search functionality.
- Updated schemas include invoice, payment, tax record, filament stock, order item, part stock, product stock, purchase order, shipment, stock audit, stock event, stock location, stock transfer, app password, audit log, courier, courier service, document job, document printer, document size, document template, filament, filament SKU, file, host, material, note type, part, part SKU, product, product category, product SKU, tax rate, user, vendor, gcode file, job, printer, subjob, client, listing, listing variant, and marketplace schemas.
- Improved search performance and flexibility across the application by leveraging text indexing.
2026-07-04 22:03:31 +01:00
0d395d3cb0 Enhance SocketUser tests to verify removal of all listeners during disconnection.
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- Added verification for `removeAllListeners` method in both SocketUser and UpdateManager to ensure proper cleanup of event listeners during disconnection handling.
2026-07-04 16:54:55 +01:00
516402d40d Enhance UpdateManager and SocketUser classes to improve subscription management and disconnection handling.
Some checks failed
farmcontrol/farmcontrol-ws/pipeline/head There was a failure building this commit
- 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.
2026-07-04 15:30:16 +01:00
cf979a6db0 Update invoice schema to support dynamic references for 'from' and 'to' fields by introducing 'fromType' and 'toType' fields, enhancing flexibility in vendor and client associations.
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
2026-07-04 15:18:25 +01:00
6d4ed27996 Remove 'fileName' field from part schema to streamline data structure and improve clarity in part management. 2026-07-04 15:18:19 +01:00
083cc95523 Integrate expandObjectIds utility in UpdateManager to enhance object update handling, ensuring expanded values are emitted in socket events.
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
2026-07-04 15:18:04 +01:00
7002e5a6c1 Enhance callback handling in SocketUser class to ensure callback is a function before invocation, preventing potential runtime errors. 2026-07-04 15:17:56 +01:00
0748256ce8 Refactor filament schema recalculation logic to use filamentSku model instead of orderItem model. This change improves the efficiency of recalculating SKUs associated with a filament.
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
2026-06-21 23:59:34 +01:00
4f9ed6039b Add fields for payment authorisation and decline tracking in payment schema
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- Introduced 'authorisedAt' and 'declinedAt' fields to the payment schema to track payment status changes.
- Added new rollup configurations for counting and summing authorised and declined payments.
2026-06-21 22:32:59 +01:00