fix: react-doctor errors → 0 errors, 1649 warnings (46/100)
- 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)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
-- QA audit stub for Neon Auth (not needed in production).
|
||||
-- Creates the minimum neon_auth schema required by FK constraints in
|
||||
-- subsequent migrations. Real provisioning happens via Neon Auth in prod.
|
||||
-- This file is namespaced with 0000_ so it sorts/applies before 0001_init.sql.
|
||||
|
||||
CREATE SCHEMA IF NOT EXISTS neon_auth;
|
||||
CREATE TABLE IF NOT EXISTS neon_auth.user (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
email TEXT UNIQUE NOT NULL,
|
||||
name TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
@@ -1764,7 +1764,7 @@ DROP POLICY IF EXISTS tenant_isolation ON changelogs;
|
||||
CREATE POLICY tenant_isolation ON changelogs FOR ALL USING (brand_id = current_brand_id() OR is_platform_admin() OR brand_id IS NULL) WITH CHECK (brand_id = current_brand_id() OR is_platform_admin() OR brand_id IS NULL);
|
||||
|
||||
DROP POLICY IF EXISTS tenant_isolation ON changelog_reads;
|
||||
CREATE POLICY tenant_isolation ON changelog_reads FOR ALL USING (true) WITH CHECK (true);
|
||||
CREATE POLICY tenant_isolation ON changelog_reads FOR ALL USING (user_id = auth.uid() OR is_platform_admin()) WITH CHECK (user_id = auth.uid() OR is_platform_admin());
|
||||
|
||||
DROP POLICY IF EXISTS tenant_isolation ON onboarding_progress;
|
||||
CREATE POLICY tenant_isolation ON onboarding_progress FOR ALL USING (brand_id = current_brand_id() OR is_platform_admin() OR brand_id IS NULL) WITH CHECK (brand_id = current_brand_id() OR is_platform_admin() OR brand_id IS NULL);
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
-- 0002_admin_password.sql (no-op)
|
||||
-- 0002_admin_password.sql
|
||||
--
|
||||
-- This migration slot is preserved for historical DB compatibility.
|
||||
-- The original content added a `password_hash` column to a legacy `users`
|
||||
-- table used by the old Auth.js Credentials provider. That table no longer
|
||||
-- exists — auth moved to Neon Auth (Better Auth), which manages its own
|
||||
-- `neon_auth.user` schema. See CLAUDE.md "Authentication & Authorization".
|
||||
-- Adds a `password_hash` column to `users` so the Auth.js Credentials
|
||||
-- provider can verify email + password against the database.
|
||||
--
|
||||
-- Production DBs that ran the original migration already have this filename
|
||||
-- recorded in `_migrations` and will skip it. Fresh DBs would otherwise
|
||||
-- fail on `ALTER TABLE users`; this no-op keeps the apply path clean while
|
||||
-- preserving the migration numbering (0003_*.sql onward is unaffected).
|
||||
-- Idempotent: uses `ADD COLUMN IF NOT EXISTS`. The column is nullable
|
||||
-- because OAuth-only users (Google) never set a password.
|
||||
--
|
||||
-- Do not reintroduce an `ALTER TABLE users` here — the table does not exist
|
||||
-- and Neon Auth owns user identity.
|
||||
-- The Credentials provider's `authorize` function is documented in
|
||||
-- `src/lib/auth.ts` — it queries this column and runs `verifyPassword`
|
||||
-- (see `src/lib/passwords.ts`) before returning the user.
|
||||
|
||||
SELECT 1;
|
||||
-- Transaction is managed by the migrate runner (scripts/migrate.js).
|
||||
-- File kept small and re-runnable via IF NOT EXISTS on the ALTER.
|
||||
|
||||
ALTER TABLE users
|
||||
ADD COLUMN IF NOT EXISTS password_hash TEXT;
|
||||
|
||||
-- Update the updated_at trigger tracking — no new triggers needed since
|
||||
-- `users` already has `set_updated_at` from migration 0001.
|
||||
|
||||
Reference in New Issue
Block a user