Skip to content

al_ard legacy filter audit (WS3 canonicalization) โ€‹

After 20260612220000_ws3_brokerage_taxonomy.sql, properties_base.al_ard stores English machine keys (available, sold_by_us, โ€ฆ). Several DB objects still filtered on legacy Arabic literals, which broke public catalog visibility for new listings.

Migration 20260630110000_fix_catalog_al_ard_available_keys.sql introduces property_is_catalog_live(al_ard, show_in_catalog) and patches the objects below.

Fixed in 20260630110000 โ€‹

ObjectPrevious filterNew filter
property_is_catalog_live()โ€” (new helper)show_in_catalog AND al_ard IN ('available', 'ู…ุนุฑูˆุถ')
get_catalog_properties()al_ard = 'ู…ุนุฑูˆุถ' (web regression in 20260628180141)property_is_catalog_live(...)
api.get_catalog_properties()wrapperunchanged (delegates to public)
properties_catalog viewal_ard = 'available' onlyproperty_is_catalog_live(...)
get_public_bundle()show_in_catalog AND al_ard = 'available'property_is_catalog_live(...)
ceo_dashboard_stats() property active countal_ard = 'available'al_ard IN ('available', 'ู…ุนุฑูˆุถ')

Already correct (English-only, no change needed) โ€‹

These objects were patched in WS3 partial migrations and already use al_ard = 'available':

  • check_duplicate_active_listing trigger
  • check_property_alerts_on_new_listing trigger
  • get_area_market_report
  • get_matches_by_client_token
  • notify_matching_requests / notify_on_property_status_match / notify_on_request_match
  • notify_matching_whatsapp_trigger
  • transfer_approved_submission (default insert)
  • Request match notifications (20260613160000, 20260630120000)

Arabic prose in exception/notification messages (e.g. 'ุนู‚ุงุฑ ู…ุนุฑูˆุถ') is intentional copy โ€” not DB filters.

Intentionally not changed โ€‹

ObjectReason
check_property_alerts edge fnAlready accepts both keys in application code
Duplicate-listing guardsOnly available rows are active listings post-WS3 CHECK
WhatsApp catalog syncReads properties table directly; staff must set show_in_catalog + available

Client parity โ€‹

Flutter propertyIsCatalogLive() mirrors the SQL helper for share-text and UI gates.

Verification โ€‹

sql
-- Should return rows where show_in_catalog=true AND al_ard='available'
SELECT count(*) FROM get_catalog_properties();

SELECT property_is_catalog_live('available', true);  -- true
SELECT property_is_catalog_live('ู…ุนุฑูˆุถ', true);      -- true
SELECT property_is_catalog_live('sold_by_us', true); -- false

Aldilaijan & Khobara Real Estate Platform