Skip to main content

Stores API

Base path: /api/stores
File: ayts-api/src/routes/stores.ts

GET /api/stores

List stores with filtering and pagination.

Query params:

ParamTypeDescription
statusactive|pending|inactiveFilter by status (default: active)
categorystringFilter by category
sortrating|created_at|nameSort order
limitnumberPage size (default: 20)
offsetnumberPagination offset
searchstringFTS search query

Response 200:

{
"success": true,
"stores": [{
"id": "uuid",
"name": "Fresh Mart Grocery",
"category": "grocery",
"description": "...",
"logoUrl": "https://r2...",
"bannerUrl": "https://r2...",
"rating": 4.5,
"reviewCount": 12,
"status": "active",
"city": "Cebu City",
"barangay": "Lahug",
"distance": 1.2
}],
"total": 45,
"limit": 20,
"offset": 0
}

GET /api/stores/:id

Get a single store by UUID.

Response 200: Full store object including products, rating breakdown.
Response 404: Store not found.


POST /api/stores

Create a new store. Requires vendor or admin role.

{
"name": "My Grocery",
"category": "grocery",
"description": "...",
"address": "123 Main St",
"city": "Cebu City",
"barangay": "Lahug",
"phone": "+63917...",
"logoUrl": "https://r2...",
"bannerUrl": "https://r2...",
"operatingHours": {
"monday": { "open": "08:00", "close": "20:00" },
"tuesday": { "open": "08:00", "close": "20:00" }
}
}

PATCH /api/stores/:id

Update store info. Requires owner or admin.


GET /api/stores/:id/products

Get all products for a store.

Query params: status, category, limit, offset


GET /api/stores/:id/reviews

Get reviews for a store.


GET /api/stores/:id/hours

Get operating hours for a store.


GET /api/stores/:id/fb-feed

Returns a Facebook Commerce Manager-compatible JSON product catalog for a store.

Auth required: No — publicly accessible so Facebook can crawl it.

Response 200:

{
"data": [
{
"id": "3f8a1c2d-...",
"title": "Organic Brown Rice 1kg",
"description": "Premium organic brown rice.",
"availability": "in stock",
"condition": "new",
"price": "89.00 PHP",
"sale_price": "75.00 PHP",
"link": "https://ayts.jerquinbayudo.workers.dev/stores/:id/products/:productId",
"image_link": "https://r2.ayts.ph/products/...",
"brand": "Fresh Mart Grocery",
"retailer_id": "SKU-001",
"inventory": 42
}
]
}

Notes:

  • Products without an image are excluded (Facebook requires image_link).
  • price is the list price; sale_price is included only when a compare_price is set higher than price.
  • Response is cached public, max-age=3600.
  • Response 404: Store not found or inactive.

See the Facebook Catalog Feed guide for vendor setup instructions.