112 Commits

Author SHA1 Message Date
2ca13714a4
Refactor file and group handling logic
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.
2024-10-11 11:00:37 +02:00
356b6869ad
Remove commented-out code in schema
Eliminated a comment in the FilesGroupTable definition that was redundant. This helps in maintaining cleaner and more readable code.
2024-10-10 15:26:34 +02:00
030b5c814c
Add type management endpoints for machines
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.
2024-10-10 15:26:06 +02:00
16ed8d3420
Refactor machines controller todo comments
Removed obsolete todos for DTO and Patch operations. Added todos for types handling related to machine operations as placeholders for future implementation.
2024-10-10 14:15:17 +02:00
0874ffb835
Implement machine list retrieval in controllers
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.
2024-10-10 14:10:23 +02:00
3d67b8ad18
Add service methods for managing authors and files
Implemented methods in AuthorsService to find authors, filter files by author, and delete authors. Integrated these methods in AuthorsController to handle HTTP requests accordingly.
2024-10-10 11:44:24 +02:00
3bc440cbf8
Remove unnecessary TODO comment
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.
2024-10-08 16:34:07 +02:00
44dab5ba11
Add primary key to FilesTypeForMachine table
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.
2024-10-08 16:33:41 +02:00
7876bc2c38
Revise file search logic for machine service
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.
2024-10-08 16:11:34 +02:00
84d6743863
Add getFilesTypes method to machines service
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.
2024-10-08 16:08:50 +02:00
86da1b7bce
Refactor file type insertion method in machine service
Replaced variable assignment with direct return of the database insertion result to streamline the code. This improves readability and eliminates an unnecessary variable.
2024-10-08 16:04:49 +02:00
a8a190198b
Add addFileType method to machines service
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.
2024-10-08 16:03:16 +02:00
fa65b62716
Add removeFileType method to MachinesService
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.
2024-10-08 15:57:47 +02:00
578b529199
Add CredentialsModule to Groups and Authors modules
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.
2024-10-08 15:41:32 +02:00
2fb2a16c56
Add machine creation endpoint
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.
2024-10-08 15:39:12 +02:00
64f9cd497f
Add HTTP status and implement file fetching
Included HTTP status code for the getFilesForMachine method. Implemented the service call to fetch files associated with a machine.
2024-10-08 14:00:04 +02:00
3844153340
Add method to retrieve files for a specific machine
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.
2024-10-08 13:57:06 +02:00
289ec09868
Add method to search machines with limit and offset
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.
2024-10-08 13:49:06 +02:00
52870aeb0d
Fix author parameter name in deleteAuthor method
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.
2024-10-08 13:42:54 +02:00
6600c6310a
Format import statements consistently
Refactored `import` statements in multiple files for consistent formatting. Grouped similar statements together and ensured single import per line for better readability.
2024-10-08 13:41:19 +02:00
84c66bcf05
Update routes for file retrieval in controllers
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.
2024-10-08 13:40:59 +02:00
0c94d16b19
Refactor authors controller and add admin guard
Renamed routes and incorporated `AdminGuard` for deletion. Adjusted parameter names and simplified function bodies to improve readability and security.
2024-10-08 13:38:29 +02:00
d69589c781
Add a TODO comment in groups.controller.ts
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.
2024-10-08 13:38:21 +02:00
d171c72dcf
Add TODO comments for future improvements
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.
2024-10-08 13:38:07 +02:00
e931822010
Refactor GroupsController with route updates and guards
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.
2024-10-08 13:29:34 +02:00
d3feeb6d6a
Add TODO placeholder for future patch implementation
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.
2024-10-08 13:29:22 +02:00
fd1742e9dc
Refactor response return statements in files controller
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.
2024-10-08 13:26:32 +02:00
392446fa06
Add CredentialsModule to MachinesModule imports
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.
2024-10-08 13:26:10 +02:00
f72b7ad9cb
Secure machine operations with AdminGuard
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.
2024-10-08 13:25:44 +02:00
ec8af843b5
Enhance file retrieval and search functionalities
Refined JSDoc comments for clearer API documentation. Added error handling in the search method and implemented search endpoint in the controller.
2024-10-08 12:19:51 +02:00
a0f5c3dab6
Refactor file saving logic and enhance logging
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.
2024-10-08 12:07:03 +02:00
711877bf60
Add primary key to FilesForMachinesTable
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.
2024-10-08 11:30:37 +02:00
b182d740bd
Update file handling and error reporting in storage service
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.
2024-10-08 11:30:26 +02:00
9d28d4f82a
Fix imports and add missing trailing comma
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.
2024-10-07 16:17:03 +02:00
30026df2d0
Add drizzle-kit scripts and update dependencies
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.
2024-10-07 16:15:15 +02:00
d909f67a4c
Switch to 'magic-bytes.js' for file type detection
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'.
2024-10-07 16:12:31 +02:00
ef8ba655f3
Add 'drizzle' to .gitignore
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.
2024-10-07 15:45:02 +02:00
933dded12e
Implement file saving service in files controller
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.
2024-10-07 12:04:19 +02:00
ceef9f94b6
Update schema to remove default values and add new table
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'.
2024-10-07 12:01:29 +02:00
65118e9465
Fix indentation and quote style in MachinesService
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.
2024-10-07 12:01:20 +02:00
66ca040807
Refactor indentation and import statements.
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.
2024-10-07 12:01:13 +02:00
07d65484c3
Add DbModule import to GroupsModule
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.
2024-10-07 12:01:07 +02:00
e9277ba763
Reorder imports in groups.dto.ts
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.
2024-10-07 12:01:01 +02:00
7e8d6e73eb
Refactor import statements and clean up code
Standardized import quotes in groups controller and reorganized import statements for better readability. Removed unnecessary line breaks in newGroup method.
2024-10-07 12:00:54 +02:00
ef5349063d
Enhance files service to save file data
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.
2024-10-07 12:00:46 +02:00
46b090c366
Align import and property formatting in files.dto.ts
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.
2024-10-07 12:00:37 +02:00
534560bae5
Refactor files.controller.ts and add uploaded_by header
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.
2024-10-07 12:00:30 +02:00
aecc22a733
Fix syntax issues in auth.guard.ts
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.
2024-10-07 12:00:23 +02:00
1818fcfe88
Enhance file upload handling in FilesController
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.
2024-10-04 11:35:23 +02:00
db700241a8
Add InsertAdminState guard to check admin status
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.
2024-10-04 11:35:12 +02:00