link,[object Object]
Skip to content

Admin Flows Playbook ​

Purpose: Practical steps for common admin operations: listing moderation, profile/seller verification, and email template testing. Audience: Admin, Developer Prerequisites: Admin account; Supabase linked; Edge functions enabled.

Listing moderation

  • Where: /admin/listings, /admin/listings/:id, /admin/listings/:id/details
    • Code: src/pages/admin/AdminListings.tsx, src/pages/admin/AdminListingsDetail.tsx, src/pages/admin/AdminListingEdit.tsx
    • Components: src/components/admin/listings/*, src/components/admin/AdminListingPreview.tsx
  • Steps
    1. Filter "Pending" and open listing
    2. Add field-level comments (admin_listing_comments)
    3. IMPORTANT: Check seller verification status before approving
    4. Approve or request changes
  • Critical Approval Process:
    • For Verified Sellers: System automatically updates both status='active' AND verification_status='approved'
    • For Unverified Sellers: Only updates status='active', keeps verification_status='pending'
    • Result: Only verified sellers' approved listings are visible to public
  • SQL quick checks
    sql
    -- Recent admin comments
    select listing_id, field_key, comment, is_resolved, created_at
    from admin_listing_comments
    order by created_at desc
    limit 20;
    
    -- Listing status distribution
    select status, count(*) from listings group by status;
    
    -- Check seller verification status before approval
    select l.id, l.title, l.status, l.verification_status, p.seller_verification_status, p.seller_verified
    from listings l
    join profiles p on l.seller_id = p.id
    where l.status = 'pending';
    
    -- Verify listing visibility (should show only approved listings for public)
    select id, title, status, verification_status, 
           case when status='active' and verification_status='approved' then 'VISIBLE' else 'HIDDEN' end as visibility
    from listings
    order by created_at desc
    limit 10;

Seller/Profile verification

  • Where: /admin/profile-verifications, /profile-verification, /seller-verification
    • Code: src/pages/admin/AdminSellerVerifications.tsx, src/pages/ProfileVerification.tsx, src/pages/SellerVerification.tsx
  • Tables: seller_verifications (docs/data-model/schema.md)
  • Steps
    1. User submits docs (status pending)
    2. Admin reviews and updates status to approved|rejected
    3. Optional: notify via email (send-email)
  • SQL quick checks
    sql
    select status, count(*) from seller_verifications group by status;
    select * from seller_verifications order by submitted_at desc limit 20;

Admin direct messages and templates

  • Where: /admin/templates
    • Code: src/components/admin/templates/* (EmailTemplateEditor, AdminDirectMessage, NotificationTemplateEditor)
  • Steps (send test)
    1. Open Admin → Templates → pick template
    2. Edit subject/HTML → Send Test (calls send-email)
    3. Verify email_logs in /admin/logs
  • SQL quick checks
    sql
    select recipient_email, email_type, template_name, send_status, created_at
    from email_logs
    order by created_at desc
    limit 20;

Contact messages

  • Where: Admin → Logs or dedicated view (TBD)
  • Table: admin_contact_messages — incoming messages from users
  • SQL quick checks
    sql
    select status, count(*) from admin_contact_messages group by status;
    select subject, message, admin_response from admin_contact_messages order by created_at desc limit 20;

Tips

  • Keep moderation feedback actionable and tied to specific field_key
  • Use email templates for consistent admin communications
  • Confirm role checks and RLS before exposing any admin data to end-users

Related

  • Admin tables: docs/architecture/admin-tables.md
  • Email & Templates: docs/architecture/email-templates.md