Actions
ClientProject #2811
openClientProject #2810: [Module] : Truck Stock
[API] : API develop & Integration for Truck Stock Module (Testing Only)
Description
Tasks:¶
1. Set Minimum Page Height in Layout
2. Implement All Truck Stock APIs
-
Set up API routes and fetch logic for all required endpoints.
-
Implement both:
-
Next.js API Routes (under
/app/api/v1/truck-stock...) - Fetch Functions (server-side use)
-
Next.js API Routes (under
-
API List to Integrate:
-
/makers-and-bodytypes -
/models/?makerId='' -
/products -
/sitemap -
/products/:id
-
3. Testing Purposes Only – No UI Design
-
Do not implement or style any design components.
-
The purpose of this task is to ensure that:
- API endpoints are reachable
- Data is correctly fetched
- Fetch functions return typed responses
4. Create Truck Stock API Service Functions
-
Set up reusable fetcher functions inside
services/truck-stock.ts -
Write type-safe wrappers for each API with proper TypeScript interfaces or types
-
Examples:
getTruckStockProducts()getTruckStockProductDetail(id: string)- etc.
5. Redis integration¶
- Maintian contastaint file using key value pair. (/lib.constants.ts)
MODELS: {
KEY: (id: string) => `getTruckModelCount-${id}`,
EXPIRE_TIME_IN_SECONDS: 60 * 60, // 1 hour
},
PRODUCTS: {
KEY: (searchParams: Record<string, string | number | string[]>) =>
`getTruckStockList-${JSON.stringify(searchParams)}`,
EXPIRE_TIME_IN_SECONDS: 60 * 60, // 1 hour
},
PRODUCT_DETAIL: {
KEY: (id: string) => `getTruckProductDetails-${id}`,
EXPIRE_TIME_IN_SECONDS: 60 * 60, // 1 hour
},
SITEMAP: {
KEY: "getAllTruckStockListForSeo",
EXPIRE_TIME_IN_SECONDS: 60 * 60 * 24, // 24 hours
},
Notes:¶
- Ensure all API calls are async and handle error states gracefully.
- Keep console logs or JSON previews for now (for verification).
- This issue is preparatory — future issues will focus on UI rendering and interactivity.
Actions