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.
Added new database management scripts using drizzle-kit. Updated various dependencies and development dependencies to their latest versions to ensure better stability and new features.
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'.
This update ensures that files related to 'drizzle' are ignored by Git. This change helps prevent unnecessary files from being tracked and uploaded to the repository.
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.
Corrected spacing around type annotation and added missing semicolon in the `canActivate` method. These changes ensure better code consistency and adhere to TypeScript style guidelines.
Added request and response handling for the file upload endpoint in FilesController. Implemented form data parsing, header validation, and admin-specific parameter management. These changes aim to improve error handling and prepare the logic needed for saving files and associated data.
Introduces a new InsertAdminState guard to verify if the user is an admin by checking their authentication token and updating a custom header 'is_admin' accordingly. This guard fetches user details from the database and sets the 'is_admin' header to true or false based on the user's admin status.
Replaced the variable assignment and logging with a streamlined return statement for better code readability and performance. This change improves the method's efficiency by reducing unnecessary steps and directly returning the result.
Added a search method in FilesService and corresponding endpoint in FilesController to search files with a limit, offset, and search keyword. Introduced CreateFilesDto with validation constraints to structure file creation inputs.
This change introduces a constructor to the MachinesService class, ensuring the DbService is properly injected. This setup prepares for future methods dealing with machine data operations, such as fetching, creating, and deleting machines, as well as retrieving associated files.
The uploader field in the schema has been deleted. This change ensures the table structure is simplified and aligns with the updated data requirements. All related functionalities have been adjusted to accommodate this deletion.
Implemented placeholders for saving a file in the files service and added a new POST endpoint in the files controller. These changes lay the groundwork for future development of file uploading functionality.
Introduced CreateGroupDto to enforce validation rules for group creation. Integrated DbModule into GroupsService and added a getGroupsByName method for database queries. Placeholder methods for group creation, deletion and file retrieval are also defined.
Updated the FilesService.get() method to return a StreamableFile directly with appropriate headers instead of a custom object. Adjusted the FilesController to reflect this change and ensure the file names are formatted by replacing spaces with underscores.
Replace loop-based MIME type check with Set.prototype.has for improved readability and performance. This change eliminates the need for an explicit loop, making the code more concise and efficient.
Introduce 'extension' and 'isDocumentation' fields to the database schema. These additions enhance file metadata and facilitate improved data management.
This commit updates the FilesModule to import both StorageModule and DbModule. This enhances the functionality of the FilesModule by integrating database and storage services.
Replaced Buffer with StreamableFile for more efficient file handling by streaming the content instead of reading it into memory. Additionally, updated the method signatures and parameters to improve clarity and align with the new changes.
Included ts-mockito version 2.6.1 to both package.json and pnpm-lock.yaml files. This addition will aid in creating mock objects in unit tests, enhancing the project's test capabilities.