-
Notifications
You must be signed in to change notification settings - Fork 0
Feature update products #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR transforms a general product catalog into a heavy equipment marketplace by updating product data models and adding comprehensive seed data for construction equipment, parts, and components.
- Updates Product type to include heavy equipment specific fields (stockQty, specs with modelYear/warranty/compatibility)
- Changes price handling from string to number format with higher price ranges (thousands instead of tens)
- Adds extensive seed data with new categories (dump trucks, hydraulics, filters, undercarriage) and brands (Volvo, Hitachi, John Deere)
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| frontend/src/app/shop/page.tsx | Updates product type definitions, price formatting, stock-based availability logic, and UI text for heavy equipment marketplace |
| backend/prisma/seed.ts | Adds new categories, brands, and comprehensive product data for heavy equipment with detailed specifications |
| compatibleMakes: ['Caterpillar'], | ||
| modelYear: 2024, | ||
| condition: 'New', | ||
| availability: 'In stock' |
Copilot
AI
Jul 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'availability' field in specs appears to be redundant since availability is now calculated from stockQty in the frontend. Consider removing this field to avoid potential inconsistencies between the calculated availability and this hardcoded value.
| availability: 'In stock' | |
| // availability field removed |
| compatibleMakes?: string[]; | ||
| warranty?: string; | ||
| genuine?: boolean; | ||
| [key: string]: any; |
Copilot
AI
Jul 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'any' type reduces type safety. Consider defining a more specific interface for the specs object or using a union type for known properties to maintain better type checking.
| [key: string]: any; | |
| [key: string]: string | number | boolean | string[] | undefined; |
|
|
||
| async function fetchProducts(): Promise<Product[]> { | ||
| const res = await fetch('http://localhost:5000/api/products', { | ||
| const res = await fetch('http://localhost:3000/api/products', { |
Copilot
AI
Jul 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded localhost URL will fail in production. Consider using environment variables or relative URLs that work across different environments.
| {getUniqueValues('condition').map((condition, index) => ( | ||
| <option key={`condition-${index}`} value={condition.toLowerCase()}> |
Copilot
AI
Jul 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using array index as part of the key is not optimal and could cause issues. Since conditions should be unique, use the condition value itself as the key: key={condition}
| {getUniqueValues('condition').map((condition, index) => ( | |
| <option key={`condition-${index}`} value={condition.toLowerCase()}> | |
| {getUniqueValues('condition').map((condition) => ( | |
| <option key={condition} value={condition.toLowerCase()}> |
added products in seed.ts and updated shop/page.tsx