udpates on the ui changesand api integration
This commit is contained in:
112
docs/01_ENDPOINT_CATALOG.md
Normal file
112
docs/01_ENDPOINT_CATALOG.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# Fiesta / Workolik Endpoint Catalog
|
||||
|
||||
Source: `Fiesta_All_Endpoints_With_Tables_And_Params.xlsx` (103 endpoints) cross-referenced
|
||||
with the REST clients already in this repo (`src/services/api.ts` → Hasura `/hasura/*`,
|
||||
`src/services/fiestaApi.ts` → Fiesta `/fiesta/*`).
|
||||
|
||||
Legend for **Client** column:
|
||||
- ✅ **wired** — a function + TanStack hook already exists in this repo.
|
||||
- 🟡 **available** — endpoint exists on the backend (in the sheet) but we have **no client yet**; safe to add.
|
||||
- 🔴 **REVIEW_REQUIRED** — the sheet marks the table as `REVIEW_REQUIRED` (mostly POST/PUT auth & mutation routes); shape must be confirmed with backend before wiring.
|
||||
|
||||
> The sheet only documents GET read tables + a handful of mutations. It does **not**
|
||||
> contain any analytics/aggregation, time-series, alerting, telemetry, or audit-log
|
||||
> endpoints. Those gaps are listed in `03_REQUIRED_BACKEND_APIS.md`.
|
||||
|
||||
---
|
||||
|
||||
## App / Config
|
||||
| API | Method | Table | Params | Client |
|
||||
|---|---|---|---|---|
|
||||
| Utils | GET | app_types | tag | ✅ `getAppTypes` |
|
||||
| Resolve subcategories | GET | app_subcategory | moduleid, categoryid | ✅ `getSubcategory` |
|
||||
| System active geofence | GET | app_location | applocationid | ✅ `getAppLocations` |
|
||||
| Global system categories | GET | app_category | None | ✅ `getProductCategories`* |
|
||||
| Global payment & geofence configs | GET | app_config | configid | 🟡 available |
|
||||
| App location config | GET | app_locationconfig | applocationid | ✅ `getAppLocationConfig` |
|
||||
|
||||
## Users / Auth
|
||||
| API | Method | Table | Params | Client |
|
||||
|---|---|---|---|---|
|
||||
| Users list | GET | users | roleid, tenantid, pageno, pagesize, keyword | ✅ `getAllUsers` |
|
||||
| User profile by id | GET | users | userid | ✅ `getUserById` |
|
||||
| Tenant Web Panel Login | POST | REVIEW_REQUIRED | — | ✅ `loginRequest` (weblogin) |
|
||||
| General Application Login | POST | REVIEW_REQUIRED | authname, password, configid, userfcmtoken | ✅ `loginRequest` (applogin) |
|
||||
| Register Web Staff | POST | REVIEW_REQUIRED | — | ✅ `createUser` |
|
||||
| Update Web Staff | PUT | REVIEW_REQUIRED | — | ✅ `updateUser` |
|
||||
| App roles | GET | (approles) | configid | ✅ `getAppRoles` |
|
||||
|
||||
## Orders
|
||||
| API | Method | Table | Params | Client |
|
||||
|---|---|---|---|---|
|
||||
| Orders board | GET | orders | tenantid, locationid, status, pageno, pagesize | ✅ `getOrders` |
|
||||
| System Admin orders board | GET | orders | applocationid, status, pageno, pagesize | 🟡 available |
|
||||
| Order dashboard stats summary | GET | orders | tenantid, fromdate, todate | ✅ `getOrderSummary` |
|
||||
| Annual orders insights | GET | orders | tenantid | ✅ `getOrderInsight` |
|
||||
| Location orders summary | GET | deliveries | tenantid | ✅ `getLocationSummary` |
|
||||
| **Order detailed lines** | GET | orderdetails | orderheaderid | 🟡 **available — not wired (needed for line items)** |
|
||||
| Customer order history | GET | orders | customerid, status, pageno, pagesize | 🟡 available |
|
||||
| Create Web Order | POST | orders+orderdetails | — | 🔴 REVIEW_REQUIRED |
|
||||
| Update Order Status | PUT | orders | — | 🔴 REVIEW_REQUIRED |
|
||||
|
||||
## Deliveries
|
||||
| API | Method | Table | Params | Client |
|
||||
|---|---|---|---|---|
|
||||
| Deliveries board (master) | GET | deliveries | tenantid, fromdate, todate | ✅ `getDeliveries` |
|
||||
| Deliveries summary | GET | deliveries | tenantid, applocationid, fromdate, todate | ✅ `getDeliverySummary` |
|
||||
| Daily delivery insights | GET | deliveries | tenantid | ✅ `getDeliveryInsight` |
|
||||
| Location deliveries summary | GET | deliveries | tenantid | 🟡 available |
|
||||
| **Deliveries financial report summary** | GET | deliveries | tenantid, partnerid, userid, applocationid, fromdate, todate | 🟡 **available — needed for Reports revenue** |
|
||||
| **Fleet rider summary metrics** | GET | partneruser | applocationid, partnerid, tenantid, fromdate, todate | 🟡 **available — needed for fleet KPIs** |
|
||||
| Assign Rider / dispatch | POST | deliveries+deliverydetails | — | 🔴 REVIEW_REQUIRED |
|
||||
| Update pickup / delivered | PUT | deliveries | — | 🔴 REVIEW_REQUIRED |
|
||||
|
||||
## Partners / Riders
|
||||
| API | Method | Table | Params | Client |
|
||||
|---|---|---|---|---|
|
||||
| Active riders | GET | partneruser | partnerid, applocationid, userid, tenantid | ✅ `getRiders` |
|
||||
| Partner profiles | GET | partneruser | partnerid, applocationid, userid | 🟡 available |
|
||||
| Rider shifts | GET | partneruser | applocationid | ✅ `getRiderShifts` |
|
||||
| Rider log sheet | GET | riderlogs | partnerid, applocationid, fromdate, todate | 🟡 available |
|
||||
| Partners | GET | orders | partnerid, status, pageno, pagesize | ✅ `getPartners` |
|
||||
|
||||
## Tenants / Stores
|
||||
| API | Method | Table | Params | Client |
|
||||
|---|---|---|---|---|
|
||||
| All active tenants | GET | tenants | applocationid, status, pageno, pagesize | ✅ `getAllTenants` |
|
||||
| Tenant detail profile | GET | tenants | tenantid, locationid | ✅ `getTenantInfo` |
|
||||
| Tenant outlet locations | GET | tenantlocations | tenantid | ✅ `getTenantLocations` |
|
||||
| Tenant store staff | GET | tenantstaffs | tenantid | 🟡 available |
|
||||
| Logistics pricing slabs | GET | tenantpricing | tenantid, applocationid | 🟡 available |
|
||||
| Delivery time slots config | GET | tenantslot | None | 🟡 available |
|
||||
| Onboard tenant / store / location | POST/PUT | REVIEW_REQUIRED | — | 🔴 REVIEW_REQUIRED |
|
||||
|
||||
## Customers
|
||||
| API | Method | Table | Params | Client |
|
||||
|---|---|---|---|---|
|
||||
| Customers | GET | customers | customerid, contactno | ✅ `getCustomersByTenant`* |
|
||||
| Merchant customers list | GET | tenantcustomers | tenantid, locationid, pageno, pagesize, keyword | ✅ `getTenantCustomers` |
|
||||
| Customer order history | GET | orders | customerid, status, pageno, pagesize | 🟡 available |
|
||||
| Register / update customer | POST/PUT | REVIEW_REQUIRED | — | 🔴 REVIEW_REQUIRED |
|
||||
|
||||
## Products / Stock
|
||||
| API | Method | Table | Params | Client |
|
||||
|---|---|---|---|---|
|
||||
| Stock counts | GET | products | tenantid, categoryid, subcategoryid, approve | ✅ `getProductsCount` |
|
||||
| Global categories | GET | productcategories | None | ✅ `getProductCategories` |
|
||||
| Product subcategories | GET | productsubcategories | categoryid, tenantid | ✅ `getProductSubcategories` |
|
||||
| Product variants | GET | productvariants | tenantid, subcategoryid | ✅ `getProductVariants` |
|
||||
| Master catalog listings | GET | products | tenantid, locationid, subcategoryid, keyword, pageno, pagesize | 🟡 available |
|
||||
| **Live stocks catalog** | GET | productstocks | tenantid, locationid | 🟡 **available — real stock levels** |
|
||||
| Stock statement ledger | GET | product_stock_statement | tenantid, locationid, subcategoryid, pageno, pagesize, keyword | ✅ `getStockStatement` |
|
||||
| **Outlet geofenced inventory** | GET | productlocations | tenantid, locationid, subcategoryid, pageno, pagesize | 🟡 **available — per-outlet inventory** |
|
||||
| Create / update / delete product | POST/PUT/DELETE | REVIEW_REQUIRED | — | 🔴 REVIEW_REQUIRED |
|
||||
| Add multi-product stock entry | POST | REVIEW_REQUIRED | — | 🔴 REVIEW_REQUIRED |
|
||||
|
||||
## Invoice / Payments
|
||||
| API | Method | Table | Params | Client |
|
||||
|---|---|---|---|---|
|
||||
| Invoice insight | GET | invoice_insight | tenantid | ✅ `getInvoiceInsight` |
|
||||
| Payments | GET | paymentrequests | partnerid, status | 🟡 available |
|
||||
|
||||
\* Close match; verify exact route/shape against backend.
|
||||
173
docs/02_MOCK_DATA_GAP_ANALYSIS.md
Normal file
173
docs/02_MOCK_DATA_GAP_ANALYSIS.md
Normal file
@@ -0,0 +1,173 @@
|
||||
# Mock-Data → Live-API Gap Analysis
|
||||
|
||||
Goal: remove every hardcoded / mock value in `src/` and back it with a live API before staging.
|
||||
|
||||
Each row is classified:
|
||||
- **WIRE** — a live endpoint already exists (✅ or 🟡 in `01_ENDPOINT_CATALOG.md`); just connect it / remove the mock fallback.
|
||||
- **DERIVE** — no dedicated endpoint, but the value is computable client-side from data we already fetch (e.g. period-over-period deltas by querying two date ranges). No backend work needed.
|
||||
- **NEW API** — no endpoint exists and the value cannot be derived; backend must build it. Spec'd in `03_REQUIRED_BACKEND_APIS.md` under the referenced **[Rxx]** id.
|
||||
|
||||
Central mock source file to delete once empty: **`src/data.ts`**.
|
||||
|
||||
---
|
||||
|
||||
## 1. DashboardView.tsx *(mostly live already)*
|
||||
| UI element | Current source | Class | Target |
|
||||
|---|---|---|---|
|
||||
| Active Outlets / Total / % | live `useTenantLocations` + `useOrderSummary` | OK | — |
|
||||
| Region fulfilment %, delivered/total | live `useOrderSummary` | OK | — |
|
||||
| Monthly Revenue, Monthly Profit | live `useInvoiceInsight` | OK | — |
|
||||
| Per-location orders / dispatched / fulfilled % | live `useFiestaLocationSummary` | OK | — |
|
||||
| KPI card icons / gradients / static subtext labels | hardcoded | keep | cosmetic, not data |
|
||||
| Banner title "Executive Command Center", "Live Core" | hardcoded | keep | cosmetic |
|
||||
|
||||
**Dashboard is ~clean.** Only cosmetic strings remain.
|
||||
|
||||
---
|
||||
|
||||
## 2. ReportsView.tsx *(heaviest mock load)*
|
||||
| UI element | Current source | Class | Target |
|
||||
|---|---|---|---|
|
||||
| Orders KPI value / delivered / cancelled | live `useFiestaOrderSummary` | OK | — |
|
||||
| KPI trend deltas `+12.5%`, `+14.8%`, `-1.2%`, `+8.4%` | hardcoded | **DERIVE** | query current + previous period summary, compute % change |
|
||||
| Revenue value `= delivered × 355` | hardcoded multiplier | **NEW API** | **[R1] revenue summary** (real money, not a guess) |
|
||||
| Active SKU count | live stock length | OK | — |
|
||||
| `CHART_DATA_YTD` (12-mo orders/revenue/cancelled/skus) | hardcoded | **NEW API** | **[R2] order+revenue time-series** (orders partly via `getOrderInsight`; revenue & skus need [R1]/[R2]) |
|
||||
| `getDynamicChartData` month/12M/all-time series | hardcoded | **NEW API** | **[R2]** with `granularity=day|month|year` |
|
||||
| Region scaling multipliers (0.42 / 0.60 / 0.75…) | hardcoded fudge | **NEW API** | **[R2]** filtered by region/location — remove multipliers |
|
||||
| Monthly order heatmap — Coimbatore rows | live `useFiestaOrderInsight` | OK | — |
|
||||
| Monthly order heatmap — Chennai/Bangalore stub rows | hardcoded | **WIRE** | `getOrderInsight` returns all tenant locations; remove stubs |
|
||||
| `MONTH_LABELS`, `MONTH_KEYS` | hardcoded | keep | static axis labels |
|
||||
| Top-nodes leaderboard names / order counts | live (location summary) | OK | — |
|
||||
| Leaderboard **revenue** column | derived from order count | **NEW API** | **[R1]** revenue-per-location |
|
||||
| Product matrix rows | live `useFiestaStockStatement`→`stockRowToProduct` | OK | — |
|
||||
| `unitsSold`/`revenue` per product (mapper uses `debit`×`retailprice`) | approximated | **NEW API** | **[R3] product sales analytics** (true units sold + revenue) |
|
||||
| Expanded-row stock units (142/42/6), bar widths, hub split 60/40 | hardcoded | **WIRE/NEW** | per-outlet via `productlocations` 🟡; hub split = real `productstocks` |
|
||||
| Warehouse Bin `BIN-C…`, "Last Audited" date, barcode bars | hardcoded | **NEW API** | **[R3]** product meta (bin, last-audit) — or drop if not tracked |
|
||||
| Export progress modal | simulated | keep | client UX only |
|
||||
|
||||
---
|
||||
|
||||
## 3. InventoryView.tsx
|
||||
| UI element | Current source | Class | Target |
|
||||
|---|---|---|---|
|
||||
| Banner active-outlets count | live `useFiestaTenantLocations` | OK | — |
|
||||
| Banner total on-hand volume | live `useFiestaStoresStock` | OK | — |
|
||||
| Global catalog grid | live stock → `stockRowToProduct` | OK | — |
|
||||
| Optimal/Low/Critical hub counts | derived from live stock + thresholds | OK | thresholds are business rules, keep |
|
||||
| Per-store SKU lists, capacity bars | live `useFiestaStoresStock` | OK | — but prefer real capacity ([R3]) |
|
||||
| `initialImportLogs` (Live Sync Audit Stream) | mock `data.ts` | **NEW API** | **[R4] import/sync audit log** |
|
||||
| CSV import default template string | hardcoded | keep | UX template |
|
||||
| Nilgiris Dairy / Coimbatore Heritage presets | hardcoded | **WIRE** | catalog presets → `getAllTenants`/master catalog 🟡, or **NEW [R5]** |
|
||||
| Brand Design Studio (theme, colors, bag label, eco-seal) | hardcoded local state | **NEW API** | **[R6] merchant branding config** (GET+PUT) |
|
||||
| Add-Product modal category list | hardcoded | **WIRE** | `getProductCategories` / `getProductSubcategories` |
|
||||
| Add-Product modal default price/stock | hardcoded | keep | form defaults |
|
||||
|
||||
---
|
||||
|
||||
## 4. OperationsView.tsx
|
||||
| UI element | Current source | Class | Target |
|
||||
|---|---|---|---|
|
||||
| Inventory value, low-stock count, SKU count | live `useFiestaStockStatement` | OK | — |
|
||||
| Fulfillment Health `98.4%` | hardcoded | **DERIVE** | from order/delivery summary |
|
||||
| Forecast Efficiency `92%`, Cost savings `₹1.9L/week` | hardcoded | **NEW API** | **[R7] forecasting/insights** (or remove until modelled) |
|
||||
| Catalogue table rows | live `stockRowToProduct` | OK | — |
|
||||
| "Global Inventory Count 4,200 nodes" | hardcoded | **WIRE** | `getProductsCount` |
|
||||
| Catalogue verification toggle | local state only | **NEW API** | product update PUT 🔴 (REVIEW_REQUIRED) |
|
||||
| Import logs table | mock `data.ts` | **NEW API** | **[R4]** (same as Inventory) |
|
||||
| Schema-validator messages ("14 duplicate SKUs") | hardcoded | **NEW API** | **[R4]** import validation result |
|
||||
| Add-SKU / Transfer-Stock modals | local state mutation | **NEW API** | stock entry POST 🔴 + **[R8] stock transfer** |
|
||||
|
||||
---
|
||||
|
||||
## 5. OrdersDeliveriesView.tsx
|
||||
| UI element | Current source | Class | Target |
|
||||
|---|---|---|---|
|
||||
| KPI tiles (deliveries in range, pending, completed, fleet) | live `useFiestaDeliveries` | OK | — |
|
||||
| Date presets / range | client state | OK | — |
|
||||
| Order list rows | live `deliveryRowToOrder` | OK | — |
|
||||
| **Order line items** (`items: []` always empty) | empty / itemCount only | **WIRE** | **`orderdetails?orderheaderid=`** 🟡 (exists!) |
|
||||
| "Create Simulated Order" + MOCK_NAMES/STREETS/ITEMS | hardcoded generator | **NEW API** | replace with real Create-Order POST 🔴, or remove button |
|
||||
| Rider cards | live `useFiestaRiders` | OK | — |
|
||||
| Rider `rating 4.7` | hardcoded in mapper | **NEW API** | **[R9] rider telemetry/rating** |
|
||||
| Rider avatars | rotated stock photos | **WIRE** | user photo field if present, else keep placeholder |
|
||||
| GPS route SVG, "9 MINS", "1.2 km left", "GPS ACTIVE" | hardcoded | **NEW API** | **[R9]** live rider GPS/ETA |
|
||||
| Status-progression buttons (pack/dispatch/deliver) | local state | **NEW API** | order/delivery status PUT 🔴 (REVIEW_REQUIRED) |
|
||||
| Assign-rider action | local state | **NEW API** | assign-rider POST 🔴 (REVIEW_REQUIRED) |
|
||||
|
||||
---
|
||||
|
||||
## 6. StoreDetailView.tsx
|
||||
| UI element | Current source | Class | Target |
|
||||
|---|---|---|---|
|
||||
| Inventory tab list | live `useFiestaStockStatement` + mock fallback | **WIRE** | remove hardcoded fallback array |
|
||||
| Customers tab list | live `useFiestaTenantCustomers` + mock fallback | **WIRE** | remove hardcoded fallback array |
|
||||
| `intervalSlots` dispatch pipeline (morning rush %, etc.) | computed from `store.deliveries`×% | **NEW API** | **[R10] intraday dispatch buckets** |
|
||||
| `pastDaysLog` 7-day ledger | computed ×multipliers | **NEW API** | **[R2]** daily series per location |
|
||||
| KPI cards (OTIF 98.2%, est revenue, dispatches, active fleet) | hardcoded/derived | **WIRE/NEW** | OTIF & revenue need [R1]; fleet via `getRiders` |
|
||||
| `activeRiders` (battery, lastPing) | hardcoded | **NEW API** | **[R9]** rider telemetry |
|
||||
| Customer CRM order history (3 orders) | hardcoded | **WIRE** | `orders?customerid=` 🟡 |
|
||||
| Customer CRM metrics (CSAT 5.0) | hardcoded | **NEW API** | **[R11] customer analytics** (CSAT/AOV/retention) |
|
||||
| Customer search metrics (retention 88.4%, AOV ₹1,580, CSAT 4.9) | hardcoded | **NEW API** | **[R11]** |
|
||||
| `GLOBAL_CATALOGUE_ITEMS` modal | hardcoded | **WIRE** | master catalog listings 🟡 |
|
||||
| `resolveMetadata` price/image keyword map | hardcoded | **NEW API** | **[R3]** product image/price from catalog |
|
||||
| Store cover images | hardcoded array | keep | cosmetic asset set |
|
||||
| `operationalAlerts` (filtered by store) | mock `data.ts` | **NEW API** | **[R12] operational alerts** |
|
||||
| CSV import simulation, Global-catalogue add | local mutation | **NEW API** | stock entry POST 🔴 |
|
||||
|
||||
---
|
||||
|
||||
## 7. SettingsView.tsx
|
||||
| UI element | Current source | Class | Target |
|
||||
|---|---|---|---|
|
||||
| Merchant ID card / registration info | live `useFiestaAllTenants` | OK | — |
|
||||
| Outlets tab cards | live `useFiestaTenantLocations` | OK | — |
|
||||
| `LOCAL_OUTLETS_DATA` fallback | hardcoded | **WIRE** | remove fallback once locations confirmed live |
|
||||
| `DEFAULTS` settings (min order, delivery charge, prep mins, tax, COD…) | hardcoded + localStorage | **NEW API** | **[R6] merchant settings** GET+PUT (some fields exist on tenant: minorder, paymenttype) |
|
||||
| Role dropdown options | hardcoded `[1,2,3,4,6]` | **WIRE** | `getAppRoles` |
|
||||
|
||||
---
|
||||
|
||||
## 8. UsersPanel.tsx
|
||||
| UI element | Current source | Class | Target |
|
||||
|---|---|---|---|
|
||||
| User directory | live `useFiestaUsers` | OK | — |
|
||||
| Create user | live `useFiestaCreateUser` | OK | — |
|
||||
| `USER_AVATARS` rotation | hardcoded | keep/WIRE | use user photo field if API has one |
|
||||
| `ROLE_THEMES` styling | hardcoded | keep | cosmetic |
|
||||
| Add-user modal role list | hardcoded | **WIRE** | `getAppRoles` |
|
||||
|
||||
---
|
||||
|
||||
## 9. App.tsx / Header / Sidebar / UserPage
|
||||
| UI element | Current source | Class | Target |
|
||||
|---|---|---|---|
|
||||
| Store registry cards | live `useFiestaTenantLocations` + `useFiestaLocationSummary` | OK | — |
|
||||
| `STORE_COVERS` images | hardcoded (hash-picked) | keep | cosmetic |
|
||||
| Add-store modal | local; needs onboard POST | **NEW API** | tenant/location onboard 🔴 (REVIEW_REQUIRED) |
|
||||
| Scheduled-reports calendar (3 events) | hardcoded | **NEW API** | **[R13] scheduled reports** (or drop feature) |
|
||||
| Header/UserPage profile | live `authUser` | OK | — |
|
||||
| Sidebar nav items | hardcoded | keep | static nav config |
|
||||
|
||||
---
|
||||
|
||||
## Summary of backend work required
|
||||
| Id | New API | Blocks |
|
||||
|---|---|---|
|
||||
| **[R1]** | Revenue summary (tenant + per-location, period) | Reports revenue KPI, leaderboard revenue, OTIF revenue, Dashboard cross-check |
|
||||
| **[R2]** | Orders/revenue time-series (day/month/year, by region) | Reports main chart, 7-day ledger |
|
||||
| **[R3]** | Product sales analytics + product meta (units sold, revenue, bin, image) | Product matrix, catalogue metadata |
|
||||
| **[R4]** | Import / sync audit log + validation | Inventory & Operations import tabs |
|
||||
| **[R5]** | Catalog presets (optional) | Inventory presets |
|
||||
| **[R6]** | Merchant settings + branding config (GET/PUT) | Settings, Brand Studio |
|
||||
| **[R7]** | Forecast / efficiency insights (optional) | Operations forecast panel |
|
||||
| **[R8]** | Stock transfer (POST) | Operations transfer modal |
|
||||
| **[R9]** | Rider telemetry (rating, battery, GPS, ETA) | Orders fleet, GPS tracker, StoreDetail riders |
|
||||
| **[R10]** | Intraday dispatch buckets | StoreDetail dispatch pipeline |
|
||||
| **[R11]** | Customer analytics (CSAT/AOV/retention) | StoreDetail CRM metrics |
|
||||
| **[R12]** | Operational alerts feed | StoreDetail / dashboard alerts |
|
||||
| **[R13]** | Scheduled reports (optional) | Reports calendar |
|
||||
|
||||
Plus mutation routes already in the sheet but marked 🔴 REVIEW_REQUIRED (order create/status,
|
||||
delivery assign/status, product create/update, tenant onboard, stock entry) — backend must
|
||||
confirm request/response before wiring.
|
||||
275
docs/03_REQUIRED_BACKEND_APIS.md
Normal file
275
docs/03_REQUIRED_BACKEND_APIS.md
Normal file
@@ -0,0 +1,275 @@
|
||||
# Required Backend APIs (to retire all mock data)
|
||||
|
||||
These endpoints do **not** exist in `Fiesta_All_Endpoints_With_Tables_And_Params.xlsx` and the
|
||||
values cannot be derived client-side. Each spec gives the **request** (params/body) and the
|
||||
**exact response JSON** the frontend needs. All responses follow the existing Fiesta envelope:
|
||||
|
||||
```json
|
||||
{ "code": 200, "status": true, "message": "OK", "details": <payload> }
|
||||
```
|
||||
|
||||
`details` is the `<payload>` documented per endpoint. Money is in INR (paise-free rupees,
|
||||
2-dp numbers). Dates are `YYYY-MM-DD`; timestamps ISO-8601.
|
||||
|
||||
Grouped as the request asked: **Overall (executive) analysis**, **Store-wise analysis**,
|
||||
**Reports**, then supporting operational feeds.
|
||||
|
||||
---
|
||||
|
||||
## A. OVERALL / EXECUTIVE ANALYSIS
|
||||
|
||||
### [R1] Revenue summary — `GET /orders/getrevenuesummary`
|
||||
Real money totals (today the app fakes revenue as `delivered × 355`).
|
||||
|
||||
**Request**
|
||||
| param | type | required | notes |
|
||||
|---|---|---|---|
|
||||
| tenantid | int | ✓ | |
|
||||
| locationid | int | | omit = all outlets (overall); set = store-wise |
|
||||
| fromdate | date | ✓ | |
|
||||
| todate | date | ✓ | |
|
||||
|
||||
**Response `details`** (single object)
|
||||
```json
|
||||
{
|
||||
"tenantid": 1087,
|
||||
"grossrevenue": 1248302.00,
|
||||
"netrevenue": 1180500.00,
|
||||
"profit": 354216.00,
|
||||
"marginpct": 28.4,
|
||||
"ordercount": 4921,
|
||||
"deliveredcount": 4102,
|
||||
"cancelledcount": 142,
|
||||
"avgordervalue": 1580.00,
|
||||
"prev_grossrevenue": 1090000.00,
|
||||
"prev_ordercount": 4370
|
||||
}
|
||||
```
|
||||
`prev_*` = same metric for the immediately preceding equal-length window, so the UI can show
|
||||
the `+14.2%` deltas without a second call. (If omitted, the frontend will issue a second
|
||||
range query to derive deltas — see [R2].)
|
||||
|
||||
---
|
||||
|
||||
### [R2] Orders/revenue time-series — `GET /orders/gettimeseries`
|
||||
Powers the Reports main chart (Orders / Revenue / Cancelled / SKUs) and the StoreDetail 7-day ledger.
|
||||
|
||||
**Request**
|
||||
| param | type | required | notes |
|
||||
|---|---|---|---|
|
||||
| tenantid | int | ✓ | |
|
||||
| locationid | int | | omit = overall |
|
||||
| granularity | enum | ✓ | `day` \| `month` \| `year` |
|
||||
| fromdate | date | ✓ | |
|
||||
| todate | date | ✓ | |
|
||||
|
||||
**Response `details`** (array, one bucket per period)
|
||||
```json
|
||||
[
|
||||
{ "label": "2026-06-01", "orders": 312, "revenue": 442800.00,
|
||||
"cancelled": 9, "delivered": 298, "activeskus": 72 }
|
||||
]
|
||||
```
|
||||
`label` is the bucket key (`YYYY-MM-DD` for day, `YYYY-MM` for month, `YYYY` for year).
|
||||
This removes all hardcoded `CHART_DATA_YTD` / `getDynamicChartData` arrays **and** the
|
||||
region-scaling multipliers (filter by `locationid` instead).
|
||||
|
||||
---
|
||||
|
||||
### [R12] Operational alerts — `GET /alerts/getalerts`
|
||||
Replaces `operationalAlerts` in `data.ts` (stock-critical, latency, rebalance, etc.).
|
||||
|
||||
**Request**: `tenantid` (✓), `locationid` (optional), `status` (`open|all`), `pageno`, `pagesize`.
|
||||
|
||||
**Response `details`** (array)
|
||||
```json
|
||||
[
|
||||
{ "alertid": 5012, "tenantid": 1087, "locationid": 1097,
|
||||
"type": "critical", // critical | warning | info
|
||||
"title": "Stock Critical: RS Puram",
|
||||
"details": "Dairy inventory below 5%.",
|
||||
"createdat": "2026-06-06T08:24:00",
|
||||
"acknowledged": false }
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## B. STORE-WISE ANALYSIS
|
||||
|
||||
### [R3] Product sales analytics — `GET /products/getproductanalytics`
|
||||
The stock-statement mapper currently approximates `unitsSold = debit` and
|
||||
`revenue = debit × retailprice`. This returns true sales + the product meta the matrix shows.
|
||||
|
||||
**Request**
|
||||
| param | type | required | notes |
|
||||
|---|---|---|---|
|
||||
| tenantid | int | ✓ | |
|
||||
| locationid | int | | omit = across all outlets |
|
||||
| subcategoryid | int | | |
|
||||
| fromdate / todate | date | | sales window (default month-to-date) |
|
||||
| keyword | string | | |
|
||||
| pageno / pagesize | int | | |
|
||||
|
||||
**Response `details`** (array)
|
||||
```json
|
||||
[
|
||||
{ "productid": 88231, "productname": "Ponni Raw Rice 10kg",
|
||||
"sku": "PONNI-RICE-10K", "categoryid": 2, "subcategoryname": "Rice",
|
||||
"image": "https://…",
|
||||
"unitssold": 12402, "revenue": 868140.00, "trend": "up", // up|flat|down
|
||||
"closingstock": 1402, "maxcapacity": 2000, "binlocation": "BIN-C12",
|
||||
"lastauditdate": "2026-06-05", "verified": true,
|
||||
"outlets": [ { "locationid": 1097, "locationname": "RS Puram", "stock": 840 } ] }
|
||||
]
|
||||
```
|
||||
`outlets[]` gives the real per-hub split (replaces the hardcoded 60/40). `binlocation`,
|
||||
`lastauditdate`, `image` replace the fabricated bin/barcode/audit fields — **drop them if the
|
||||
catalog doesn't track them** rather than faking.
|
||||
|
||||
---
|
||||
|
||||
### [R10] Intraday dispatch buckets — `GET /deliveries/getdispatchbuckets`
|
||||
Replaces StoreDetail `intervalSlots` (Morning Rush / Midday / Evening Peak, computed from `%`).
|
||||
|
||||
**Request**: `tenantid` (✓), `locationid` (✓), `date` (✓, default today).
|
||||
|
||||
**Response `details`** (array, fixed buckets)
|
||||
```json
|
||||
[
|
||||
{ "bucket": "06:00-10:00", "label": "Morning Rush",
|
||||
"orders": 64, "revenue": 88400.00, "status": "PEAK" } // PEAK|HIGH|NORMAL|LOW
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### [R11] Customer analytics — `GET /customers/getcustomeranalytics`
|
||||
Replaces hardcoded CSAT 5.0 / retention 88.4% / AOV ₹1,580 in StoreDetail.
|
||||
|
||||
**Request**: `tenantid` (✓), `locationid` (optional), `customerid` (optional — single-customer rollup).
|
||||
|
||||
**Response `details`** (object; per-customer when `customerid` set)
|
||||
```json
|
||||
{
|
||||
"retentionpct": 88.4,
|
||||
"avgordervalue": 1580.00,
|
||||
"csat": 4.9,
|
||||
"totalcustomers": 1240,
|
||||
"percustomer": { "customerid": 55012, "orderscount": 18,
|
||||
"totalspent": 28450.00, "csat": 5.0, "lastorderdate": "2026-06-04" }
|
||||
}
|
||||
```
|
||||
> Customer order **history** itself is already available: `GET /orders/getorders?customerid=` (sheet row 56) — wire that, no new API needed.
|
||||
|
||||
---
|
||||
|
||||
### [R9] Rider telemetry — `GET /partners/getridertelemetry`
|
||||
Replaces hardcoded rider `rating 4.7`, `battery`, `lastPing`, and the fake GPS route / "9 MINS" / "1.2 km left".
|
||||
|
||||
**Request**: `applocationid` (✓), `tenantid` (optional), `userid` (optional — single rider).
|
||||
|
||||
**Response `details`** (array)
|
||||
```json
|
||||
[
|
||||
{ "userid": 7781, "name": "Karthikeyan R", "status": "Delivering", // Delivering|Idle|Offline
|
||||
"rating": 4.7, "completedtoday": 12, "battery": 84,
|
||||
"lastping": "2026-06-06T14:21:00", "zone": "RS Puram",
|
||||
"lat": 11.0041, "lng": 76.9612,
|
||||
"activedelivery": { "deliveryid": 99213, "etamins": 9, "distancekm": 1.2,
|
||||
"destlat": 11.0102, "destlng": 76.9550 } }
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## C. REPORTS
|
||||
|
||||
Reports are powered primarily by **[R1]** (revenue + deltas), **[R2]** (time-series chart &
|
||||
ledger), and **[R3]** (product matrix). Additional reports-only needs:
|
||||
|
||||
### [R4] Import / sync audit log — `GET /imports/getimportlogs` + validation
|
||||
Replaces `initialImportLogs` and the hardcoded "14 duplicate SKUs" validator messages.
|
||||
|
||||
**Request (list)**: `tenantid` (✓), `pageno`, `pagesize`.
|
||||
**Response `details`**
|
||||
```json
|
||||
[
|
||||
{ "importid": 921, "batchref": "#IMP_0921_A", "type": "Inventory Sync",
|
||||
"source": "ERP Export", "rows": 421, "result": "SUCCESS", // SUCCESS|FAILED|PARTIAL
|
||||
"message": "421 rows", "createdat": "2026-05-31T09:12:00" }
|
||||
]
|
||||
```
|
||||
**Upload (optional)**: `POST /imports/upload` (multipart csv) → returns the same row plus a
|
||||
`validation` block:
|
||||
```json
|
||||
{ "validation": { "passed": true, "duplicateskus": ["ST-SONA-25K"],
|
||||
"badcolumns": [45, 82], "headerversion": "v2.8" } }
|
||||
```
|
||||
|
||||
### [R13] Scheduled reports — `GET/POST /reports/getschedules` *(optional feature)*
|
||||
Replaces the 3 hardcoded calendar events. Drop the feature if not on the roadmap.
|
||||
```json
|
||||
[ { "scheduleid": 11, "name": "Monthly Assortment Audit", "cron": "0 0 1 * *",
|
||||
"nextrun": "2026-07-01T00:00:00", "format": "PDF", "recipients": ["ops@…"] } ]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## D. SETTINGS / CONFIG
|
||||
|
||||
### [R6] Merchant settings + branding — `GET /tenants/getsettings`, `PUT /tenants/updatesettings`
|
||||
Replaces `DEFAULTS` (localStorage) and the Brand Design Studio local state. Some fields already
|
||||
live on the tenant (`minorder`, `paymenttype`) — fold those in.
|
||||
|
||||
**GET response `details`**
|
||||
```json
|
||||
{
|
||||
"tenantid": 1087,
|
||||
"contactemail": "ops@ragul.com", "contactphone": "+91…",
|
||||
"minordervalue": 199, "deliverycharge": 29, "prepmins": 20,
|
||||
"deliverywindowmins": 45, "cancelwindowsecs": 120, "autoassignrider": true,
|
||||
"defaulttaxpercent": 5, "codenabled": true, "onlinepaymentenabled": true,
|
||||
"defaultregion": "Coimbatore", "defaultnewuserrole": 4,
|
||||
"ordernotifications": true, "lowstockalerts": true, "dailysummaryemail": false,
|
||||
"syncinterval": 15, "sandboxmode": false,
|
||||
"branding": { "themename": "Kaveri Org", "primarycolor": "#16a34a",
|
||||
"secondarycolor": "#f59e0b", "baglabel": "Freshly Harvested",
|
||||
"ecoverified": true, "stickerpattern": "radial" }
|
||||
}
|
||||
```
|
||||
**PUT body**: same object (partial allowed) → returns updated object.
|
||||
|
||||
---
|
||||
|
||||
## E. SUPPORTING OPERATIONAL ENDPOINTS (optional / phase-2)
|
||||
|
||||
### [R7] Forecast / efficiency insight — `GET /insights/getforecast`
|
||||
Operations "Forecast Efficiency 92% / ₹1.9L savings". **Recommend removing** these tiles until a
|
||||
forecasting model exists, rather than building a thin API. If kept:
|
||||
```json
|
||||
{ "forecastefficiencypct": 92, "estsavingsperweek": 190000.00, "horizondays": 7 }
|
||||
```
|
||||
|
||||
### [R8] Stock transfer — `POST /products/stocktransfer`
|
||||
Operations transfer-stock modal.
|
||||
**Body**: `{ tenantid, productid, fromlocationid, tolocationid, quantity }` →
|
||||
**Response**: updated stock rows for both locations.
|
||||
|
||||
### [R5] Catalog presets — `GET /products/getcatalogpresets` *(optional)*
|
||||
Inventory "Nilgiris Dairy / Coimbatore Heritage" quick-add packs. Could instead reuse master
|
||||
catalog listings (sheet row 90) filtered by subcategory — **prefer that, skip the new API**.
|
||||
|
||||
---
|
||||
|
||||
## Mutation routes already in the sheet (confirm shape, then wire)
|
||||
These are marked `REVIEW_REQUIRED` in the sheet — backend must publish request/response:
|
||||
| Action | Route (sheet) | Used by |
|
||||
|---|---|---|
|
||||
| Create web order | POST orders+orderdetails | Orders "create order" |
|
||||
| Update order status | PUT orders | Orders status buttons |
|
||||
| Assign rider / dispatch | POST deliveries+deliverydetails | Orders assign-rider |
|
||||
| Update pickup / delivered | PUT deliveries | Orders status progression |
|
||||
| Add multi-product stock | POST (products) | Inventory/Operations add stock |
|
||||
| Create/Update/Delete product | POST/PUT/DELETE | Catalogue management |
|
||||
| Onboard tenant / store / location | POST/PUT | App add-store modal |
|
||||
322
docs/BACKEND_API_REQUIREMENTS.md
Normal file
322
docs/BACKEND_API_REQUIREMENTS.md
Normal file
@@ -0,0 +1,322 @@
|
||||
# Backend API Requirements — Merchant Web Console
|
||||
|
||||
**Audience:** Backend team.
|
||||
**Purpose:** These are the endpoints the merchant web app needs before it can go to staging with
|
||||
zero mock data. Every UI spot listed below currently renders an explicit
|
||||
`Awaiting backend API [Rxx]` placeholder (or a known-wrong stand-in like the
|
||||
`delivered × 355` revenue) until the matching endpoint ships.
|
||||
|
||||
## Conventions (match the existing live API)
|
||||
- **Base / proxy:** Fiesta REST at `https://fiesta.nearle.app/live/api/v1/web/<group>/<action>`.
|
||||
The frontend calls it through the dev proxy as `/fiesta/live/api/v1/web/...`.
|
||||
- **Auth:** same as current read endpoints (no extra header required for GETs).
|
||||
- **Envelope:** every response is
|
||||
```json
|
||||
{ "code": 200, "status": true, "message": "OK", "details": <payload> }
|
||||
```
|
||||
`details` is the documented payload (array or object). On failure return
|
||||
`{ "code": 4xx, "status": false, "message": "<reason>" }`.
|
||||
- **Types:** money = INR as a plain 2-dp number (e.g. `442800.00`), no currency symbol/string.
|
||||
Dates = `YYYY-MM-DD`. Timestamps = ISO-8601 (`2026-06-06T14:21:00`). Ids = integers.
|
||||
- **Tenant scope (current):** `tenantid=1087`, `applocationid=1`, primary `locationid=1097`.
|
||||
- **Paging:** where listed, accept `pageno` (1-based) and `pagesize`.
|
||||
|
||||
## Index
|
||||
| Id | Endpoint | Method | Powers (UI) | Priority |
|
||||
|---|---|---|---|---|
|
||||
| [R1] | `/orders/getrevenuesummary` | GET | Revenue KPIs, OTIF, leaderboard, fulfilment health | **P0** |
|
||||
| [R2] | `/orders/gettimeseries` | GET | Reports main chart, 7-day ledger | **P0** |
|
||||
| [R3] | `/products/getproductanalytics` | GET | Product matrix sales + per-product detail | **P0** |
|
||||
| [R4] | `/imports/getimportlogs` (+ `/imports/upload`) | GET/POST | Import audit stream + validator | P1 |
|
||||
| [R5] | `/products/getcatalogpresets` | GET | Inventory catalog presets (optional) | P2 |
|
||||
| [R6] | `/tenants/getsettings` (+ `/tenants/updatesettings`) | GET/PUT | Settings + Brand studio | P1 |
|
||||
| [R7] | `/insights/getforecast` | GET | Operations forecast tiles (optional) | P2 |
|
||||
| [R8] | `/products/stocktransfer` | POST | Operations stock-transfer modal | P1 |
|
||||
| [R9] | `/partners/getridertelemetry` | GET | Fleet rating, GPS, ETA | P1 |
|
||||
| [R10] | `/deliveries/getdispatchbuckets` | GET | StoreDetail intraday dispatch | P1 |
|
||||
| [R11] | `/customers/getcustomeranalytics` | GET | Customer CSAT/AOV/retention | P1 |
|
||||
| [R12] | `/alerts/getalerts` | GET | Operational alerts feed | P1 |
|
||||
| [R13] | `/reports/getschedules` (+ POST) | GET/POST | Scheduled reports (optional) | P2 |
|
||||
|
||||
Plus **mutation routes** already named in the endpoint sheet but not yet shape-documented — see
|
||||
the last section.
|
||||
|
||||
---
|
||||
|
||||
## [R1] Revenue summary · `GET /orders/getrevenuesummary`
|
||||
Real money totals. Today the app fakes revenue as `delivered × 355` — replace that.
|
||||
|
||||
**Request (query params)**
|
||||
| param | type | required | notes |
|
||||
|---|---|---|---|
|
||||
| `tenantid` | int | ✓ | |
|
||||
| `locationid` | int | | omit → all outlets (overall); set → store-wise |
|
||||
| `fromdate` | date | ✓ | |
|
||||
| `todate` | date | ✓ | |
|
||||
|
||||
**Response `details`** (single object)
|
||||
```json
|
||||
{
|
||||
"tenantid": 1087,
|
||||
"locationid": null,
|
||||
"grossrevenue": 1248302.00,
|
||||
"netrevenue": 1180500.00,
|
||||
"profit": 354216.00,
|
||||
"marginpct": 28.4,
|
||||
"ordercount": 4921,
|
||||
"deliveredcount": 4102,
|
||||
"cancelledcount": 142,
|
||||
"otifpct": 98.2,
|
||||
"avgordervalue": 1580.00,
|
||||
"prev_grossrevenue": 1090000.00,
|
||||
"prev_ordercount": 4370
|
||||
}
|
||||
```
|
||||
`prev_*` = same metric for the immediately preceding equal-length window (lets the UI show
|
||||
`+14.2%` deltas without a second call). `otifpct` powers the OTIF / fulfilment-health tiles.
|
||||
Frontend hook to add: `useFiestaRevenueSummary`.
|
||||
|
||||
---
|
||||
|
||||
## [R2] Orders / revenue time-series · `GET /orders/gettimeseries`
|
||||
Powers the Reports main chart (Orders / Revenue / Cancelled / SKUs) and StoreDetail 7-day ledger.
|
||||
|
||||
**Request**
|
||||
| param | type | required | notes |
|
||||
|---|---|---|---|
|
||||
| `tenantid` | int | ✓ | |
|
||||
| `locationid` | int | | omit → overall |
|
||||
| `granularity` | enum | ✓ | `day` \| `month` \| `year` |
|
||||
| `fromdate` | date | ✓ | |
|
||||
| `todate` | date | ✓ | |
|
||||
|
||||
**Response `details`** (array, one bucket per period)
|
||||
```json
|
||||
[
|
||||
{ "label": "2026-06-01", "orders": 312, "revenue": 442800.00,
|
||||
"delivered": 298, "cancelled": 9, "activeskus": 72 }
|
||||
]
|
||||
```
|
||||
`label` = `YYYY-MM-DD` (day), `YYYY-MM` (month), or `YYYY` (year). Removes all hardcoded chart
|
||||
arrays and the region-scaling multipliers (filter by `locationid` instead).
|
||||
Frontend hook: `useFiestaTimeSeries`.
|
||||
|
||||
---
|
||||
|
||||
## [R3] Product sales analytics · `GET /products/getproductanalytics`
|
||||
True units-sold + revenue per product, plus the per-product/per-outlet detail the matrix expands.
|
||||
|
||||
**Request**
|
||||
| param | type | required | notes |
|
||||
|---|---|---|---|
|
||||
| `tenantid` | int | ✓ | |
|
||||
| `locationid` | int | | omit → across all outlets |
|
||||
| `subcategoryid` | int | | |
|
||||
| `fromdate` / `todate` | date | | sales window (default month-to-date) |
|
||||
| `keyword` | string | | |
|
||||
| `pageno` / `pagesize` | int | | |
|
||||
|
||||
**Response `details`** (array)
|
||||
```json
|
||||
[
|
||||
{ "productid": 88231, "productname": "Ponni Raw Rice 10kg",
|
||||
"sku": "PONNI-RICE-10K", "categoryid": 2, "subcategoryname": "Rice",
|
||||
"image": "https://…",
|
||||
"unitssold": 12402, "revenue": 868140.00, "trend": "up",
|
||||
"closingstock": 1402, "maxcapacity": 2000,
|
||||
"binlocation": "BIN-C12", "lastauditdate": "2026-06-05", "verified": true,
|
||||
"outlets": [ { "locationid": 1097, "locationname": "RS Puram", "stock": 840 } ] }
|
||||
]
|
||||
```
|
||||
`trend` ∈ `up|flat|down`. `outlets[]` = real per-hub split (replaces hardcoded 60/40).
|
||||
If the catalog doesn't track `binlocation`/`lastauditdate`, return `null` — the UI will hide them
|
||||
rather than fake them. Frontend hook: `useFiestaProductAnalytics`.
|
||||
|
||||
---
|
||||
|
||||
## [R4] Import / sync audit log · `GET /imports/getimportlogs` + `POST /imports/upload`
|
||||
Replaces the mock "Live Sync Audit Stream" and the hardcoded "14 duplicate SKUs" validator.
|
||||
|
||||
**GET request:** `tenantid` (✓), `pageno`, `pagesize`.
|
||||
**GET `details`**
|
||||
```json
|
||||
[
|
||||
{ "importid": 921, "batchref": "#IMP_0921_A", "type": "Inventory Sync",
|
||||
"source": "ERP Export", "rows": 421, "result": "SUCCESS",
|
||||
"message": "421 rows imported", "createdat": "2026-05-31T09:12:00" }
|
||||
]
|
||||
```
|
||||
`result` ∈ `SUCCESS|FAILED|PARTIAL`.
|
||||
|
||||
**POST `/imports/upload`** (multipart, field `file` = CSV; plus `tenantid`) → returns the new log row
|
||||
plus a validation block:
|
||||
```json
|
||||
{ "importid": 922, "result": "PARTIAL",
|
||||
"validation": { "passed": false, "duplicateskus": ["ST-SONA-25K"],
|
||||
"badcolumns": [45, 82], "headerversion": "v2.8" } }
|
||||
```
|
||||
Frontend hooks: `useFiestaImportLogs`, `useFiestaImportUpload` (mutation).
|
||||
|
||||
---
|
||||
|
||||
## [R5] Catalog presets *(optional)* · `GET /products/getcatalogpresets`
|
||||
Inventory "Nilgiris Dairy / Coimbatore Heritage" quick-add packs.
|
||||
**Request:** `tenantid` (✓). **`details`:**
|
||||
```json
|
||||
[ { "presetid": 3, "name": "Nilgiris Dairy Fresh Pack",
|
||||
"items": [ { "name": "Ooty Butter 500g", "sku": "DY-OOT-BTR",
|
||||
"subcategoryname": "Dairy", "price": 340, "image": "https://…" } ] } ]
|
||||
```
|
||||
> Alternative: skip this and reuse master catalog (`/products/getproducts`) filtered by subcategory.
|
||||
|
||||
---
|
||||
|
||||
## [R6] Merchant settings + branding · `GET /tenants/getsettings` + `PUT /tenants/updatesettings`
|
||||
Replaces the localStorage `DEFAULTS` and the Brand Design Studio local state.
|
||||
|
||||
**GET request:** `tenantid` (✓). **GET `details`:**
|
||||
```json
|
||||
{
|
||||
"tenantid": 1087,
|
||||
"contactemail": "ops@ragul.com", "contactphone": "+91…",
|
||||
"minordervalue": 199, "deliverycharge": 29, "prepmins": 20,
|
||||
"deliverywindowmins": 45, "cancelwindowsecs": 120, "autoassignrider": true,
|
||||
"defaulttaxpercent": 5, "codenabled": true, "onlinepaymentenabled": true,
|
||||
"defaultregion": "Coimbatore", "defaultnewuserrole": 4,
|
||||
"ordernotifications": true, "lowstockalerts": true, "dailysummaryemail": false,
|
||||
"syncinterval": 15, "sandboxmode": false,
|
||||
"branding": { "themename": "Kaveri Org", "primarycolor": "#16a34a",
|
||||
"secondarycolor": "#f59e0b", "baglabel": "Freshly Harvested",
|
||||
"ecoverified": true, "stickerpattern": "radial" }
|
||||
}
|
||||
```
|
||||
**PUT body:** same object (partial allowed) → returns the updated object.
|
||||
Frontend hooks: `useFiestaSettings`, `useFiestaUpdateSettings` (mutation).
|
||||
|
||||
---
|
||||
|
||||
## [R7] Forecast insight *(optional)* · `GET /insights/getforecast`
|
||||
Operations "Forecast Efficiency 92% / ₹1.9L savings". Recommend dropping the tiles until a model
|
||||
exists; if kept: **request** `tenantid` (✓), `locationid` (opt). **`details`:**
|
||||
```json
|
||||
{ "forecastefficiencypct": 92, "estsavingsperweek": 190000.00, "horizondays": 7 }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## [R8] Stock transfer · `POST /products/stocktransfer`
|
||||
Operations transfer-stock modal.
|
||||
**Body:**
|
||||
```json
|
||||
{ "tenantid": 1087, "productid": 88231,
|
||||
"fromlocationid": 1097, "tolocationid": 1101, "quantity": 100 }
|
||||
```
|
||||
**`details`:** updated stock rows for both locations
|
||||
```json
|
||||
[ { "locationid": 1097, "productid": 88231, "closingstock": 740 },
|
||||
{ "locationid": 1101, "productid": 88231, "closingstock": 360 } ]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## [R9] Rider telemetry · `GET /partners/getridertelemetry`
|
||||
Replaces hardcoded rider `rating`, `battery`, `lastPing` and the fake GPS route / "9 MINS" / "1.2 km".
|
||||
|
||||
**Request:** `applocationid` (✓), `tenantid` (opt), `userid` (opt → single rider).
|
||||
**`details`** (array)
|
||||
```json
|
||||
[
|
||||
{ "userid": 7781, "name": "Karthikeyan R", "status": "Delivering",
|
||||
"rating": 4.7, "completedtoday": 12, "battery": 84,
|
||||
"lastping": "2026-06-06T14:21:00", "zone": "RS Puram",
|
||||
"lat": 11.0041, "lng": 76.9612,
|
||||
"activedelivery": { "deliveryid": 99213, "etamins": 9, "distancekm": 1.2,
|
||||
"destlat": 11.0102, "destlng": 76.9550 } }
|
||||
]
|
||||
```
|
||||
`status` ∈ `Delivering|Idle|Offline`. `activedelivery` = `null` when the rider is idle.
|
||||
Frontend hook: `useFiestaRiderTelemetry`.
|
||||
|
||||
---
|
||||
|
||||
## [R10] Intraday dispatch buckets · `GET /deliveries/getdispatchbuckets`
|
||||
Replaces StoreDetail `intervalSlots` (Morning Rush / Midday / Evening Peak computed from %).
|
||||
|
||||
**Request:** `tenantid` (✓), `locationid` (✓), `date` (✓, default today).
|
||||
**`details`** (array, fixed buckets)
|
||||
```json
|
||||
[ { "bucket": "06:00-10:00", "label": "Morning Rush",
|
||||
"orders": 64, "revenue": 88400.00, "status": "PEAK" } ]
|
||||
```
|
||||
`status` ∈ `PEAK|HIGH|NORMAL|LOW`. Frontend hook: `useFiestaDispatchBuckets`.
|
||||
|
||||
---
|
||||
|
||||
## [R11] Customer analytics · `GET /customers/getcustomeranalytics`
|
||||
Replaces hardcoded CSAT 5.0 / retention 88.4% / AOV ₹1,580.
|
||||
|
||||
**Request:** `tenantid` (✓), `locationid` (opt), `customerid` (opt → single-customer rollup).
|
||||
**`details`** (object)
|
||||
```json
|
||||
{
|
||||
"retentionpct": 88.4, "avgordervalue": 1580.00, "csat": 4.9,
|
||||
"totalcustomers": 1240,
|
||||
"percustomer": { "customerid": 55012, "orderscount": 18,
|
||||
"totalspent": 28450.00, "csat": 5.0, "lastorderdate": "2026-06-04" }
|
||||
}
|
||||
```
|
||||
`percustomer` present only when `customerid` is supplied.
|
||||
> Customer order **history** itself already exists: `GET /orders/getorders?customerid=` — wire that, no new API.
|
||||
Frontend hook: `useFiestaCustomerAnalytics`.
|
||||
|
||||
---
|
||||
|
||||
## [R12] Operational alerts · `GET /alerts/getalerts`
|
||||
Replaces the mock `operationalAlerts` (stock-critical, latency, rebalance…).
|
||||
|
||||
**Request:** `tenantid` (✓), `locationid` (opt), `status` (`open|all`), `pageno`, `pagesize`.
|
||||
**`details`** (array)
|
||||
```json
|
||||
[ { "alertid": 5012, "tenantid": 1087, "locationid": 1097,
|
||||
"type": "critical", "title": "Stock Critical: RS Puram",
|
||||
"details": "Dairy inventory below 5%.",
|
||||
"createdat": "2026-06-06T08:24:00", "acknowledged": false } ]
|
||||
```
|
||||
`type` ∈ `critical|warning|info`. Frontend hook: `useFiestaAlerts`.
|
||||
|
||||
---
|
||||
|
||||
## [R13] Scheduled reports *(optional)* · `GET /reports/getschedules` + `POST /reports/createschedule`
|
||||
Replaces 3 hardcoded calendar events. Drop if not on the roadmap.
|
||||
**GET `details`:**
|
||||
```json
|
||||
[ { "scheduleid": 11, "name": "Monthly Assortment Audit", "cron": "0 0 1 * *",
|
||||
"nextrun": "2026-07-01T00:00:00", "format": "PDF", "recipients": ["ops@ragul.com"] } ]
|
||||
```
|
||||
**POST body:** `{ tenantid, name, cron, format, recipients[] }` → returns the created schedule.
|
||||
|
||||
---
|
||||
|
||||
## Mutation routes already named in the endpoint sheet (publish request/response, then we wire)
|
||||
These are marked `REVIEW_REQUIRED` in `Fiesta_All_Endpoints_With_Tables_And_Params.xlsx`. We need
|
||||
the exact request body + success response for each:
|
||||
|
||||
| Action | Suggested endpoint | Body (fields we'll send) |
|
||||
|---|---|---|
|
||||
| Create web order | `POST /orders/create` | tenantid, locationid, customerid, items[{productid,qty,price}], paymenttype |
|
||||
| Update order status | `PUT /orders/updatestatus` | orderheaderid, status, financialflag |
|
||||
| Assign rider / dispatch | `POST /deliveries/assign` | orderheaderid, tenantid, locationid, partnerid, userid |
|
||||
| Update pickup / delivered | `PUT /deliveries/updatestatus` | deliveryid, status |
|
||||
| Add multi-product stock | `POST /products/addstock` | tenantid, locationid, items[{productid,qty,cost}] |
|
||||
| Create / update / delete product | `POST/PUT/DELETE /products/...` | product fields |
|
||||
| Onboard tenant / store / location | `POST /tenants/onboard`, `POST /tenants/createlocation` | tenant + location fields |
|
||||
|
||||
---
|
||||
|
||||
## Frontend status (for reference)
|
||||
- All read endpoints that **already exist** are wired (orders/deliveries/stock/customers/users/
|
||||
locations/order-line-items/etc.).
|
||||
- Each `[Rxx]` above corresponds to a visible `AwaitingApi` placeholder in the UI, so QA can see
|
||||
exactly which screens are still blocked.
|
||||
- The moment an endpoint here ships with the documented shape, wiring it is one hook + swapping the
|
||||
placeholder — no redesign needed.
|
||||
105
docs/_endpoints_raw.txt
Normal file
105
docs/_endpoints_raw.txt
Normal file
@@ -0,0 +1,105 @@
|
||||
API Name | Method | Exact Table | Query Parameters
|
||||
Utils | GET | app_types | tag
|
||||
Resolve subcategories (Web) | GET | app_subcategory | moduleid, categoryid
|
||||
Fetch system active geofence details (Web) | GET | app_location | applocationid
|
||||
Fetch global system categories configurations (Web) | GET | app_category | None
|
||||
Get mobile geofence configuration details (Mobile) | GET | app_locationconfig | applocationid
|
||||
Get mobile active geofence details (Mobile) | GET | app_location | applocationid
|
||||
Fetch mobile app types by tag (Mobile) | GET | app_types | tag
|
||||
Fetch global payment & geofence configs (Mobile) | GET | app_config | configid
|
||||
Get mobile category subcategories list (Mobile) | GET | app_subcategory | moduleid, categoryid
|
||||
Fetch mobile app categories configurations (Mobile) | GET | app_category | None
|
||||
Users | GET | users | roleid, tenantid, pageno, pagesize, keyword
|
||||
Get a specific user profile by ID (Web) | GET | users | userid
|
||||
Get a specific user profile by ID (Mobile) | GET | users | userid
|
||||
Operator/User orders board (Web) | GET | orders | appuserid, status, pageno, pagesize
|
||||
Tenant Web Panel Login | POST | REVIEW_REQUIRED | None
|
||||
General Application Login | POST | REVIEW_REQUIRED | None
|
||||
Register New Web Staff Account | POST | REVIEW_REQUIRED | None
|
||||
Update Web Staff User Details | PUT | REVIEW_REQUIRED | None
|
||||
Rider/Merchant Mobile App Login | POST | REVIEW_REQUIRED | None
|
||||
Create Mobile Staff User | POST | REVIEW_REQUIRED | None
|
||||
Update Mobile Staff Details | PUT | REVIEW_REQUIRED | None
|
||||
Partners | GET | orders | partnerid, status, pageno, pagesize
|
||||
Get active riders (Web) | GET | partneruser | partnerid, applocationid, userid, tenantid
|
||||
Get partner profiles (Web) | GET | partneruser | partnerid, applocationid, userid
|
||||
Get rider shifts (Web) | GET | partneruser | applocationid
|
||||
Get location configurations (Web) | GET | REVIEW_REQUIRED | userid, configid
|
||||
Get rider log sheet (Web) | GET | riderlogs | partnerid, applocationid, fromdate, todate
|
||||
Get partner profiles (Mobile) | GET | partneruser | partnerid, applocationid, userid
|
||||
Get rider log sheet (Mobile) | GET | riderlogs | partnerid, applocationid, fromdate, todate
|
||||
Get rider operational info (Mobile) | GET | partneruser | userid
|
||||
Get active riders list (Mobile) | GET | partneruser | partnerid, applocationid, userid, tenantid
|
||||
Tenants | GET | orders | tenantid, locationid, status, pageno, pagesize
|
||||
Get specific tenant store orders (Mobile) | GET | orders | tenantid, locationid, pageno, pagesize
|
||||
Search registered tenants (Web) | GET | REVIEW_REQUIRED | status, keyword
|
||||
Search tenants by keyword (Web) | GET | REVIEW_REQUIRED | keyword
|
||||
Get all active tenants catalog (Web) | GET | tenants | applocationid, status, pageno, pagesize
|
||||
Get outlet locations assigned to a tenant (Web) | GET | tenantlocations | tenantid
|
||||
Retrieve delivery time slots config (Mobile) | GET | tenantslot | None
|
||||
Search tenants by keyword (Mobile) | GET | REVIEW_REQUIRED | keyword
|
||||
Retrieve tenants associated with a customer (Mobile) | GET | tenantcustomers | customerid, tenant
|
||||
Get outlet locations linked to a tenant (Mobile) | GET | tenantlocations | tenantid
|
||||
Get logistics pricing slabs for a tenant (Mobile) | GET | tenantpricing | tenantid, applocationid
|
||||
Get staff members under a tenant store (Mobile) | GET | tenantstaffs | tenantid
|
||||
Get tenant detailed profile info (Mobile) | GET | tenants | tenantid, locationid
|
||||
Link Customer Profile to Tenant Store | POST | REVIEW_REQUIRED | None
|
||||
Create New Geofenced Store Location | POST | REVIEW_REQUIRED | None
|
||||
Update Store Location Configurations | PUT | REVIEW_REQUIRED | None
|
||||
Onboard New Tenant & Admin Profile | POST | REVIEW_REQUIRED | None
|
||||
Customers | GET | customers | customerid, contactno
|
||||
Get customer saved address locations (Mobile) | GET | customerlocations | customerid
|
||||
Get customer logged support requests (Mobile) | GET | customerrequest | customerid, pageno, pagesize
|
||||
Search customer names under a tenant (Mobile) | GET | REVIEW_REQUIRED | keyword, tenantid
|
||||
Retrieve customers linked to a tenant location (Mobile) | GET | tenantcustomers | tenantid, locationid, pageno, pagesize
|
||||
Retrieve merchant customers list (Web) | GET | tenantcustomers | tenantid, locationid, pageno, pagesize, keyword
|
||||
Individual consumer invoice histories (Web) | GET | orders | customerid, status, pageno, pagesize
|
||||
Passwordless OTP Login (via Phone) | POST | REVIEW_REQUIRED | None
|
||||
Register Customer Account | POST | REVIEW_REQUIRED | None
|
||||
Save New Geofenced Location Address | POST | REVIEW_REQUIRED | None
|
||||
Log Customer Support Ticket Request | POST | REVIEW_REQUIRED | None
|
||||
Update Customer Profile Details | PUT | REVIEW_REQUIRED | None
|
||||
Deliveries | GET | deliveries | tenantid, partnerid, userid, applocationid, locationid, fromdate, todate
|
||||
Get daily delivery insights (Web) | GET | deliveries | tenantid
|
||||
Get location deliveries summary (Web) | GET | deliveries | tenantid
|
||||
Get deliveries financial report summary (Web) | GET | deliveries | tenantid, partnerid, userid, applocationid, fromdate, todate
|
||||
Get fleet rider summary metrics (Web) | GET | partneruser | applocationid, partnerid, tenantid, fromdate, todate
|
||||
Get master deliveries board (Web) | GET | deliveries | tenantid, fromdate, todate
|
||||
Get mobile dispatch summaries (Mobile) | GET | deliveries | userid, fromdate, todate
|
||||
Get mobile deliveries board (Mobile) | GET | deliveries | userid, status
|
||||
Fetch rider active shift deliveries queue (Mobile) | GET | deliveryqueues | userid, fromdate, todate
|
||||
Initialize Logistics Delivery Dispatch (Assign Rider) | POST | deliveries + deliverydetails | None
|
||||
Update Rider Pickup Status | PUT | deliveries | None
|
||||
Rider Update Dispatch Status (Delivered) | PUT | deliveries | None
|
||||
Orders | GET | orders | tenantid, locationid, status, pageno, pagesize
|
||||
System Admin orders board (Web) | GET | orders | applocationid, status, pageno, pagesize
|
||||
Get order dashboard stats summary (Web) | GET | orders | tenantid, fromdate, todate
|
||||
Get location orders summary (Web) | GET | deliveries | tenantid
|
||||
Get annual orders insights analytics (Web) | GET | orders | tenantid
|
||||
Get order detailed lines (Web) | GET | orderdetails | orderheaderid
|
||||
Get customer order history (Mobile) | GET | orders | customerid, pageno, pagesize
|
||||
Get mobile order detailed lines (Mobile) | GET | orderdetails | orderheaderid
|
||||
Create New Web Order | POST | orders + orderdetails | None
|
||||
Update Order Status & Financial Flag | PUT | orders | None
|
||||
Create Mobile Order | POST | orders + orderdetails | None
|
||||
Mobile Update Order Status | PUT | orders | None
|
||||
Products | GET | productsubcategories | categoryid, tenantid
|
||||
Get products stock counts (Web) | GET | products | tenantid, categoryid, subcategoryid, approve
|
||||
Get all global categories (Web) | GET | productcategories | None
|
||||
Get specific product variants (Web) | GET | productvariants | tenantid, subcategoryid
|
||||
Get master catalog listings (Web) | GET | products | tenantid, locationid, subcategoryid, keyword, pageno, pagesize
|
||||
Get live stocks catalog (Web) | GET | productstocks | tenantid, locationid
|
||||
Get dynamic stock statement ledger (Web) | GET | product_stock_statement | tenantid, locationid, subcategoryid, pageno, pagesize, keyword
|
||||
Get outlet geofenced inventory (Web) | GET | productlocations | tenantid, locationid, subcategoryid, pageno, pagesize
|
||||
Master products search board (Web) | GET | products | tenantid, locationid, keyword, pageno, pagesize
|
||||
Get product details by variant ID (Mobile) | GET | productvariants | tenantid, variantid
|
||||
Get product subcategories (Mobile) | GET | productsubcategories | categoryid, tenantid
|
||||
Search product catalog (Mobile) | GET | products | keyword, pageno, pagesize
|
||||
Get mobile geofenced outlet products (Mobile) | GET | productlocations | tenantid, locationid, pageno, pagesize
|
||||
Add Multi-Product Stock Entry | POST | REVIEW_REQUIRED | None
|
||||
Create Master Product Catalog Item | POST | REVIEW_REQUIRED | None
|
||||
Update Master Product Details | PUT | REVIEW_REQUIRED | None
|
||||
Purge Master Product Catalog Entry | DELETE | REVIEW_REQUIRED | productid
|
||||
Invoice | GET | invoice_insight | tenantid
|
||||
Payments | GET | paymentrequests | partnerid, status
|
||||
TOTAL ROWS: 104
|
||||
Reference in New Issue
Block a user