Refactor entire project structure to use NestJS for backend and Next.js for frontend#133
Refactor entire project structure to use NestJS for backend and Next.js for frontend#133simarjot0032 wants to merge 50 commits intoBRL-CAD:developmentfrom
Conversation
- fix: uploading porcess button label chnage
… using id - fix: on error it now return proper eoor code with status property
- made the explore page
- improvemnts in sidebar
- updated the framer motion
- updated the gitignore - added the env sample files
- Fixed the error disalpying on frontend
README.md
Outdated
| This project consists of two main modules: | ||
|
|
||
| ### 1. Conversion Module (Backend) | ||
| - **Repository**: [ogv-conversation-package](https://github.com/simarjotsingh/ogv-conversation-package) |
There was a problem hiding this comment.
We should have these packages under BRL-CAD org
README.md
Outdated
| - **Purpose**: Handles file uploads, conversion, and API endpoints | ||
|
|
||
| ### 2. Viewer Module (Frontend) | ||
| - **Repository**: [ogv-viewer-package](https://github.com/simarjotsingh/ogv-viewer-package) |
There was a problem hiding this comment.
We should have these packages under BRL-CAD org
| - [Lint](#lint) | ||
| - [Build and Deploy](#build-and-deploy) | ||
| - [Contribution](#contribution) | ||
| ## 🚀 Features |
There was a problem hiding this comment.
We must have a Table of Contents
There was a problem hiding this comment.
Fixed, added the table of contents.
| DATABASE_URL="postgresql://your_db_user:your_secure_password@localhost:5434/your_db_name" | ||
| CLOUDINARY_CLOUD_NAME="" | ||
| CLOUDINARY_API_KEY="" | ||
| CLOUDINARY_API_SECRET="" | ||
| UPLOAD_BASE_PATH="storage path" | ||
| UPLOAD_API_PATH="storage path" | ||
| RAW_FILES_PATH="storage path" | ||
| CONVERTED_TO_OBJ_PATH="storage path" | ||
| THUMBNAIL_PATH="storage path" | ||
| CONVERSION_API_PATH="storage path" | ||
| CONVERTER_INPUT_PATH="storage path" | ||
| CONVERTER_OUTPUT_PATH="storage path" | ||
| TEMP_FILES_PATH="storage path" No newline at end of file |
There was a problem hiding this comment.
We should have better documentation for sample.env
There was a problem hiding this comment.
Fixed, have added the comments as well as a proper definition in their respective README files.
| **OGV Backend** | ||
|
|
||
| This is the backend service for the Online Geometry Viewer (OGV) project. It handles file uploads, 3D model conversion using BRL-CAD, and provides REST API endpoints for the frontend application. | ||
|
|
||
| > 📖 **For complete setup instructions, environment configuration, and database setup, see the [main README](../README.md)** |
There was a problem hiding this comment.
Project setup should come first, and then API endpoints and examples, also add a TOC
There was a problem hiding this comment.
Fixed as well as fixed for the frontend too.
| CREATE TABLE "UploadModel" ( | ||
| "id" TEXT NOT NULL, | ||
| "thumbnailUrl" TEXT NOT NULL, | ||
| "title" TEXT NOT NULL, | ||
| "description" TEXT NOT NULL, | ||
| "category" TEXT NOT NULL, | ||
| "license" TEXT NOT NULL, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "status" TEXT NOT NULL DEFAULT 'active', |
There was a problem hiding this comment.
Do we really need migrations? since we just released the project
There was a problem hiding this comment.
Removed migration as well as the TOML extra file.
| export const InputFormats = [ | ||
| 'obj', | ||
| 'stl', | ||
| 'ply', | ||
| 'vrml', | ||
| '3mf', | ||
| 'asc', | ||
| 'x', | ||
| 'x3d', | ||
| '3ds', | ||
| 'dae', | ||
| 'fbx', | ||
| 'json', | ||
| 'assbin', | ||
| 'fbx', | ||
| 'g', |
There was a problem hiding this comment.
I believe we can use the existing mimetypes to type secure these objects
There was a problem hiding this comment.
Currently, I have removed the validation for the mime types because it was giving errors. We need the proper data for the mime files.
backend/src/constants/index.ts
Outdated
| @@ -0,0 +1 @@ | |||
| export * from './formarts'; | |||
|
|
||
| constructor(private readonly prisma: PrismaService) {} | ||
|
|
||
| @Cron(CronExpression.EVERY_MINUTE) |
There was a problem hiding this comment.
Isnt this too much for an operation like this?
There was a problem hiding this comment.
My initial thinking was that since we already default the expiration for the unknown licensed models to one hour, we were implicitly tracking it that way.
That said, based on your feedback, I’ve now updated it explicitly to every hour.
backend/src/upload/upload.service.ts
Outdated
| if (!request.file) { | ||
| return createError400('File is required'); | ||
| } | ||
|
|
||
| if (!request.thumbnailImage) { | ||
| return createError400('Thumbnail image is required'); | ||
| } | ||
|
|
||
| if (!request.title) { | ||
| return createError400('Title is required'); | ||
| } | ||
|
|
||
| if (!request.description) { | ||
| return createError400('Description is required'); | ||
| } | ||
|
|
||
| if (!request.category) { | ||
| return createError400('Category is required'); | ||
| } | ||
|
|
||
| if (!request.license) { | ||
| return createError400('License is required'); | ||
| } | ||
|
|
||
| if (!request.expiresIn) { | ||
| return createError400('Expires in is required'); | ||
| } | ||
|
|
||
| if (!request.userIP) { | ||
| return createError400('User IP is required'); | ||
| } |
There was a problem hiding this comment.
There has to be a better way for this
frontend/eslint.config.mjs
Outdated
| }, | ||
| }, | ||
| rules: { | ||
| '@typescript-eslint/no-explicit-any': 'off', | ||
| '@typescript-eslint/no-floating-promises': 'warn', | ||
| '@typescript-eslint/no-unsafe-argument': 'warn', | ||
| 'react/no-unescaped-entities': 'off', |
frontend/eslint.config.mjs
Outdated
| }, | ||
| }, | ||
| rules: { | ||
| '@typescript-eslint/no-explicit-any': 'off', |
| value={fileInformation.license} | ||
| onChange={handleLicenseChange} | ||
| > | ||
| {Licenses.map((license) => ( |
There was a problem hiding this comment.
Naming problem, this Licenses looks like a component
There was a problem hiding this comment.
Fixed and also added the index file for the data for easy import.
- Updated the nextjs
Technical Changes
Backend:
Frontend: