Browse Source

docs: update CLAUDE.md with WooCommerce sync documentation #13

- Document woocommerce-sync Edge Function
- Add WooCommerce cache tables to database schema section
- Note rate limiting, retry logic, and pagination features

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Claude 5 months ago
parent
commit
324e157
1 changed files with 64 additions and 0 deletions
  1. 64 0
      CLAUDE.md

+ 64 - 0
CLAUDE.md

@@ -111,8 +111,11 @@ supabase functions serve
 - **WooCommerce integration** (fully implemented)
   - OAuth flow: `oauth-woocommerce` (OAuth 1.0a authentication)
   - API client: `_shared/woocommerce-client.ts`
+  - **Data synchronization**: `woocommerce-sync` (manual sync for products, orders, customers)
   - Read-only access to products, orders, and customers
   - Secure OAuth 1.0a with HMAC-SHA256 signatures
+  - Rate limiting (5 req/sec) and retry logic with exponential backoff
+  - Pagination support for large datasets
 - **ShopRenter integration** (fully implemented)
   - OAuth flow: `oauth-shoprenter-init`, `oauth-shoprenter-callback`
   - Uninstall webhook: `webhook-shoprenter-uninstall`
@@ -174,6 +177,67 @@ supabase functions serve
 - last_synced_at: timestamp
 ```
 
+**woocommerce_products_cache table** (cached WooCommerce products):
+```
+- id: UUID (primary key)
+- store_id: UUID (FK to stores)
+- wc_product_id: text
+- name: text
+- sku: text
+- price: decimal
+- currency: text
+- description: text
+- short_description: text
+- stock_quantity: integer
+- stock_status: text
+- type: text ('simple', 'variable', 'grouped', 'external')
+- categories: jsonb
+- images: jsonb
+- raw_data: jsonb
+- last_synced_at: timestamptz
+- created_at: timestamptz
+- UNIQUE(store_id, wc_product_id)
+```
+
+**woocommerce_orders_cache table** (cached WooCommerce orders):
+```
+- id: UUID (primary key)
+- store_id: UUID (FK to stores)
+- wc_order_id: text
+- order_number: text
+- status: text
+- total: decimal
+- currency: text
+- customer_name: text
+- customer_email: text
+- line_items: jsonb
+- billing_address: jsonb
+- shipping_address: jsonb
+- created_at: timestamptz
+- raw_data: jsonb
+- last_synced_at: timestamptz
+- UNIQUE(store_id, wc_order_id)
+```
+
+**woocommerce_customers_cache table** (cached WooCommerce customers):
+```
+- id: UUID (primary key)
+- store_id: UUID (FK to stores)
+- wc_customer_id: text
+- email: text
+- first_name: text
+- last_name: text
+- username: text
+- billing_address: jsonb
+- shipping_address: jsonb
+- orders_count: integer
+- total_spent: decimal
+- raw_data: jsonb
+- last_synced_at: timestamptz
+- created_at: timestamptz
+- UNIQUE(store_id, wc_customer_id)
+```
+
 **shoprenter_webhooks table** (webhook registrations):
 ```
 - store_id: UUID (FK to stores)