Temă
Catalogue API
| GraphQL | Who | What |
|---|---|---|
categories | anyone | Menu categories with the number of active listings |
listings(filter, sort, page) | anyone (favourite flags when logged in) | Search: text, category, price range, conditions, county, delivery, seller; sort RELEVANCE / NEWEST / PRICE_ASC / PRICE_DESC; pages of 12, 24 or 48 |
listing(idOrSlug) | anyone; non-public statuses only for the seller | Product page: description, specs, photos, seller summary; counts a view once per visitor and hour |
similarListings(listingId) | anyone | 4 active listings from the same category |
seller(id) | anyone | Public seller profile (suspended accounts hidden) |
myFavorites, addFavorite, removeFavorite | customer | Saved listings; idempotent; keeps favorites_count in sync |
mySavedSearches, saveSearch, updateSavedSearch, deleteSavedSearch | customer | Saved filters with the number of new listings since last seen; max 20 |
GET /api/media/<key> | anyone | Photos from object storage (listings/…); demo listings get a generated illustration |
Search
- MySQL
FULLTEXTindex ontitle, description(migrationlisting_fulltext_search). The column collationutf8mb4_0900_ai_cimakes matching case- and accent-insensitive: "geaca" finds "Geacă". - User text is turned into boolean mode: every word required, prefix match (
iphon→ iPhone); operators typed by users are stripped; words shorter than 3 letters are ignored (InnoDB minimum token size). - Running "Top" promotions are always listed first; then relevance or price; then newest.
- Two queries per page: ids + total with all filters, then the listings with photos and category (no N+1).
Tests
tests/e2e/catalog.e2e.mjs — 41 checks (filters, sorting, pagination, accent-insensitive search, views, visibility rules, favourites, saved searches, media security). node tests/e2e/run-all.mjs --only catalog,selling-messaging runs both suites.