# 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.
