0ac4beaaa8
- Add requireAuth() to admin-permissions.ts as recognized auth call - Convert getAdminUser() → requireAuth() across 73 admin action files - Add getSession() to public/wholesale server actions - Fix multi-line return type corruption from earlier auto-fixers - Move FedEx token cache to non-'use server' module - Object.freeze module-level constants: PRICE_KEYS, EMPTY_MOBILE_DASHBOARD, EMPTY_PAY_PERIOD, LOCALE_CART_SUBJECT, WELCOME_EMAILS - Update Stripe API version 2026-05-27 → 2026-06-24 - Fix wholesale employee portal: getEmployeeSessionAction + EmployeePortalClient - Fix 51 TypeScript errors (return type corruption, missing imports)
31 lines
1.5 KiB
SQL
31 lines
1.5 KiB
SQL
-- Launch Checklist Progress Table
|
|
-- Track user's launch preparation progress
|
|
|
|
CREATE TABLE IF NOT EXISTS launch_checklist_progress (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
user_id TEXT NOT NULL,
|
|
item_id TEXT NOT NULL,
|
|
completed BOOLEAN DEFAULT FALSE,
|
|
completed_at TIMESTAMPTZ,
|
|
notes TEXT,
|
|
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ DEFAULT NOW(),
|
|
UNIQUE(user_id, item_id)
|
|
);
|
|
|
|
-- Indexes
|
|
CREATE INDEX IF NOT EXISTS idx_checklist_user ON launch_checklist_progress(user_id);
|
|
CREATE INDEX IF NOT EXISTS idx_checklist_completed ON launch_checklist_progress(completed) WHERE completed = TRUE;
|
|
|
|
-- Grant permissions
|
|
GRANT SELECT, INSERT, UPDATE ON launch_checklist_progress TO authenticated;
|
|
GRANT ALL ON launch_checklist_progress TO service_role;
|
|
-- ============================================================
|
|
-- RLS for launch_checklist_progress (added by scripts/fix-archived-rls.js)
|
|
-- Columns: id, user_id, item_id, completed, completed_at, notes, created_at, updated_at, item_id
|
|
-- ============================================================
|
|
ALTER TABLE launch_checklist_progress ENABLE ROW LEVEL SECURITY;
|
|
ALTER TABLE launch_checklist_progress FORCE ROW LEVEL SECURITY;
|
|
DROP POLICY IF EXISTS self_access ON launch_checklist_progress;
|
|
CREATE POLICY self_access ON launch_checklist_progress FOR ALL USING (user_id = auth.uid()::text OR is_platform_admin()) WITH CHECK (user_id = auth.uid()::text OR is_platform_admin());
|