Implemented a new method to delete files from the storage by checksum and extension. This method logs the deletion process and throws a NotFoundException if the file cannot be found. Updated dependencies to include 'rm' from 'node:fs/promises'.
Introduced the deleteFile method in files.service.ts to handle file deletion, considering duplicates. Also updated files.controller.ts to create a new DELETE endpoint protected by the AdminGuard to ensure only admins can delete files.
A TODO comment was added to the files.service.ts to indicate the need for a file deletion feature. This serves as a placeholder for future development to ensure the feature is addressed.
Implemented the save method to store files and associate them with machines, including handling optional group associations. Modified the database schema to allow null as a default for group_id and added logic to update group ID after file insertion.
Updated the MIME type validation function to handle machine-specific MIME type sets. This ensures that a MIME type must be acceptable across all associated machines. Enhanced clarity and structure by using a map to maintain MIME types for each machine.
Allow groupId to be optional and added methods for group operations. Updated file insertion to handle optional groupId and adjusted group verification logic accordingly. Added method stubs for creating, deleting, and finding files within groups.
This commit introduces endpoints to add, remove, and list types associated with machines. It also includes the addition of the `TypeDto` class to handle type validations and updates HTTP response codes for the existing endpoints.
Removed obsolete todos for DTO and Patch operations. Added todos for types handling related to machine operations as placeholders for future implementation.
Add functionality to fetch and return a list of machines with limit, offset, and search parameters using the machineService. This enhances the controller's capability to handle queries more effectively.
Implemented methods in AuthorsService to find authors, filter files by author, and delete authors. Integrated these methods in AuthorsController to handle HTTP requests accordingly.
Deleted a redundant TODO comment about deleting a machine and associated file type. The method to remove a specified file type from a machine is already implemented.
Added a new 'id' column as the primary key with a unique constraint and default random value generation for the 'FilesTypeForMachine' table. This ensures each row has a unique identifier.
Updated the file search functionality to include a search field that filters files by name and added pagination support. This enhances the API by providing more flexible querying and making it easier to handle large datasets.
Implemented a new method to retrieve file types associated with a specific machine by its ID. This method queries the database and returns a promise that resolves to an array of file types.
Replaced variable assignment with direct return of the database insertion result to streamline the code. This improves readability and eliminates an unnecessary variable.
Implemented the `addFileType` method to link a file type to a machine. This includes database checks for valid machine and file type IDs, and the actual insertion logic. Updated imports and removed obsolete TODO comments.
Introduce the removeFileType method to handle the removal of specific file types from machines, including error handling for invalid machine or file type IDs. Additional TODOs are placeholders for future methods related to adding and retrieving file types for machines.
This ensures both modules have access to the necessary credentials functionality, improving their capability to handle secure operations. The inclusion of DbModule in AuthorsModule aligns it with the design pattern used in GroupsModule.
Implemented a new endpoint to create machines in the system. Added the required DTO for machine creation data validation and integrated it into the controller. Updated service methods to handle machine creation and improved the `findFilesForMachine` method for clarity and functionality.
This commit introduces the `findFilesForMachine` method, which retrieves files associated with a given machine ID from the database. It includes functionality to limit and offset the results based on given parameters, and throws a `NotFoundException` if the machine ID is not found.
Implemented `findMany` method to fetch machines based on a search field, applying limit and offset for pagination. Includes console logs for tracking search parameters and results.
Changed the parameter name from 'machineId' to 'author' in the deleteAuthor method to reflect the actual parameter expected by the route. This improves code clarity and ensures the method receives the correct data.
Refactored `import` statements in multiple files for consistent formatting. Grouped similar statements together and ensured single import per line for better readability.
Modified file retrieval routes for groups, authors, and machines to align with consistent structure. Changed the order of parameters in the routes to "files/:id". This enhances readability and standardizes API endpoint structures across different controllers.
Renamed routes and incorporated `AdminGuard` for deletion. Adjusted parameter names and simplified function bodies to improve readability and security.
Inserted a TODO comment to indicate the need for a DTO in the newGroup method. This serves as a reminder for future development and enhances code readability and maintainability.
Inserted TODO comments to signal necessary future additions like DTOs, patches, and CRUD operations associated with machine file types. These placeholders will help guide the development of these features.
Renamed route for fetching groups and added an admin guard to the delete endpoint. Also updated the endpoint for getting files associated with a group and removed unnecessary method bodies and comments.
In the machines.controller.ts file, a TODO comment was added to indicate where a future patch method will be implemented. This serves as a reminder for developers to address this area later.
Reformat the return statements for better readability and consistency. The changes ensure that the status codes and response body are returned in a clearer and more maintainable format.
This change includes the CredentialsModule in the imports array of the MachinesModule. This integration ensures that machine-related operations have access to necessary credential services.
Added AdminGuard to POST and DELETE routes in MachinesController to ensure only admins can create or delete machines. Renamed endpoints for clarity and removed redundant code. This enhances security and improves API design.
Revised the file saving process to include better logging and error management. Added groupId to file saving parameters and enhanced verification checks. Updated .gitignore to exclude assets directory.
Introduce a primary key field 'id' with UUID type to the FilesForMachinesTable. This ensures each record is uniquely identifiable and improves database integrity. Additionally, set a default value to a random UUID for new entries.
Changed the file saving path from "files/" to "assets/" to unify storage structure. Improved error handling and logging in the file operations to aid in debugging. Additionally, streamlined database insertion and validation logic in the files service for better efficiency and readability.
Standardized import quotes across files and added a missing trailing comma in storage.module.ts.
Corrected import order in files.module.ts and machines.module.ts for better readability.
Updated file type detection to use 'magic-bytes.js' instead of 'file-type' across various modules. Also added missing exports in 'StorageModule' and imported 'DbModule' in 'MachinesModule'.
Removed outdated TODO comments and enabled `filesService.save` to handle file saving logic. This change ensures that files are properly processed and stored, providing a success message upon completion.
Removed default values for 'isRestricted' and 'isDocumentation' columns in the FilesTable. Added a new intermediary table 'FilesForMachinesTable' to establish a many-to-many relationship between 'File' and 'Machine'.
Corrected inconsistent use of single and double quotes and adjusted indentation for enhanced readability and code style consistency. No functional changes were made in this commit.
Aligned the indentation to use tabs consistently and updated import statements to use double quotes for consistency throughout the file. These changes improve code readability and maintain uniform style.
The DbModule import was moved to ensure proper load order and maintain consistency within the module imports. This change will help in avoiding potential dependency injection issues.
Rearranged the imports in `groups.dto.ts` to maintain alphabetical order and used double quotes for consistency with the rest of the project. This change does not alter functionality but improves code readability and maintainability.
Standardized import quotes in groups controller and reorganized import statements for better readability. Removed unnecessary line breaks in newGroup method.
Implemented detailed logic to check machine and group existence before saving files. Added comprehensive error handling to provide clear feedback when database operations fail. Improved file saving functionality with associations between files and machines.
Change import statements to use double quotes for consistency and adjust property indents to match standard. These modifications improve code readability and maintain uniform coding style throughout the file.
Reformat imports and modify `saveFile` method to include the `uploaded_by` header. Ensure that `_uploadedBy` is checked and added to the parameters alongside other headers.