๐ Locations API โ
๐ List Locations โ
GET /api/locationsPublic. Returns all active locations.
Response:
json
{
"success": true,
"data": [
{
"id": "cuid",
"name": "Downtown Kitchen",
"slug": "downtown-kitchen",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"postalCode": "10001",
"phone": "+1234567890",
"deliveryEnabled": true,
"pickupEnabled": true,
"isActive": true,
"isBusy": false
}
]
}๐ Get Location โ
GET /api/locations/:idPublic. Returns a single location with full details.
โ Create Location โ
POST /api/locations
Authorization: Bearer <manager-token>Request:
json
{
"name": "Uptown Kitchen",
"slug": "uptown-kitchen",
"address": "456 Oak Ave",
"city": "New York",
"state": "NY",
"postalCode": "10002",
"deliveryEnabled": true,
"pickupEnabled": true,
"deliveryLeadTime": 30,
"pickupLeadTime": 15,
"minOrderDelivery": 15.00,
"minOrderPickup": 0
}โ๏ธ Update Location โ
PATCH /api/locations/:id
Authorization: Bearer <manager-token>Partial updates supported โ only include fields to change.
๐๏ธ Delete Location โ
DELETE /api/locations/:id
Authorization: Bearer <super-admin-token>๐ Delivery Zones โ
๐ List Delivery Zones โ
GET /api/locations/:locationId/delivery-zones๐ Check Delivery Zone โ
GET /api/locations/:locationId/delivery-zones/check?lat=40.7128&lng=-74.0060Public. Checks if coordinates fall within a delivery zone and returns the applicable delivery fee.
โ Create Delivery Zone โ
POST /api/locations/:locationId/delivery-zones
Authorization: Bearer <manager-token>json
{
"name": "Zone 1 - Downtown",
"charge": 3.99,
"minOrder": 15.00,
"boundaries": { "type": "Polygon", "coordinates": [...] },
"isActive": true
}โ๏ธ๐๏ธ Update / Delete Delivery Zone โ
PATCH /api/locations/:locationId/delivery-zones/:zoneId
DELETE /api/locations/:locationId/delivery-zones/:zoneId๐ช Tables โ
๐ List Tables โ
GET /api/locations/:locationId/tables๐ Get Table โ
GET /api/locations/:locationId/tables/:tableIdโ Create Table โ
POST /api/locations/:locationId/tables
Authorization: Bearer <manager-token>json
{
"name": "Table 1",
"capacity": 4,
"isActive": true
}โ๏ธ๐๏ธ Update / Delete Table โ
PATCH /api/locations/:locationId/tables/:tableId
DELETE /api/locations/:locationId/tables/:tableId๐ Permissions Summary โ
| Action | Required Role |
|---|---|
| ๐ List / get locations | Public |
| โ๏ธ Create / update locations | Manager, Super Admin |
| ๐๏ธ Delete locations | Super Admin |
| ๐ List / check delivery zones | Public |
| โ๏ธ Manage delivery zones | Manager, Super Admin |
| ๐๏ธ Delete delivery zones | Super Admin |
| ๐ List / get tables | Public |
| โ๏ธ Manage tables | Manager, Super Admin |
| ๐๏ธ Delete tables | Super Admin |