repti-commerce handles all marketplace and sales functionality, enabling breeders to list animals for sale and buyers to discover and purchase reptiles with confidence.
GET /inquiries # List inquiriesPOST /inquiries # Send inquiry to sellerGET /inquiries/{inquiry_id} # Inquiry detailsPOST /inquiries/{inquiry_id}/respond # Respond to inquiryPUT /inquiries/{inquiry_id}/status # Update inquiry statusPOST /inquiries/{inquiry_id}/convert # Convert to order
-- Marketplace listingsCREATE TABLE marketplace_listings ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), organization_id UUID NOT NULL, animal_id UUID NOT NULL, -- References repti-animal service title VARCHAR(255) NOT NULL, description TEXT, price_cents INTEGER NOT NULL, currency VARCHAR(3) DEFAULT 'USD', status VARCHAR(20) DEFAULT 'active', visibility VARCHAR(20) DEFAULT 'public', featured BOOLEAN DEFAULT FALSE, featured_until TIMESTAMP WITH TIME ZONE, shipping_info JSONB DEFAULT '{}', terms_conditions TEXT, view_count INTEGER DEFAULT 0, inquiry_count INTEGER DEFAULT 0, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Listing categories and tagsCREATE TABLE listing_categories ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), listing_id UUID REFERENCES marketplace_listings(id) ON DELETE CASCADE, category VARCHAR(100) NOT NULL, subcategory VARCHAR(100), created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Listing promotion historyCREATE TABLE listing_promotions ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), listing_id UUID REFERENCES marketplace_listings(id) ON DELETE CASCADE, promotion_type VARCHAR(50) NOT NULL, start_date TIMESTAMP WITH TIME ZONE NOT NULL, end_date TIMESTAMP WITH TIME ZONE NOT NULL, cost_cents INTEGER, impressions INTEGER DEFAULT 0, clicks INTEGER DEFAULT 0, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());
Inventory Management
Copy
-- Animal inventoryCREATE TABLE animal_inventory ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), organization_id UUID NOT NULL, animal_id UUID NOT NULL, -- References repti-animal service status VARCHAR(20) DEFAULT 'available', listing_id UUID REFERENCES marketplace_listings(id), reserved_until TIMESTAMP WITH TIME ZONE, reserved_by UUID, -- References user acquisition_cost_cents INTEGER, target_price_cents INTEGER, min_price_cents INTEGER, feeding_schedule JSONB DEFAULT '{}', care_notes TEXT, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), UNIQUE(animal_id));-- Inventory status historyCREATE TABLE inventory_status_history ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), inventory_id UUID REFERENCES animal_inventory(id) ON DELETE CASCADE, previous_status VARCHAR(20), new_status VARCHAR(20) NOT NULL, reason VARCHAR(255), changed_by UUID NOT NULL, changed_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());
Orders & Transactions
Copy
-- Purchase ordersCREATE TABLE orders ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), order_number VARCHAR(50) UNIQUE NOT NULL, buyer_id UUID NOT NULL, seller_id UUID NOT NULL, listing_id UUID REFERENCES marketplace_listings(id), animal_id UUID NOT NULL, status VARCHAR(20) DEFAULT 'pending', subtotal_cents INTEGER NOT NULL, tax_cents INTEGER DEFAULT 0, shipping_cents INTEGER DEFAULT 0, total_cents INTEGER NOT NULL, currency VARCHAR(3) DEFAULT 'USD', payment_status VARCHAR(20) DEFAULT 'pending', payment_intent_id VARCHAR(255), -- Stripe payment intent shipping_address JSONB NOT NULL, billing_address JSONB NOT NULL, special_instructions TEXT, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Order status trackingCREATE TABLE order_status_history ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), order_id UUID REFERENCES orders(id) ON DELETE CASCADE, status VARCHAR(20) NOT NULL, notes TEXT, updated_by UUID, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Shipping informationCREATE TABLE order_shipping ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), order_id UUID REFERENCES orders(id) ON DELETE CASCADE, carrier VARCHAR(100), tracking_number VARCHAR(255), shipping_method VARCHAR(100), estimated_delivery DATE, actual_delivery DATE, shipping_notes TEXT, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());
Inquiries & Communication
Copy
-- Sales inquiriesCREATE TABLE sales_inquiries ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), listing_id UUID REFERENCES marketplace_listings(id), animal_id UUID NOT NULL, inquirer_id UUID NOT NULL, seller_id UUID NOT NULL, subject VARCHAR(255), message TEXT NOT NULL, status VARCHAR(20) DEFAULT 'open', priority VARCHAR(10) DEFAULT 'normal', responded_at TIMESTAMP WITH TIME ZONE, converted_to_order_id UUID REFERENCES orders(id), created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());-- Inquiry responsesCREATE TABLE inquiry_responses ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), inquiry_id UUID REFERENCES sales_inquiries(id) ON DELETE CASCADE, respondent_id UUID NOT NULL, message TEXT NOT NULL, is_seller_response BOOLEAN NOT NULL, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW());
repti-commerce enables the marketplace ecosystem that allows ReptiDex users to buy and sell animals while maintaining the platform’s focus on verified lineage and transparent transactions.