- Fetch product data from Open Food Facts API
- Cache results in products table
- Handle product not found gracefully
- CORS enabled for frontend access
- Returns cached data for performance
Closes#24
Created 8 helper functions for common inventory operations:
1. get_inventory_details() - Full inventory list with denormalized data
2. get_expiring_items(days) - Items expiring within N days
3. get_items_by_tag(tag_name) - Filter by tag
4. get_low_stock_items(threshold) - Items below quantity threshold
5. update_item_quantity() - Consume/restock with optional auto-delete
6. get_inventory_stats() - Dashboard statistics
7. search_inventory() - Full-text search across items and products
All functions include comments and are optimized for frontend queries.
Closes#15
- Enable RLS on all 6 tables
- inventory_items: shared inventory (all auth users can CRUD)
- products: read-only for users (service role for writes)
- tags: users can manage own tags, read all tags
- item_tags: auth users can tag/untag items
- units: users can create/manage custom units
- user_profiles: users manage only their own profile
- Comprehensive policy comments for documentation
Closes#14