89 Commits

Author SHA1 Message Date
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
221410dfb0
Refactor getGroupsByName to streamline database call
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.
2024-10-03 13:52:45 +02:00
b2d084af4a
Implement search functionality and DTO for file operations
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.
2024-10-03 13:52:31 +02:00
e03d16bdb4
Add constructor to MachinesService with DbService injection.
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.
2024-10-03 12:08:47 +02:00
da5c15e5b9
Remove uploader field from schema
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.
2024-10-03 12:08:39 +02:00
addcd4a798
Add initial methods for file uploading
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.
2024-10-03 12:08:29 +02:00
3eca2472c6
Add CreateGroupDto and integrate DbModule with GroupsService
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.
2024-10-03 12:08:17 +02:00
6b8ea9cd00
Refactor file service return type to StreamableFile
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.
2024-10-03 09:51:26 +02:00
56df921a9b
Refactor MIME type check in storage service
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.
2024-09-30 14:38:58 +02:00
fcb39250ca
Add new fields to schema
Introduce 'extension' and 'isDocumentation' fields to the database schema. These additions enhance file metadata and facilitate improved data management.
2024-09-30 14:34:59 +02:00
541dcda6a9
Add StorageModule and DbModule to FilesModule
This commit updates the FilesModule to import both StorageModule and DbModule. This enhances the functionality of the FilesModule by integrating database and storage services.
2024-09-30 14:34:48 +02:00
dc2e87615c
Switch file read to streamable and update method signatures
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.
2024-09-30 14:33:57 +02:00
040dada16c
Add ts-mockito library to project
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.
2024-09-30 14:33:39 +02:00
310a806c87
Remove file service tests and update get method parameter
Removed the `files.service.spec.ts` test file as it is no longer required. Updated the `get` method parameter in `files.service.ts` to use `fileId` instead of `checksum`, and adjusted the related logic for consistency.
2024-09-30 14:33:18 +02:00
4d7ae970bc
Add get method to FilesService
Implemented a method to fetch a file and its information based on checksum. Integrated database and storage services to retrieve and prepare file stream and metadata. Also handles scenarios where the file is not found or multiple entries exist for the same checksum.
2024-09-30 14:20:37 +02:00
ddf9ef4860
Add method to read file from storage
Introduced a new `read` method in `storage.service.ts` to fetch files from storage based on checksum, extension, and type. This method handles potential exceptions by throwing a `NotFoundException` if the file is not found.
2024-09-30 11:30:14 +02:00
e788f4945e
Add detailed processing and validation for new files
Enhanced the "new" method to include detailed documentation and parameters for file processing and validation. Introduced allowed MIME types as a parameter and logging for clearer file management.
2024-09-30 11:10:36 +02:00
fd8ad47cf7
Standardize code formatting for consistency
Update all NestJS imports to use double quotes instead of single quotes across multiple files. Adjusted indentation in various files to ensure uniform code style. These changes improve code readability and maintainability.
2024-09-30 08:46:45 +02:00
2aa132e511
Fix case and add TODO in storage service
Corrected the case for 'MIMEs' in comments for consistency. Added a TODO comment to clarify required file formats in the checkConditions function.
2024-09-26 14:56:52 +02:00
6523e34328
Add NotepadTextDashed icon to Documentation button
Updated the Documentation button to include a NotepadTextDashed icon from lucide-react. This change improves visual consistency and enhances user experience by aligning with the icon usage pattern established in the Accueil button.
2024-09-26 14:56:39 +02:00
cb6bd9f409
Remove Machine module and related files
Deleted MachineController, MachineModule, and associated tests to streamline the codebase. This simplifies the project structure by removing unused or redundant components.
2024-09-26 14:56:18 +02:00
f4393301a2
Refactor StorageService to include MIME type and size checks
Reorganized StorageService to incorporate MIME type validation and adjustable file size limits, enhancing file validation. Introduced new methods for checksum calculation and file information generation, and updated the StorageModule to import the DbModule for database interactions.
2024-09-24 12:29:11 +02:00
d42aaeda05
Add checksum field and unique constraint on type_name
Added a new 'checksum' field with a length of 64 characters to ensure data integrity. Additionally, enforced uniqueness on the 'type_name' to prevent duplicate entries.
2024-09-24 12:28:53 +02:00
bdadf51e54
Refactor layout and navigation on HomePage
Updated tsconfig.json to include paths for better imports. Modified layout.tsx and Header.tsx for improved styles. Refactored HomePage to use new state management and simplified components for better readability and navigation.
2024-09-23 16:17:31 +02:00