Database query walkthrough
Listing detail query
Asks for one buyable listing and its related card data.
- Django path
frontend.services.listing_service.get_listing
- Tables touched
- MarketListing, InventoryItem, CardVariant, Card, CardGame, CardSet, CardImage, User
- Ask for listings with ACTIVE status and quantity_available greater than zero.
- Filter by the listing id from the URL.
- Return no row when the listing is inactive, paused, cancelled, sold out, or unavailable.
- Ask for seller and card metadata rows through the listing relationship.
- Read the matching listing row for the detail template.
ORM shape
MarketListing.objects.filter(status=ACTIVE, quantity_available__gt=0)
.select_related(...)
.filter(pk=listing_id)
.first()