Fix deprecated - #43
Conversation
…neration - Added a new `ReportCustomizationAPI` to allow users to customize design reports by selecting specific sections from generated LaTeX files. - Updated `CreateDesignReport` to support filtering of LaTeX content based on user-selected sections. - Improved error handling and user feedback during report generation processes. - Refactored UI components to integrate new customization features and enhance user experience. - Adjusted file path handling in `CreateDesignReport` for better compatibility and organization.
…uto-download functionality
…ation handling - Introduced new API endpoints for report generation, section parsing, and customization. - Enhanced error handling for LaTeX compilation by checking for pdflatex availability and providing user feedback. - Updated URL routing to include new report customization features.
…ections - Added boltTypeList to ModuleReducer and ModuleState for managing bolt types. - Implemented a helper function in InputSection to normalize lists into react-select options. - Enhanced default selection logic in InputSection to set initial values based on available options. - Updated finPlateConfig and seatedPlateConfig to use consistent bolt_type naming convention.
- Updated error responses in CAD generation to provide more specific messages for missing dependencies and macro files. - Improved error collection during CAD model generation, allowing for detailed feedback on partial failures. - Adjusted response status codes to better reflect the nature of errors encountered during the process. - Enhanced client-side error handling to display relevant messages to users based on server responses.
- Updated the validateInputs function to accept an additional parameter for extra state, allowing for improved connectivity handling. - Added validation to ensure that basic numeric loads are not empty, providing user feedback for incomplete fields. - Maintained existing validation checks for beam and column sections to ensure all required inputs are provided.
…upport and improved error handling - Added support for manifest files in the CAD generation process, allowing for per-part BREP references. - Updated the `open_brep_file.FCMacro` to handle manifest loading and object exporting more efficiently. - Enhanced error handling in the `create_cad_model` function to ensure robust processing of part shapes and file writing. - Improved logging for debugging purposes in the `btobRender` component, providing insights into parsed model structures and mesh details.
- Updated the `create_cad_model` function to include Weld and Bolt components in the part names for CAD generation. - Enhanced the `CommonDesignLogic` class to handle separate exports for Weld and Bolt models, improving the flexibility of the CAD export process.
- Added a hidden file input for importing OSI and YAML files, enabling users to load design data directly. - Integrated YAML parsing to extract module information and navigate to the corresponding route based on the imported data. - Enhanced session storage handling to prefill inputs for the engineering module based on the imported OSI file. - Updated the .gitignore to exclude OSI files and the osdag_gui directory.
- Introduced a detailed documentation file outlining the process for adding new design modules, covering backend and frontend integration. - Included step-by-step instructions for defining module keys, creating adapters, setting up URL routes, and implementing frontend components. - Provided examples and best practices to ensure consistency with existing modules, enhancing the overall development experience.
- Deleted unused .aux files from design report storage. - Updated CAD generation API to remove FreeCAD dependency and directly handle GLB files. - Enhanced seated angle connection module to support GLB export using RWGltf. - Changed import statements from `importlib.resources` to `importlib_resources` for compatibility. - Updated Simply Supported Beam module documentation to clarify Django flow and backend integration. - Modified database password in settings for security. - Cleaned up UI strings in the frontend for better readability.
- Removed the unused `.module_nav` CSS class to clean up styles. - Introduced `activeSubSubmodule` state in `ModulesCardLayout` to manage sub-submodule selection. - Updated content filtering logic to display sections based on the selected sub-submodule. - Refactored `SectionCards` component to remove unnecessary label rendering. - Replaced `InputDock` and `OutputDock` components with `BaseInputDock` and `BaseOutputDock` for improved modularity and clarity.
… minor ui changes - Updated `SaveOsiFromInputs` API to allow guest users to generate OSI files for download without saving to the database. - Implemented base64 encoding for OSI file content to facilitate download for guests. - Adjusted response structure to differentiate between guest and authenticated user responses. - Refactored frontend components to support the new OSI file handling logic, including download functionality for guest users.
- Updated `CADGeneration` class to prefer STL files over BREP for model exports, enhancing file handling and user experience. - Introduced a new `write_stl` function in `mesh_export.py` for STL file generation, ensuring proper tessellation and error handling. - Enhanced `create_cad_model` function to write STL files for individual parts and merged models, improving output consistency. - Updated `btobRender` component to support loading STL files, allowing for better visualization of CAD models in the frontend.
- Removed unused CSS classes from `App.css` to streamline styles. - Replaced disabled input fields with a new `ValueBox` component in `BaseOutputDock` for improved readability and user experience. - Added a dark/light mode toggle in `EngineeringModule` with persistent theme settings. - Deleted the `ViewerSection` component as part of a refactor to simplify the codebase.
- removed console.logs clutter. - fixed few minor bugs
- Introduced module key assignment for the FinPlateConnection class to enhance design report generation functionality.
- Fixed the path existence check in `CreateDesignReport` to ensure proper directory creation. - Reduced sleep duration from 10 seconds to 3 seconds in the design report generation process for improved performance. - Enhanced logger message handling in `reportGenerator_latex` to support both string and dictionary formats, ensuring consistent logging output across different connection types.
- Introduced a comprehensive pre-PR checklist in `WEBSITE_PRE_PR_CHECKLIST.md` to streamline the review process and ensure all necessary steps are followed before submitting a pull request. - Added a new `dev` script in `package.json` to simplify the development server startup for the frontend.
- Introduced a new pull request template in `.github/pull_request_template.md` to standardize PR submissions. - The template includes sections for related issues, descriptions, testing instructions, and a checklist to ensure all necessary steps are completed before review.
- Added optional `module`, `submodule`, and `inputs_json` fields to the `Project` model for improved project organization and data storage. - Introduced `ProjectOsiDownload` API endpoint to allow authenticated users to download OSI files associated with their projects. - Updated existing OSI handling logic to support new project fields and ensure compatibility with both guest and authenticated users. - Refactored frontend components to accommodate changes in project data structure and enhance user experience.
Replaced the Output dock label
- beam_column_end_plate: add Column/Beam designations and consolidate Plate/Bolt/Weld info into the Plate hover entry (fused mesh) - beam_beam_end_plate_splice: same consolidation for Plate hover - column_end_plate: same consolidation for Plate hover - end_plate_connection (Header Plate): fix bolt_count to use output[0][12] to avoid potential AttributeError on plate.bolt_line - fin_plate_connection: consolidate Plate/Bolt/Weld hover; add Column/Beam designations - cleat_angle_connection: add Column/Beam designations; use Angle key with ISA designation and bolt details - seated_angle_connection: add hover_dict entries for Angle and Bolt - SmartPart.jsx: add 'cleatangle' -> 'Angle' semantic alias so cleatAngle CAD mesh resolves the correct hover_dict key - SceneManager.jsx, EngineeringModule.jsx: related 3D viewer improvements
…rors - Added 'Cover Plate' key to hover_dict in cover plate connection files to match 'coverplate' mesh alias in SmartPart.jsx, ensuring tooltips display correct dimensions. - Fixed AttributeError crashes in Column-Column Splice designs by using getattr with safe defaults for dynamically assigned attributes (flange_out_plate_tk, Reduction_factor_flange, weld strength, etc.).
…ver tooltip formatting
fix: standardize hover tooltips across all modules
- Eliminated legacy action handlers in ModuleReducer for improved clarity and maintainability. - Updated ModuleState to remove deprecated compatibility functions, encouraging the use of core functions. - Refactored component interactions to utilize manageDesignPreferences for material updates, enhancing consistency across modals. - Adjusted design preference configurations to reflect new material handling methods.
- Updated multiple section modals to utilize a consistent approach for managing material lists by integrating `materialsFromParent` and `ctxMaterialList`. - Enhanced the filtering logic for materials based on `Grade` - Improved the handling of material selection in dropdowns across various components
- Introduced a new app for managing user-owned custom sections, including models for UserCustomBeam, UserCustomColumn, UserCustomAngle, and UserCustomChannel. - Added serializers and views for CRUD operations on custom sections, supporting import/export functionality via Excel. - Implemented validation and utility functions for handling custom section data, ensuring integrity and user-specific access. - Enhanced API responses to include user-specific designations in material options across various modules.
- Replaced the deprecated ViewCubeWidget with the new ViewCube component from @geo-mpy/viewcube-react. - Updated CadScene to utilize the new ViewCube, improving the user interface for 3D model navigation. - Removed obsolete view cube utility functions and widget files to streamline the codebase.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR appears to modernize / replace deprecated legacy backend pieces by introducing a new registry-based module discovery pattern, adding new module service layers (compression member + base plate), and reworking parts of the core API/auth/cad utilities while removing legacy desktop/help/crash-reporting assets.
Changes:
- Added new Django/DRF module scaffolding (services, adapters, registries, urls) for
compression_memberandbase_plate. - Introduced new
apps.coreutilities (validation, errors, CAD mesh export), module discovery (module_finder), and Firebase auth middleware + endpoints. - Added Dockerfile and removed large sets of legacy files (Sphinx build artifacts, crash reporter UI, old version files, Travis config).
Reviewed changes
Copilot reviewed 181 out of 1714 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/apps/modules/compression_member/urls.py | Adds DRF router URLs for compression member endpoints |
| backend/apps/modules/compression_member/tmp_cad/eaff29b8-10f2-47e4-a388-c3d3bac36084/Model.brep | Adds tmp CAD artifact placeholder file |
| backend/apps/modules/compression_member/tmp_cad/95847d5d-1140-4fef-a762-cfac12dc8f5a/Model.brep | Adds tmp CAD artifact placeholder file |
| backend/apps/modules/compression_member/tmp_cad/401bd20f-ba43-46c2-8cec-14ce9ac13fb2/Model.brep | Adds tmp CAD artifact placeholder file |
| backend/apps/modules/compression_member/tmp_cad/12f533fc-74e0-4780-814e-c8f55a18db19/Model.brep | Adds tmp CAD artifact placeholder file |
| backend/apps/modules/compression_member/submodules/struts_bolted/service.py | Adds service layer wrapper for Struts Bolted submodule |
| backend/apps/modules/compression_member/submodules/struts_bolted/init.py | Exposes MODULE_ID and Service for auto-discovery |
| backend/apps/modules/compression_member/submodules/axially_loaded_column/service.py | Adds service layer wrapper for Axially Loaded Column submodule |
| backend/apps/modules/compression_member/submodules/axially_loaded_column/init.py | Exposes MODULE_ID and Service for auto-discovery |
| backend/apps/modules/compression_member/submodules/init.py | Declares compression member submodules package |
| backend/apps/modules/compression_member/service.py | Adds compression member service wrapper around adapter functions |
| backend/apps/modules/compression_member/registry.py | Adds registry that auto-discovers compression member submodules |
| backend/apps/modules/compression_member/adapter.py | Adds adapter implementation for compression member module |
| backend/apps/modules/compression_member/init.py | Declares compression member module id and service export |
| backend/apps/modules/base_plate/views.py | Adds BasePlate DRF ViewSet (design/options/cad) using new helpers |
| backend/apps/modules/base_plate/urls.py | Adds DRF router URLs for base plate endpoints |
| backend/apps/modules/base_plate/service.py | Adds base plate service wrapper around adapter functions |
| backend/apps/modules/base_plate/init.py | Declares base plate module id and service export |
| backend/apps/modules/init.py | Declares modules package |
| backend/apps/core/views.py | Adds Firebase auth endpoint + legacy design type endpoints |
| backend/apps/core/utils/validation.py | Adds shared validation helpers (type checks, conversions) |
| backend/apps/core/utils/tests/test_report_image_generator.py | Adds unit tests for report image generation utility module |
| backend/apps/core/utils/tests/init.py | Declares utils tests package |
| backend/apps/core/utils/module_helpers.py | Adds shared helpers for guest/user detection + project saving |
| backend/apps/core/utils/mesh_export.py | Adds STL export helper using OCC tessellation |
| backend/apps/core/utils/errors.py | Adds consistent error types + error response formatting |
| backend/apps/core/utils/init.py | Re-exports core utility helpers for convenience imports |
| backend/apps/core/urls.py | Adds centralized core URL routing using new api package exports |
| backend/apps/core/tests/test_design_pref_sync.py | Adds tests for design preference sync/defaults logic and APIs |
| backend/apps/core/serializers.py | Updates serializers (notably removing token serializer usage) |
| backend/apps/core/registry.py | Adds BaseModuleRegistry for submodule auto-discovery |
| backend/apps/core/permissions.py | Adds IsEmailVerified permission based on Firebase metadata |
| backend/apps/core/module_finder.py | Adds registry-based module discovery with legacy fallback |
| backend/apps/core/migrations/0011_project_outputs_json.py | Adds outputs_json field to Project model |
| backend/apps/core/migrations/0010_alter_osifile_file.py | Alters OsiFile file storage settings |
| backend/apps/core/migrations/0009_useraccount_user_alter_osifile_file_and_more.py | Adds Django User FK to UserAccount + alters file storage |
| backend/apps/core/migrations/0008_project_inputs_json_project_module_project_submodule.py | Adds JSON inputs + module/submodule fields to Project |
| backend/apps/core/migrations/0007_osifile_remove_project_input_values_and_more.py | Refactors Project persistence + introduces OsiFile model |
| backend/apps/core/migrations/0006_project_alter_userproject_unique_together_and_more.py | Introduces Project model + removes older user project models |
| backend/apps/core/migrations/0005_add_unique_constraint_userproject.py | Adjusts legacy UserProject uniqueness constraint |
| backend/apps/core/migrations/0004_userproject_calculation_timestamp_and_more.py | Adds fields to legacy UserProject model |
| backend/apps/core/migrations/0003_userproject_input_fields_userproject_last_opened.py | Adds input_fields/last_opened to legacy UserProject model |
| backend/apps/core/migrations/0002_userproject_usermoduleactivity.py | Introduces legacy user project tracking models |
| backend/apps/core/middleware/firebase_auth.py | Adds FirebaseAuthentication for DRF token verification + user sync |
| backend/apps/core/middleware/init.py | Declares middleware package |
| backend/apps/core/data/design_types.py | Adds static design type / connections catalog data |
| backend/apps/core/apps.py | Adds OsdagConfig app configuration |
| backend/apps/core/api/projects/init.py | Adds re-export layer for project APIs |
| backend/apps/core/api/modules/modules_api.py | Adds Modules API that sources module discovery from new module_finder |
| backend/apps/core/api/modules/init.py | Adds modules API package exports |
| backend/apps/core/api/design/tests/test_design_report_with_images.py | Adds smoke tests for report endpoints (legacy + slug-based) |
| backend/apps/core/api/design/tests/init.py | Declares design API tests package |
| backend/apps/core/api/design/design_pref_sync_api.py | Adds stateless design preference sync endpoint |
| backend/apps/core/api/design/design_pref_defaults_api.py | Adds defaults resolution endpoint for design preferences |
| backend/apps/core/api/design/design_pref_api.py | Updates preference/material endpoints to be stateless |
| backend/apps/core/api/design/init.py | Adds design API package exports |
| backend/apps/core/api/cad/cad_model_download.py | Adds CAD download endpoint to serve generated CAD files |
| backend/apps/core/api/cad/init.py | Adds CAD API package exports |
| backend/apps/core/api/auth/user_view.py | Updates OSI upload/download endpoints post-Firebase auth migration |
| backend/apps/core/api/auth/jwt_api.py | Keeps JWT test endpoint (now alongside Firebase setup) |
| backend/apps/core/api/auth/google_sso_api.py | Keeps GoogleSSO placeholder endpoint |
| backend/apps/core/api/auth/init.py | Adds auth API package exports |
| backend/apps/core/api/init.py | Adds core API re-export surface |
| backend/apps/core/admin.py | Registers core models in admin site |
| backend/apps/init.py | Declares apps package |
| backend/init.py | Declares backend package |
| _version.py | Removes old version pin file |
| init.py | Removes old package version re-export |
| SectionModeller_Latex.py | Removes legacy LaTeX report generator script |
| ResourceFiles/html_page/make.bat | Removes legacy Sphinx build script |
| ResourceFiles/html_page/conf.py | Removes legacy Sphinx configuration |
| ResourceFiles/html_page/_build/html/searchindex.js | Removes generated Sphinx artifact |
| ResourceFiles/html_page/_build/html/search.html | Removes generated Sphinx artifact |
| ResourceFiles/html_page/_build/html/genindex.html | Removes generated Sphinx artifact |
| ResourceFiles/html_page/_build/html/_static/sidebar.js | Removes generated Sphinx artifact |
| ResourceFiles/html_page/_build/html/_static/pygments.css | Removes generated Sphinx artifact |
| ResourceFiles/html_page/_build/html/_static/documentation_options.js | Removes generated Sphinx artifact |
| ResourceFiles/html_page/_build/html/_static/custom.css | Removes generated Sphinx artifact |
| ResourceFiles/html_page/_build/html/_static/classic.css | Removes generated Sphinx artifact |
| ResourceFiles/html_page/_build/html/Example_1.2.2.1.3.2.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.2.1.3.2.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.2.1.3.1.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.2.1.3.1.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.2.1.2.2.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.2.1.2.2.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.2.1.2.1.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.2.1.2.1.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.2.1.1.2.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.2.1.1.2.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.2.1.1.1.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.2.1.1.1.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.1.2.3.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.1.2.3.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.1.2.2.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.1.2.2.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.1.2.1.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.1.2.1.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.1.1.1.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.2.1.1.1.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.4.2.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.4.2.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.4.1.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.4.1.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.3.3.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.3.3.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.3.2.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.3.2.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.3.1.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.3.1.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.2.3.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.2.3.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.2.2.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.2.2.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.2.1.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.2.1.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.1.3.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.1.3.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.1.2.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.1.2.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.1.1.2.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/Example_1.1.1.1.1.osi | Removes generated/packaged example OSI file |
| ResourceFiles/html_page/_build/html/DesignReport_1.2.1.1.1.osi | Removes generated/packaged design report example |
| ResourceFiles/html_page/_build/html/.buildinfo | Removes generated Sphinx build metadata |
| ResourceFiles/html_page/Makefile | Removes legacy Sphinx build Makefile |
| Dockerfile | Adds container build instructions for the backend runtime |
| APP_CRASH/forms/qcrash.qrc | Removes legacy crash reporter assets |
| APP_CRASH/forms/dlg_review.ui | Removes legacy crash reporter UI |
| APP_CRASH/forms/dlg_report_bug.ui | Removes legacy crash reporter UI |
| APP_CRASH/forms/dlg_github_login.ui | Removes legacy crash reporter UI |
| APP_CRASH/Appcrash/qt.py | Removes legacy crash reporter Qt-binding shim |
| APP_CRASH/Appcrash/formatters/markdown.py | Removes legacy crash reporter formatter |
| APP_CRASH/Appcrash/formatters/email.py | Removes legacy crash reporter formatter |
| APP_CRASH/Appcrash/formatters/base.py | Removes legacy crash reporter formatter base |
| APP_CRASH/Appcrash/backends/email.py | Removes legacy crash reporter backend |
| APP_CRASH/Appcrash/backends/base.py | Removes legacy crash reporter backend base |
| APP_CRASH/Appcrash/backends/init.py | Removes legacy crash reporter backend exports |
| APP_CRASH/Appcrash/backends/GITHUB.py | Removes legacy crash reporter GitHub backend |
| APP_CRASH/Appcrash/api.py | Removes legacy crash reporter API |
| APP_CRASH/Appcrash/_hooks.py | Removes legacy crash reporter exception hook |
| APP_CRASH/Appcrash/_forms/dlg_review_ui.py | Removes generated Qt form python |
| APP_CRASH/Appcrash/_forms/dlg_report_bug_ui.py | Removes generated Qt form python |
| APP_CRASH/Appcrash/_forms/dlg_github_login_ui.py | Removes generated Qt form python |
| APP_CRASH/Appcrash/_dialogs/review.py | Removes legacy crash reporter dialog |
| APP_CRASH/Appcrash/_dialogs/report.py | Removes legacy crash reporter dialog |
| APP_CRASH/Appcrash/_dialogs/gh_login.py | Removes legacy crash reporter dialog |
| APP_CRASH/Appcrash/init.py | Removes legacy crash reporter package marker |
| .travis.yml | Removes legacy Travis CI configuration |
| .env | Adds frontend base URL environment file |
| .dockerignore | Ignores frontend directory during docker build context |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def get(self,request: HttpRequest) -> HttpResponse: | ||
| module_data = json.dumps(module_dict) # Convert module data to json. | ||
| response = HttpResponse(status=200) # Status code 200 - success. | ||
| response["content-type"] = "application/json" # Set content-type header to json. | ||
| response.write(module_data) # Write module data to http response body. | ||
| return response |
There was a problem hiding this comment.
json.dumps(module_dict) will fail because module_dict values are adapter/service objects and are not JSON-serializable. Return a JSON-safe payload instead (e.g., json.dumps(sorted(module_dict.keys())) or json.dumps(developed_modules)), or build a dict containing only primitive metadata (module_id/slug/name).
| def get(self, request) : | ||
| print('inside the JWTHomeView get') | ||
|
|
||
| content = {'message' , 'Welcome to the JWT Authentication page'} |
There was a problem hiding this comment.
content = {'message' , 'Welcome ...'} creates a set, not a dict, so the response shape is wrong and may break clients. Use a dict with a key/value pair for the message.
| content = {'message' , 'Welcome to the JWT Authentication page'} | |
| content = {'message': 'Welcome to the JWT Authentication page'} |
|
|
||
| print('APIview under development') | ||
|
|
||
| return Response({'message' , 'GoogleSSO under development'} , status = status.HTTP_200_OK) |
There was a problem hiding this comment.
Response({'message' , 'GoogleSSO under development'}) creates a set rather than a JSON object. Return a dict (e.g., { 'message': '...' }) so the API response is valid JSON.
| return Response({'message' , 'GoogleSSO under development'} , status = status.HTTP_200_OK) | |
| return Response({'message': 'GoogleSSO under development'} , status = status.HTTP_200_OK) |
| allowed_formats = ["obj", "brep", "step", "iges"] | ||
| if format_type.lower() not in allowed_formats: | ||
| return JsonResponse({"status": "error", "message": "Invalid format type requested."}, status=400) | ||
|
|
||
| # Path setup | ||
| if format_type == "obj": | ||
| file_path = os.path.join("frontend", "public", f"output-{section.lower()}.obj") | ||
| else: | ||
| file_path = os.path.join("file_storage", "cad_models", f"{request_id}_{section}.{format_type.lower()}") | ||
|
|
||
| if not os.path.exists(file_path): | ||
| return JsonResponse({"status": "error", "message": f"{format_type.upper()} file does not exist."}, status=404) | ||
|
|
||
| # Serve file | ||
| response = FileResponse(open(file_path, 'rb'), content_type='application/octet-stream') | ||
| response['Content-Disposition'] = f'attachment; filename="{request_id}_{section}.{format_type}"' |
There was a problem hiding this comment.
Format validation uses format_type.lower(), but the path branch compares format_type == 'obj' without lowercasing. If the client sends OBJ, it will pass validation but take the non-obj branch and build the wrong path. Normalize once (e.g., fmt = format_type.lower()) and use fmt consistently.
| allowed_formats = ["obj", "brep", "step", "iges"] | |
| if format_type.lower() not in allowed_formats: | |
| return JsonResponse({"status": "error", "message": "Invalid format type requested."}, status=400) | |
| # Path setup | |
| if format_type == "obj": | |
| file_path = os.path.join("frontend", "public", f"output-{section.lower()}.obj") | |
| else: | |
| file_path = os.path.join("file_storage", "cad_models", f"{request_id}_{section}.{format_type.lower()}") | |
| if not os.path.exists(file_path): | |
| return JsonResponse({"status": "error", "message": f"{format_type.upper()} file does not exist."}, status=404) | |
| # Serve file | |
| response = FileResponse(open(file_path, 'rb'), content_type='application/octet-stream') | |
| response['Content-Disposition'] = f'attachment; filename="{request_id}_{section}.{format_type}"' | |
| fmt = format_type.lower() | |
| allowed_formats = ["obj", "brep", "step", "iges"] | |
| if fmt not in allowed_formats: | |
| return JsonResponse({"status": "error", "message": "Invalid format type requested."}, status=400) | |
| # Path setup | |
| if fmt == "obj": | |
| file_path = os.path.join("frontend", "public", f"output-{section.lower()}.obj") | |
| else: | |
| file_path = os.path.join("file_storage", "cad_models", f"{request_id}_{section}.{fmt}") | |
| if not os.path.exists(file_path): | |
| return JsonResponse({"status": "error", "message": f"{format_type.upper()} file does not exist."}, status=404) | |
| # Serve file | |
| response = FileResponse(open(file_path, 'rb'), content_type='application/octet-stream') | |
| response['Content-Disposition'] = f'attachment; filename="{request_id}_{section}.{fmt}"' |
| old_stdout = sys.stdout # Backup log | ||
| sys.stdout = open(os.devnull, "w") # redirect stdout | ||
| sys.stdout = old_stdout # Reset log | ||
|
|
||
|
|
There was a problem hiding this comment.
This opens os.devnull but never closes it (file handle leak), and the redirection has no effect because stdout is immediately restored. Remove these lines, or if you need to silence output during a specific operation, use a context manager and ensure the file is closed.
| old_stdout = sys.stdout # Backup log | |
| sys.stdout = open(os.devnull, "w") # redirect stdout | |
| sys.stdout = old_stdout # Reset log |
| # Initialize Firebase Admin SDK | ||
| # TODO: Move this to a better place (e.g., AppConfig ready method) and use environment variables for path | ||
| if not firebase_admin._apps: | ||
| # Try to find the credential file | ||
| # Prefer service account placed in backend/firebase-service-account.json | ||
| repo_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) # .../backend | ||
| cred_candidates = [ | ||
| os.path.join(repo_root, "firebase-service-account.json"), | ||
| os.path.join(repo_root, "config", "firebase-service-account.json"), | ||
| "osdag_web/firebase-service-account.json", # legacy location | ||
| ] | ||
| cred_path = next((p for p in cred_candidates if os.path.exists(p)), None) |
There was a problem hiding this comment.
Firebase initialization (filesystem probing + initialize_app) is happening at module import time, which can cause side effects during management commands, migrations, and WSGI startup and can create noisy output. Move this initialization to an AppConfig ready() (or a dedicated startup module) and use environment-based configuration; also prefer structured logging over print() for warnings.
| # Auto-discover sub-modules | ||
| print("[CompressionMemberRegistry] Starting auto_discover...") | ||
| _package_name = 'apps.modules.compression_member.submodules' | ||
| _package_path = os.path.join(os.path.dirname(__file__), 'submodules') | ||
| print(f"[CompressionMemberRegistry] Package path: {_package_path}") | ||
| CompressionMemberRegistry.auto_discover(_package_name, _package_path) | ||
|
|
||
| # Debug: print registered modules | ||
| print(f"[CompressionMemberRegistry] Registered slugs: {list(CompressionMemberRegistry._registry.keys())}") | ||
| print(f"[CompressionMemberRegistry] Module ID map: {CompressionMemberRegistry._module_id_map}") |
There was a problem hiding this comment.
Running auto-discovery and emitting debug output at import time makes imports have side effects and can clutter logs in production. Consider moving auto_discover(...) into the Django app startup path (e.g., AppConfig.ready) and replace print(...) with the project logging framework (and guard debug logs behind a log level).
| @@ -0,0 +1 @@ | |||
| No CAD model produced for this input (empty). No newline at end of file | |||
There was a problem hiding this comment.
These tmp_cad/.../Model.brep files look like generated runtime artifacts rather than source-controlled assets. Keeping them in git can bloat the repo and create churn. Consider removing them from the PR and adding the tmp_cad/ (or the output directory used by CAD generation) to .gitignore, or store sample CAD fixtures under a dedicated fixtures/ directory if they’re needed for tests.
| No CAD model produced for this input (empty). |
| """Test when Open3D is not installed""" | ||
| with patch.dict('sys.modules', {'open3d': None}): | ||
| with pytest.raises(ImportError): | ||
| import open3d | ||
| # Function should handle gracefully | ||
| # Note: This test may fail if open3d is actually installed | ||
| pass |
There was a problem hiding this comment.
This test doesn’t assert behavior of verify_open3d_available() and is effectively a no-op (pass). It also relies on importing open3d directly, which won’t reliably raise ImportError when sys.modules['open3d'] is set to None. Update the test to call verify_open3d_available() under controlled conditions and assert the returned boolean (e.g., patch apps.core.utils.report_image_generator.open3d import/usage paths to simulate missing/available Open3D).
| """Test when Open3D is not installed""" | |
| with patch.dict('sys.modules', {'open3d': None}): | |
| with pytest.raises(ImportError): | |
| import open3d | |
| # Function should handle gracefully | |
| # Note: This test may fail if open3d is actually installed | |
| pass | |
| """Test when Open3D is unavailable or unusable""" | |
| with patch('apps.core.utils.report_image_generator.open3d') as mock_o3d: | |
| mock_o3d.visualization.rendering.OffscreenRenderer.side_effect = ImportError( | |
| "Open3D not installed" | |
| ) | |
| result = verify_open3d_available() | |
| assert result is False |
| """ | ||
| Base Plate URLs | ||
| """ | ||
| from django.urls import path, include |
There was a problem hiding this comment.
path and include are imported but this file only exposes urlpatterns = router.urls. Remove unused imports to keep module URL configs minimal and avoid confusion about whether non-router URL patterns are expected here.
| from django.urls import path, include |
34997ee to
ded15b0
Compare
No description provided.